summaryrefslogtreecommitdiff
path: root/res/res_pjsip_diversion.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2016-08-29 18:08:22 -0500
committerRichard Mudgett <rmudgett@digium.com>2016-09-09 17:09:54 -0500
commit30af92e78d36523f8012da5eb9aee16687d8fe61 (patch)
tree1f84280f76613282c8a81dc9b7aaf2b738201dfa /res/res_pjsip_diversion.c
parent7580a736bb30577d7557aac9165894dc9f9583e6 (diff)
res_pjsip: Add ignore_uri_user_options option.
This implements the chan_sip legacy_useroption_parsing option but with a better name. * Made the caller-id number and redirecting number strings obtained from incoming SIP URI user fields always truncated at the first semicolon. People don't care about anything after the semicolon showing up on their displays even though the RFC allows the semicolon. ASTERISK-26316 #close Reported by: Kevin Harwell Change-Id: Ib42b0e940dd34d84c7b14bc2e90d1ba392624f62
Diffstat (limited to 'res/res_pjsip_diversion.c')
-rw-r--r--res/res_pjsip_diversion.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 99d18da44..b9225de9c 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -148,11 +148,32 @@ static void set_redirecting_id(pjsip_name_addr *name_addr, struct ast_party_id *
struct ast_set_party_id *update)
{
pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr->uri);
+ char *semi;
+ pj_str_t 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@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)) {
+ 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)) {