[Asterisk-code-review] res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI (asterisk[18])

Friendly Automation asteriskteam at digium.com
Wed Jun 1 19:26:46 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18581 )

Change subject: res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI
......................................................................

res_pjsip_dialog_info_body_generator: Set LOCAL target URI as local URI

The change "Add LOCAL/REMOTE tags in dialog-info+xml" set both "local"
Identity Element URI and Target Element URI to the same value -
the channel Caller Number.
For Identity Element it's ok to set as Caller ID.
But Local Target URI should be set as local URI.

In this case the Local Target URI can be used for Directed Call Pickup
by Polycom ip-phones (parameter useLocalTargetUriforLegacyPickup).

Also XML sanitized Display names.

ASTERISK-24601

Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343
---
M res/res_pjsip_dialog_info_body_generator.c
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip_dialog_info_body_generator.c b/res/res_pjsip_dialog_info_body_generator.c
index 88aa6c2..972b908 100644
--- a/res/res_pjsip_dialog_info_body_generator.c
+++ b/res/res_pjsip_dialog_info_body_generator.c
@@ -234,7 +234,10 @@
 
 			pj_strdup2(state_data->pool, &remote_identity_node->content, remote_target);
 			if (!ast_strlen_zero(remote_cid_name)) {
-				ast_sip_presence_xml_create_attr(state_data->pool, remote_identity_node, "display", remote_cid_name);
+				char display_sanitized[PJSIP_MAX_URL_SIZE];
+
+				ast_sip_sanitize_xml(remote_cid_name, display_sanitized, sizeof(display_sanitized));
+				ast_sip_presence_xml_create_attr(state_data->pool, remote_identity_node, "display", display_sanitized);
 			}
 			ast_sip_presence_xml_create_attr(state_data->pool, remote_target_node, "uri", remote_target);
 		}
@@ -247,9 +250,13 @@
 			/* If a channel is not available we fall back to the sanitized local URI instead */
 			pj_strdup2(state_data->pool, &local_identity_node->content, S_OR(local_target, sanitized));
 			if (!ast_strlen_zero(local_cid_name)) {
-				ast_sip_presence_xml_create_attr(state_data->pool, local_identity_node, "display", local_cid_name);
+				char display_sanitized[PJSIP_MAX_URL_SIZE];
+
+				ast_sip_sanitize_xml(local_cid_name, display_sanitized, sizeof(display_sanitized));
+				ast_sip_presence_xml_create_attr(state_data->pool, local_identity_node, "display", display_sanitized);
 			}
-			ast_sip_presence_xml_create_attr(state_data->pool, local_target_node, "uri", S_OR(local_target, sanitized));
+
+			ast_sip_presence_xml_create_attr(state_data->pool, local_target_node, "uri", sanitized);
 		}
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18581
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343
Gerrit-Change-Number: 18581
Gerrit-PatchSet: 2
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220601/37519e97/attachment-0001.html>


More information about the asterisk-code-review mailing list