[Asterisk-code-review] res pjsip diversion.c: Truncate redirecting number at first ... (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Thu Sep 8 19:24:26 CDT 2016
Richard Mudgett has uploaded a new change for review.
https://gerrit.asterisk.org/3855
Change subject: res_pjsip_diversion.c: Truncate redirecting number at first semicolon.
......................................................................
res_pjsip_diversion.c: Truncate redirecting number at first semicolon.
ASTERISK-26316
Reported by: Kevin Harwell
Change-Id: I7f349648e5220e68b7bdbac176d9783668d83116
---
M res/res_pjsip_diversion.c
1 file changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/55/3855/1
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 82c3caa..301d9fc 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -148,11 +148,32 @@
struct ast_set_party_id *update)
{
pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr->uri);
+ char *semi;
+ pj_str_t uri_user;
- if (pj_strlen(&uri->user)) {
+ uri_user = uri->user;
+
+ /* Always truncate redirecting number at a semicolon. */
+ semi = pj_strchr(&uri_user, ';');
+ if (semi) {
+ /*
+ * We need to be able to handle URI's looking like
+ * "sip:1235557890;phone-context=national at x.x.x.x;user=phone"
+ *
+ * Where the uri->user field will result in:
+ * "1235557890;phone-context=national"
+ *
+ * People don't care about anything after the semicolon
+ * showing up on their displays even though the RFC
+ * allows the semicolon.
+ */
+ pj_strset(&uri_user, (char *) pj_strbuf(&uri_user), semi - pj_strbuf(&uri_user));
+ }
+
+ if (pj_strlen(&uri_user)) {
update->number = 1;
data->number.valid = 1;
- set_redirecting_value(&data->number.str, &uri->user);
+ set_redirecting_value(&data->number.str, &uri_user);
}
if (pj_strlen(&name_addr->display)) {
--
To view, visit https://gerrit.asterisk.org/3855
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f349648e5220e68b7bdbac176d9783668d83116
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-code-review
mailing list