<p>Dan Cropp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11245">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Added a norefersub configuration setting<br><br>Added a new PJSIP global setting called norefersub.<br>Default is yes to keep support working as before.<br><br>res_pjsip_refer: Configures PJSIP norefersub capability accordingly.<br><br>Checks the PJSIP global setting value.<br>If it is no (disabled) it does not add the norefersub capability<br>to PJSIP.<br>If it is yes (default) it adds the norefersub capability to PJSIP.<br><br>This is useful for Cisco switches that do not follow RFC4488.<br><br>ASTERISK-12345 #close<br>Reported-by: Dan Cropp<br><br>Change-Id: I0b1c28ebc905d881f4a16e752715487a688b30e9<br>---<br>M configs/samples/pjsip.conf.sample<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip.c<br>M res/res_pjsip/config_global.c<br>M res/res_pjsip_refer.c<br>5 files changed, 41 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/11245/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample</span><br><span>index 522a091..6546df4 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -1170,6 +1170,11 @@</span><br><span> ; with extreme caution and only to mitigate specific issues.</span><br><span> ; Under certain conditions they could make things worse.</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+;norefersub=yes ; Enable sending norefersub option tag in Supported header to advertise</span><br><span style="color: hsl(120, 100%, 40%);">+ ; that the User Agent is capable of accepting a REFER request with</span><br><span style="color: hsl(120, 100%, 40%);">+ ; creating an implicit subscription (see RFC 4488).</span><br><span style="color: hsl(120, 100%, 40%);">+ ; (default: "yes")</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span> ; MODULE PROVIDING BELOW SECTION(S): res_pjsip_acl</span><br><span> ;==========================ACL SECTION OPTIONS=========================</span><br><span> ;[acl]</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index 335b3e5..c644f2a 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -2789,6 +2789,14 @@</span><br><span> unsigned int ast_sip_get_use_callerid_contact(void);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Retrieve the global setting 'norefersub'.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.4.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval non zero if norefersub is to be sent in "Supported" Headers</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+unsigned int ast_sip_get_norefersub(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \brief Retrieve the global setting 'ignore_uri_user_options'.</span><br><span> * \since 13.12.0</span><br><span> *</span><br><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index 4621fe0..b9c269e 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -1938,6 +1938,9 @@</span><br><span> </para></warning></span><br><span> </description></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="norefersub" default="yes"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>Advertise support for RFC4488 REFER subscription suppression</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ </configOption></span><br><span> </configObject></span><br><span> </configFile></span><br><span> </configInfo></span><br><span>diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c</span><br><span>index 8f21e50..c7e0f89 100644</span><br><span>--- a/res/res_pjsip/config_global.c</span><br><span>+++ b/res/res_pjsip/config_global.c</span><br><span>@@ -52,6 +52,7 @@</span><br><span> #define DEFAULT_USE_CALLERID_CONTACT 0</span><br><span> #define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0</span><br><span> #define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL</span><br><span style="color: hsl(120, 100%, 40%);">+#define DEFAULT_NOREFERSUB 1</span><br><span> </span><br><span> /*!</span><br><span> * \brief Cached global config object</span><br><span>@@ -113,6 +114,8 @@</span><br><span> unsigned int send_contact_status_on_update_registration;</span><br><span> /*! Trigger the distributor should use to pause accepting new dialogs */</span><br><span> enum ast_sip_taskprocessor_overload_trigger overload_trigger;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Nonzero if norefersub is to be sent in Supported header */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int norefersub;</span><br><span> };</span><br><span> </span><br><span> static void global_destructor(void *obj)</span><br><span>@@ -501,6 +504,21 @@</span><br><span> return trigger;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+unsigned int ast_sip_get_norefersub(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int norefersub;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct global_config *cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg = get_global_cfg();</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return DEFAULT_NOREFERSUB;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ norefersub = cfg->norefersub;</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(cfg, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ return norefersub;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int overload_trigger_handler(const struct aco_option *opt,</span><br><span> struct ast_variable *var, void *obj)</span><br><span> {</span><br><span>@@ -704,6 +722,9 @@</span><br><span> ast_sorcery_object_field_register_custom(sorcery, "global", "taskprocessor_overload_trigger",</span><br><span> overload_trigger_map[DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER],</span><br><span> overload_trigger_handler, overload_trigger_to_str, NULL, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_field_register(sorcery, "global", "norefersub",</span><br><span style="color: hsl(120, 100%, 40%);">+ DEFAULT_NOREFERSUB ? "yes" : "no",</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_BOOL_T, 1, FLDSET(struct global_config, norefersub));</span><br><span> </span><br><span> if (ast_sorcery_instance_observer_add(sorcery, &observer_callbacks_global)) {</span><br><span> return -1;</span><br><span>diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c</span><br><span>index 9b75146..4ed5057 100644</span><br><span>--- a/res/res_pjsip_refer.c</span><br><span>+++ b/res/res_pjsip_refer.c</span><br><span>@@ -1230,7 +1230,10 @@</span><br><span> </span><br><span> pjsip_replaces_init_module(ast_sip_get_pjsip_endpoint());</span><br><span> pjsip_xfer_init_module(ast_sip_get_pjsip_endpoint());</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_SUPPORTED, NULL, 1, &str_norefersub);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_sip_get_norefersub()) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_SUPPORTED, NULL, 1, &str_norefersub);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> ast_sip_register_service(&refer_progress_module);</span><br><span> ast_sip_session_register_supplement(&refer_supplement);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11245">change 11245</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/11245"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0b1c28ebc905d881f4a16e752715487a688b30e9 </div>
<div style="display:none"> Gerrit-Change-Number: 11245 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Dan Cropp <dan@amtelco.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>