From 56e32ca3556c1ccbd3eca9e438292ffb586f8bb4 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Mon, 6 Nov 2017 16:29:33 +0000 Subject: [PATCH] res_pjsip_pubsub: Ensure remote URI contains URI only. This change makes it so that any user of the pubsub API that requests the remote URI receives only the URI. Previously the entire string was returned, which could contain a display name. ASTERISK-27290 Change-Id: If1d0cd6630f0a264856d31d2a67933109187a017 --- res/res_pjsip_pubsub.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index e2c6f6ced5..1641ef89ef 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -2463,9 +2463,14 @@ void ast_sip_subscription_get_local_uri(struct ast_sip_subscription *sub, char * void ast_sip_subscription_get_remote_uri(struct ast_sip_subscription *sub, char *buf, size_t size) { pjsip_dialog *dlg; + pjsip_sip_uri *uri; dlg = sub->tree->dlg; - ast_copy_pj_str(buf, &dlg->remote.info_str, size); + uri = pjsip_uri_get_uri(dlg->remote.info->uri); + + if (pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, uri, buf, size) < 0) { + *buf = '\0'; + } } const char *ast_sip_subscription_get_resource_name(struct ast_sip_subscription *sub) -- 2.47.2