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

Alexei Gradinari asteriskteam at digium.com
Tue May 31 08:53:43 CDT 2022


Alexei Gradinari has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18582 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/82/18582/1

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/+/18582
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: If130a2f2f3b2339b14dca0ec0ebeea3a87b34343
Gerrit-Change-Number: 18582
Gerrit-PatchSet: 1
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220531/a94088b0/attachment.html>


More information about the asterisk-code-review mailing list