diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-08-29 18:08:22 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-09-09 17:09:54 -0500 |
commit | 30af92e78d36523f8012da5eb9aee16687d8fe61 (patch) | |
tree | 1f84280f76613282c8a81dc9b7aaf2b738201dfa /include | |
parent | 7580a736bb30577d7557aac9165894dc9f9583e6 (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 'include')
-rw-r--r-- | include/asterisk/res_pjsip.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index 002182b9a..28ecf7f1d 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -2491,6 +2491,38 @@ int ast_sip_get_mwi_tps_queue_low(void); unsigned int ast_sip_get_mwi_disable_initial_unsolicited(void); /*! + * \brief Retrieve the global setting 'ignore_uri_user_options'. + * \since 13.12.0 + * + * \retval non zero if ignore the user field options. + */ +unsigned int ast_sip_get_ignore_uri_user_options(void); + +/*! + * \brief Truncate the URI user field options string if enabled. + * \since 13.12.0 + * + * \param str URI user field string to truncate if enabled + * + * \details + * 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 is: + * "1235557890;phone-context=national" + * + * When truncated the string will become: + * "1235557890" + */ +#define AST_SIP_USER_OPTIONS_TRUNCATE_CHECK(str) \ + do { \ + char *__semi = strchr((str), ';'); \ + if (__semi && ast_sip_get_ignore_uri_user_options()) { \ + *__semi = '\0'; \ + } \ + } while (0) + +/*! * \brief Retrieve the system debug setting (yes|no|host). * * \note returned string needs to be de-allocated by caller. |