Module: kamailio Branch: master Commit: b44b245244a64d9b71c40eb35db227afc0f71fd1 URL: https://github.com/kamailio/kamailio/commit/b44b245244a64d9b71c40eb35db227af...
Author: Henning Westerholt hw@skalatan.de Committer: Henning Westerholt hw@skalatan.de Date: 2020-07-30T15:53:37Z
topos: more flexible contact_mode 1/2 param parsing by using existing parse functions
---
Modified: src/modules/topos/tps_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/b44b245244a64d9b71c40eb35db227af... Patch: https://github.com/kamailio/kamailio/commit/b44b245244a64d9b71c40eb35db227af...
---
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index e3d4ab41cb..c296cd5b30 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -303,6 +303,7 @@ int tps_dlg_detect_direction(sip_msg_t *msg, tps_data_t *ptsd, int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode) { str tmp; + int ret;
if(parse_sip_msg_uri(msg)<0) { LM_ERR("failed to parse r-uri\n"); @@ -314,12 +315,17 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode) LM_DBG("not an expected param format\n"); return 1; } - - tmp.s = msg->parsed_uri.sip_params.s; - // skip param and '=' sign - tmp.s += _tps_cparam_name.len + 1; - tmp.len = msg->parsed_uri.sip_params.len - _tps_cparam_name.len - 1; - + // find parameter, there might be others + ret = tps_get_param_value(&msg->parsed_uri.params, + &_tps_cparam_name, &tmp); + if (ret < 0) { + LM_ERR("failed to parse param\n"); + return -1; + } + if (ret == 1) { + LM_DBG("prefix para not found\n"); + return 1; + } if(memcmp(tmp.s, "atpsh-", 6)==0) { ptsd->a_uuid = tmp; return 0;