Skip to content

Commit b05d2ed

Browse files
More stuff
1 parent f8892f8 commit b05d2ed

File tree

8 files changed

+2057
-628
lines changed

8 files changed

+2057
-628
lines changed

modules/rr/record.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ int record_route(struct sip_msg* _m, str *params)
245245
str user = STR_NULL;
246246
struct to_body* from;
247247
str* tag;
248+
char *anchor_pos;
248249

249250
from = 0; /* Makes gcc happy */
250251
lp = lp2 = NULL;
@@ -267,8 +268,11 @@ int record_route(struct sip_msg* _m, str *params)
267268
tag = 0;
268269
}
269270

270-
l = anchor_lump(_m, _m->headers->name.s - _m->buf, HDR_RECORDROUTE_T);
271-
l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, HDR_RECORDROUTE_T);
271+
/* Get the anchor position relative to other Record-Routes if existing */
272+
anchor_pos = _m->record_route != NULL ? _m->record_route->name.s : _m->headers->name.s;
273+
274+
l = anchor_lump(_m, anchor_pos - _m->buf, HDR_RECORDROUTE_T);
275+
l2 = anchor_lump(_m, anchor_pos - _m->buf, HDR_RECORDROUTE_T);
272276
if (!l || !l2) {
273277
LM_ERR("failed to create an anchor\n");
274278
return -3;
@@ -299,8 +303,8 @@ int record_route(struct sip_msg* _m, str *params)
299303
}
300304

301305
if (enable_double_rr) {
302-
l = anchor_lump(_m, _m->headers->name.s - _m->buf,HDR_RECORDROUTE_T);
303-
l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, HDR_RECORDROUTE_T);
306+
l = anchor_lump(_m, anchor_pos - _m->buf,HDR_RECORDROUTE_T);
307+
l2 = anchor_lump(_m, anchor_pos - _m->buf, HDR_RECORDROUTE_T);
304308
if (!l || !l2) {
305309
LM_ERR("failed to create an anchor\n");
306310
return -5;

0 commit comments

Comments
 (0)