Browse code

topos: more flexible contact_mode 1/2 param parsing by using existing parse functions

Henning Westerholt authored on 30/07/2020 15:53:37
Showing 1 changed files
... ...
@@ -303,6 +303,7 @@ error:
303 303
 int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
304 304
 {
305 305
 	str tmp;
306
+	int ret;
306 307
 
307 308
 	if(parse_sip_msg_uri(msg)<0) {
308 309
 		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)
314 315
 			LM_DBG("not an expected param format\n");
315 316
 			return 1;
316 317
 		}
317
-
318
-		tmp.s = msg->parsed_uri.sip_params.s;
319
-		// skip param and '=' sign
320
-		tmp.s += _tps_cparam_name.len + 1;
321
-		tmp.len = msg->parsed_uri.sip_params.len - _tps_cparam_name.len - 1;
322
-
318
+		// find parameter, there might be others
319
+		ret = tps_get_param_value(&msg->parsed_uri.params,
320
+			&_tps_cparam_name, &tmp);
321
+		if (ret < 0) {
322
+			LM_ERR("failed to parse param\n");
323
+			return -1;
324
+		}
325
+		if (ret == 1) {
326
+			LM_DBG("prefix para not found\n");
327
+			return 1;
328
+		}
323 329
 		if(memcmp(tmp.s, "atpsh-", 6)==0) {
324 330
 			ptsd->a_uuid = tmp;
325 331
 			return 0;