[sr-dev] git:master:8ac31370: pua_dialoginfo: local_identity_dlg_var

Victor Seva linuxmaniac at torreviejawireless.org
Thu Jun 16 12:17:39 CEST 2022


Module: kamailio
Branch: master
Commit: 8ac3137057d07f42eb8845ae4fb29cd9c4021165
URL: https://github.com/kamailio/kamailio/commit/8ac3137057d07f42eb8845ae4fb29cd9c4021165

Author: Victor Seva <vseva at sipwise.com>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2022-06-16T12:17:32+02:00

pua_dialoginfo: local_identity_dlg_var

---

Modified: src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
Modified: src/modules/pua_dialoginfo/pua_dialoginfo.c

---

Diff:  https://github.com/kamailio/kamailio/commit/8ac3137057d07f42eb8845ae4fb29cd9c4021165.diff
Patch: https://github.com/kamailio/kamailio/commit/8ac3137057d07f42eb8845ae4fb29cd9c4021165.patch

---

diff --git a/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml b/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
index f6e544c832..676201cad4 100644
--- a/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
+++ b/src/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml
@@ -620,6 +620,25 @@ modparam("pua_dialoginfo", "publish_dialog_req_within", 0)
                 </example>
                 </section>
 
+		<section id="pua_dialoginfo.p.local_identity_dlg_var">
+		<title><varname>local_identity_dlg_var</varname> (str)</title>
+		<para>
+			PUBLISH-requests reporting dialog-information will use the value of
+			the dialog variable if exists
+		</para>
+		<para>
+			<emphasis>Default value is <quote>NULL</quote>.</emphasis>
+		</para>
+		<example>
+			<title>Set <varname>local_identity_dlg_var</varname> parameter</title>
+			<programlisting format="linespecific">
+...
+modparam("pua_dialoginfo", "local_identity_dlg_var", "local_identity")
+...
+</programlisting>
+		</example>
+		</section>
+
         <section id="pua_dialoginfo.p.attribute_display">
             <title><varname>attribute_display</varname> (int)</title>
             <para>
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 83c4f2c3f8..1e4f17110d 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -87,6 +87,7 @@ static str caller_dlg_var = {0, 0}; /* pubruri_caller */
 static str callee_dlg_var = {0, 0}; /* pubruri_callee */
 static str caller_entity_when_publish_disabled = {0, 0}; /* pubruri_caller */
 static str callee_entity_when_publish_disabled = {0, 0}; /* pubruri_callee */
+static str local_identity_dlg_var = STR_NULL;
 
 /* Module parameter variables */
 int include_callid         = DEF_INCLUDE_CALLID;
@@ -132,6 +133,7 @@ static param_export_t params[]={
 	{"pubruri_callee_avp",  PARAM_STRING, &pubruri_callee_avp },
 	{"pubruri_caller_dlg_var",  PARAM_STR, &caller_dlg_var },
 	{"pubruri_callee_dlg_var",  PARAM_STR, &callee_dlg_var },
+	{"local_identity_dlg_var",  PARAM_STR, &local_identity_dlg_var },
 	{"callee_trying",       INT_PARAM, &callee_trying },
 	{"disable_caller_publish_flag",   INT_PARAM, &disable_caller_publish_flag },
 	{"disable_callee_publish_flag",   INT_PARAM, &disable_callee_publish_flag },
@@ -312,6 +314,17 @@ void refresh_pubruri_avps(struct dlginfo_cell *dlginfo, str *uri)
 	}
 }
 
+void refresh_local_identity(struct dlg_cell *dlg, str *uri) {
+	str *s = dlg_api.get_dlg_var(dlg, &local_identity_dlg_var);
+
+	if(s != NULL) {
+		uri->s = s->s;
+		uri->len = s->len;
+		LM_DBG("Found local_identity in dialog '%.*s'\n",
+				uri->len, uri->s);
+	}
+}
+
 static void
 __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
 {
@@ -357,6 +370,10 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
 		refresh_pubruri_avps(dlginfo, &uri);
 	}
 
+	if(local_identity_dlg_var.len > 0) {
+		refresh_local_identity(dlg, &uri);
+	}
+
 	switch (type) {
 		case DLGCB_FAILED:
 		case DLGCB_TERMINATED:




More information about the sr-dev mailing list