Browse code

pua_dialoginfo: use dlg api function get_dlg_varval()

Daniel-Constantin Mierla authored on 23/09/2022 12:07:41
Showing 1 changed files
... ...
@@ -315,11 +315,13 @@ void refresh_pubruri_avps(struct dlginfo_cell *dlginfo, str *uri)
315 315
 }
316 316
 
317 317
 void refresh_local_identity(struct dlg_cell *dlg, str *uri) {
318
-	str *s = dlg_api.get_dlg_var(dlg, &local_identity_dlg_var);
318
+	str s = {0};
319 319
 
320
-	if(s != NULL) {
321
-		uri->s = s->s;
322
-		uri->len = s->len;
320
+	dlg_api.get_dlg_varval(dlg, &local_identity_dlg_var, &s);
321
+
322
+	if(s.s != NULL) {
323
+		uri->s = s.s;
324
+		uri->len = s.len;
323 325
 		LM_DBG("Found local_identity in dialog '%.*s'\n",
324 326
 				uri->len, uri->s);
325 327
 	}
... ...
@@ -576,7 +578,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
576 578
 {
577 579
 	struct dlginfo_cell *dlginfo;
578 580
 	int len;
579
-	str* s=NULL;
581
+	str dval = {0};
580 582
 
581 583
 	// generate new random uuid
582 584
 	if(sruid_next_safe(&_puadi_sruid) < 0) {
... ...
@@ -652,9 +654,10 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
652 654
 
653 655
 		} else {
654 656
 			if(caller_dlg_var.len>0
655
-					&& (s = dlg_api.get_dlg_var(dlg, &caller_dlg_var))!=0) {
657
+					&& (dlg_api.get_dlg_varval(dlg, &caller_dlg_var, &dval)==0)
658
+					&& dval.s!=NULL) {
656 659
 				dlginfo->pubruris_caller =
657
-					(struct str_list*)shm_malloc(sizeof(struct str_list) + s->len + 1);
660
+					(struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
658 661
 				if (dlginfo->pubruris_caller==0) {
659 662
 					SHM_MEM_ERROR;
660 663
 					free_dlginfo_cell(dlginfo);
... ...
@@ -663,17 +666,18 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
663 666
 				memset(dlginfo->pubruris_caller, 0, sizeof(struct str_list));
664 667
 				dlginfo->pubruris_caller->s.s = (char*)dlginfo->pubruris_caller
665 668
 					+ sizeof(sizeof(struct str_list));
666
-				memcpy(dlginfo->pubruris_caller->s.s, s->s, s->len);
667
-				dlginfo->pubruris_caller->s.s[s->len] = '\0';
668
-				dlginfo->pubruris_caller->s.len = s->len;
669
+				memcpy(dlginfo->pubruris_caller->s.s, dval.s, dval.len);
670
+				dlginfo->pubruris_caller->s.s[dval.len] = '\0';
671
+				dlginfo->pubruris_caller->s.len = dval.len;
669 672
 				LM_DBG("Found pubruris_caller in dialog '%.*s'\n",
670 673
 						dlginfo->pubruris_caller->s.len, dlginfo->pubruris_caller->s.s);
671 674
 			}
672 675
 
673 676
 			if(callee_dlg_var.len>0
674
-					&& (s = dlg_api.get_dlg_var(dlg, &callee_dlg_var))!=0) {
677
+					&& (dlg_api.get_dlg_varval(dlg, &callee_dlg_var, &dval)==0)
678
+					&& dval.s!=NULL) {
675 679
 				dlginfo->pubruris_callee =
676
-					(struct str_list*)shm_malloc(sizeof(struct str_list) + s->len + 1);
680
+					(struct str_list*)shm_malloc(sizeof(struct str_list) + dval.len + 1);
677 681
 				if (dlginfo->pubruris_callee==0) {
678 682
 					SHM_MEM_ERROR;
679 683
 					free_dlginfo_cell(dlginfo);
... ...
@@ -682,9 +686,9 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type, int disable
682 686
 				memset(dlginfo->pubruris_callee, 0, sizeof(struct str_list));
683 687
 				dlginfo->pubruris_callee->s.s = (char*)dlginfo->pubruris_callee
684 688
 					+ sizeof(sizeof(struct str_list));
685
-				memcpy(dlginfo->pubruris_callee->s.s, s->s, s->len);
686
-				dlginfo->pubruris_callee->s.s[s->len] = '\0';
687
-				dlginfo->pubruris_callee->s.len = s->len;
689
+				memcpy(dlginfo->pubruris_callee->s.s, dval.s, dval.len);
690
+				dlginfo->pubruris_callee->s.s[dval.len] = '\0';
691
+				dlginfo->pubruris_callee->s.len = dval.len;
688 692
 				LM_DBG("Found pubruris_callee in dialog '%.*s'\n",
689 693
 						dlginfo->pubruris_callee->s.len, dlginfo->pubruris_callee->s.s);
690 694
 			}