Module: kamailio Branch: master Commit: 21e2d96672ccbe65eebdf64f839a1ce465a11b7c URL: https://github.com/kamailio/kamailio/commit/21e2d96672ccbe65eebdf64f839a1ce4...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-09-04T13:02:19+02:00
registrar: use parsed uri parameter when provided for save()
- instead of to-uri, aor being built from uri parameter
---
Modified: src/modules/registrar/save.c
---
Diff: https://github.com/kamailio/kamailio/commit/21e2d96672ccbe65eebdf64f839a1ce4... Patch: https://github.com/kamailio/kamailio/commit/21e2d96672ccbe65eebdf64f839a1ce4...
---
diff --git a/src/modules/registrar/save.c b/src/modules/registrar/save.c index 2e25c8e000a..4bd4a1505a1 100644 --- a/src/modules/registrar/save.c +++ b/src/modules/registrar/save.c @@ -926,6 +926,7 @@ int save(struct sip_msg *_m, udomain_t *_d, int _cflags, str *_uri) str aor; int ret; sip_uri_t *u; + sip_uri_t turi; rr_t *route; struct sip_uri puri; param_hooks_t hooks; @@ -935,7 +936,23 @@ int save(struct sip_msg *_m, udomain_t *_d, int _cflags, str *_uri) int novariation = 0;
- u = parse_to_uri(_m); + if(_uri->len > 0) { + if(extract_aor(_uri, &aor, &turi) < 0) { + LM_ERR("failed to extract Address Of Record\n"); + return -1; + } + u = &turi; + } else { + u = parse_to_uri(_m); + if(u == NULL) { + LM_ERR("failed to extract Address Of Record\n"); + return -1; + } + if(extract_aor(&(get_to(_m)->uri), &aor, NULL) < 0) { + LM_ERR("failed to extract Address Of Record\n"); + return -1; + } + } if(u == NULL) goto error;