Hello Daniel,
good catch. One problem though - the code will now generate a shorter
from-tag if the ruri is not available.
Suggestion - what about just doubling the call-id hash in this special
case? As mentioned I plan to refactor this in the next development period.
+ if(ruri) {
+ crcitt_string_array(&from_tag[MD5_LEN + 5], ruri, 1);
+ } else (
+ crcitt_string_array(&from_tag[MD5_LEN + 5], callid, 1);
+ }
Cheers,
Henning
Am 16.09.19 um 09:14 schrieb Daniel-Constantin Mierla:
> Module: kamailio
> Branch: master
> Commit: 38bcfb75d3dfc5492fdee9e9bbb17f44cce37684
> URL: https://github.com/kamailio/kamailio/commit/38bcfb75d3dfc5492fdee9e9bbb17f44cce37684
>
> Author: Daniel-Constantin Mierla <miconda@gmail.com>
> Committer: Daniel-Constantin Mierla <miconda@gmail.com>
> Date: 2019-09-16T09:13:28+02:00
>
> tm: safety check when using r-uri for generating from tag
>
> - it can come from functions exported via tm api and the r-uri can be
> optional because there are other checks if it is null or not
>
> ---
>
> Modified: src/modules/tm/uac.c
>
> ---
>
> Diff: https://github.com/kamailio/kamailio/commit/38bcfb75d3dfc5492fdee9e9bbb17f44cce37684.diff
> Patch: https://github.com/kamailio/kamailio/commit/38bcfb75d3dfc5492fdee9e9bbb17f44cce37684.patch
>
> ---
>
> diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
> index e80b4ad62e..2de8d29f27 100644
> --- a/src/modules/tm/uac.c
> +++ b/src/modules/tm/uac.c
> @@ -110,7 +110,9 @@ void generate_fromtag(str* tag, str* callid, str* ruri)
> {
> /* calculate from tag from callid and request uri */
> crcitt_string_array(&from_tag[MD5_LEN + 1], callid, 1);
> - crcitt_string_array(&from_tag[MD5_LEN + 5], ruri, 1);
> + if(ruri) {
> + crcitt_string_array(&from_tag[MD5_LEN + 5], ruri, 1);
> + }
> tag->s = from_tag;
> tag->len = FROM_TAG_LEN;
> }
>
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
--
Kamailio Merchandising - https://skalatan.de/merchandising/
Kamailio services - https://skalatan.de/services
Henning Westerholt - https://skalatan.de/blog/