Browse code

pua_dialoginfo: local_identity_dlg_var

Victor Seva authored on 28/02/2020 10:39:24 • Victor Seva committed on 16/06/2022 10:17:32
Showing 2 changed files
... ...
@@ -620,6 +620,25 @@ modparam("pua_dialoginfo", "publish_dialog_req_within", 0)
620 620
                 </example>
621 621
                 </section>
622 622
 
623
+		<section id="pua_dialoginfo.p.local_identity_dlg_var">
624
+		<title><varname>local_identity_dlg_var</varname> (str)</title>
625
+		<para>
626
+			PUBLISH-requests reporting dialog-information will use the value of
627
+			the dialog variable if exists
628
+		</para>
629
+		<para>
630
+			<emphasis>Default value is <quote>NULL</quote>.</emphasis>
631
+		</para>
632
+		<example>
633
+			<title>Set <varname>local_identity_dlg_var</varname> parameter</title>
634
+			<programlisting format="linespecific">
635
+...
636
+modparam("pua_dialoginfo", "local_identity_dlg_var", "local_identity")
637
+...
638
+</programlisting>
639
+		</example>
640
+		</section>
641
+
623 642
         <section id="pua_dialoginfo.p.attribute_display">
624 643
             <title><varname>attribute_display</varname> (int)</title>
625 644
             <para>
... ...
@@ -87,6 +87,7 @@ static str caller_dlg_var = {0, 0}; /* pubruri_caller */
87 87
 static str callee_dlg_var = {0, 0}; /* pubruri_callee */
88 88
 static str caller_entity_when_publish_disabled = {0, 0}; /* pubruri_caller */
89 89
 static str callee_entity_when_publish_disabled = {0, 0}; /* pubruri_callee */
90
+static str local_identity_dlg_var = STR_NULL;
90 91
 
91 92
 /* Module parameter variables */
92 93
 int include_callid         = DEF_INCLUDE_CALLID;
... ...
@@ -132,6 +133,7 @@ static param_export_t params[]={
132 133
 	{"pubruri_callee_avp",  PARAM_STRING, &pubruri_callee_avp },
133 134
 	{"pubruri_caller_dlg_var",  PARAM_STR, &caller_dlg_var },
134 135
 	{"pubruri_callee_dlg_var",  PARAM_STR, &callee_dlg_var },
136
+	{"local_identity_dlg_var",  PARAM_STR, &local_identity_dlg_var },
135 137
 	{"callee_trying",       INT_PARAM, &callee_trying },
136 138
 	{"disable_caller_publish_flag",   INT_PARAM, &disable_caller_publish_flag },
137 139
 	{"disable_callee_publish_flag",   INT_PARAM, &disable_callee_publish_flag },
... ...
@@ -312,6 +314,17 @@ void refresh_pubruri_avps(struct dlginfo_cell *dlginfo, str *uri)
312 314
 	}
313 315
 }
314 316
 
317
+void refresh_local_identity(struct dlg_cell *dlg, str *uri) {
318
+	str *s = dlg_api.get_dlg_var(dlg, &local_identity_dlg_var);
319
+
320
+	if(s != NULL) {
321
+		uri->s = s->s;
322
+		uri->len = s->len;
323
+		LM_DBG("Found local_identity in dialog '%.*s'\n",
324
+				uri->len, uri->s);
325
+	}
326
+}
327
+
315 328
 static void
316 329
 __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
317 330
 {
... ...
@@ -357,6 +370,10 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
357 370
 		refresh_pubruri_avps(dlginfo, &uri);
358 371
 	}
359 372
 
373
+	if(local_identity_dlg_var.len > 0) {
374
+		refresh_local_identity(dlg, &uri);
375
+	}
376
+
360 377
 	switch (type) {
361 378
 		case DLGCB_FAILED:
362 379
 		case DLGCB_TERMINATED: