<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19836">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session: Add overlap_context option.<br><br>Adds the overlap_context option, which can be used<br>to explicitly specify a context to use for overlap<br>dialing extension matches, rather than forcibly<br>using the context configured for the endpoint.<br><br>ASTERISK-30262 #close<br><br>Change-Id: Ibbcd4a8b11402428a187fb56b8d4e7408774a0db<br>---<br>M configs/samples/pjsip.conf.sample<br>A contrib/ast-db-manage/config/versions/f261363a857f_add_overlap_context.py<br>A doc/CHANGES-staging/res_pjsip_session_overlap.txt<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip/pjsip_config.xml<br>M res/res_pjsip/pjsip_configuration.c<br>M res/res_pjsip/pjsip_manager.xml<br>M res/res_pjsip_session.c<br>8 files changed, 67 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/19836/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 0a93cbe..572cf08 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -616,6 +616,8 @@</span><br><span> ;aggregate_mwi=yes ; (default: "yes")</span><br><span> ;allow= ; Media Codec s to allow (default: "")</span><br><span> ;allow_overlap=yes ; Enable RFC3578 overlap dialing support. (default: "yes")</span><br><span style="color: hsl(120, 100%, 40%);">+;overlap_context=default ; Context to used for overlap dialing matches</span><br><span style="color: hsl(120, 100%, 40%);">+ ; (default: same as context option)</span><br><span> ;aors= ; AoR s to be used with the endpoint (default: "")</span><br><span> ;auth= ; Authentication Object s associated with the endpoint (default: "")</span><br><span> ;callerid= ; CallerID information for the endpoint (default: "")</span><br><span>diff --git a/contrib/ast-db-manage/config/versions/f261363a857f_add_overlap_context.py b/contrib/ast-db-manage/config/versions/f261363a857f_add_overlap_context.py</span><br><span>new file mode 100644</span><br><span>index 0000000..e0ea297</span><br><span>--- /dev/null</span><br><span>+++ b/contrib/ast-db-manage/config/versions/f261363a857f_add_overlap_context.py</span><br><span>@@ -0,0 +1,21 @@</span><br><span style="color: hsl(120, 100%, 40%);">+"""add overlap_context</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Revision ID: f261363a857f</span><br><span style="color: hsl(120, 100%, 40%);">+Revises: 5a2247c957d2</span><br><span style="color: hsl(120, 100%, 40%);">+Create Date: 2022-12-09 13:58:48.622000</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%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# revision identifiers, used by Alembic.</span><br><span style="color: hsl(120, 100%, 40%);">+revision = 'f261363a857f'</span><br><span style="color: hsl(120, 100%, 40%);">+down_revision = '5a2247c957d2'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+from alembic import op</span><br><span style="color: hsl(120, 100%, 40%);">+import sqlalchemy as sa</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%);">+def upgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ op.add_column('ps_endpoints', sa.Column('overlap_context', sa.String(80)))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+def downgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_column('ps_endpoints', 'overlap_context')</span><br><span>diff --git a/doc/CHANGES-staging/res_pjsip_session_overlap.txt b/doc/CHANGES-staging/res_pjsip_session_overlap.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..5523f3c</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/res_pjsip_session_overlap.txt</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_pjsip_session</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+The overlap_context option now allows explicitly</span><br><span style="color: hsl(120, 100%, 40%);">+specifying a context to use for overlap dialing matches.</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index a49a56e..5b86d0f 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -1065,6 +1065,8 @@</span><br><span> AST_STRING_FIELD_EXTENDED(geoloc_incoming_call_profile);</span><br><span> /*! The name of the geoloc profile to apply when Asterisk sends a call to this endpoint */</span><br><span> AST_STRING_FIELD_EXTENDED(geoloc_outgoing_call_profile);</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! The context to use for overlap dialing, if different from the endpoint's context */</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_STRING_FIELD_EXTENDED(overlap_context);</span><br><span> /*! 100rel mode to use with this endpoint */</span><br><span> enum ast_sip_100rel_mode rel100;</span><br><span> /*! Send Advice-of-Charge messages */</span><br><span>diff --git a/res/res_pjsip/pjsip_config.xml b/res/res_pjsip/pjsip_config.xml</span><br><span>index 99ca645..bbbdd12 100644</span><br><span>--- a/res/res_pjsip/pjsip_config.xml</span><br><span>+++ b/res/res_pjsip/pjsip_config.xml</span><br><span>@@ -313,6 +313,16 @@</span><br><span> <configOption name="allow_overlap" default="yes"></span><br><span> <synopsis>Enable RFC3578 overlap dialing support.</synopsis></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="overlap_context"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>Dialplan context to use for RFC3578 overlap dialing.</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <description></span><br><span style="color: hsl(120, 100%, 40%);">+ <para>Dialplan context to use for overlap dialing extension matching.</span><br><span style="color: hsl(120, 100%, 40%);">+ If not specified, the context configured for the endpoint will be used.</span><br><span style="color: hsl(120, 100%, 40%);">+ If specified, the extensions/patterns in the specified context will be used</span><br><span style="color: hsl(120, 100%, 40%);">+ for determining if a full number has been received from the endpoint.</span><br><span style="color: hsl(120, 100%, 40%);">+ </para></span><br><span style="color: hsl(120, 100%, 40%);">+ </description></span><br><span style="color: hsl(120, 100%, 40%);">+ </configOption></span><br><span> <configOption name="aors"></span><br><span> <synopsis>AoR(s) to be used with the endpoint</synopsis></span><br><span> <description><para></span><br><span>diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c</span><br><span>index bb015d0..e101488 100644</span><br><span>--- a/res/res_pjsip/pjsip_configuration.c</span><br><span>+++ b/res/res_pjsip/pjsip_configuration.c</span><br><span>@@ -2229,6 +2229,7 @@</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "asymmetric_rtp_codec", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, asymmetric_rtp_codec));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtcp_mux", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtcp_mux));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_overlap", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_overlap));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "overlap_context", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, overlap_context));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "refer_blind_progress", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, refer_blind_progress));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "notify_early_inuse_ringing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, notify_early_inuse_ringing));</span><br><span> ast_sorcery_object_field_register(sip_sorcery, "endpoint", "max_audio_streams", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.max_audio_streams));</span><br><span>@@ -2427,6 +2428,10 @@</span><br><span> ao2_cleanup(endpoint);</span><br><span> return NULL;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_string_field_init_extended(endpoint, overlap_context)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_cleanup(endpoint);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (!(endpoint->media.codecs = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {</span><br><span> ao2_cleanup(endpoint);</span><br><span>diff --git a/res/res_pjsip/pjsip_manager.xml b/res/res_pjsip/pjsip_manager.xml</span><br><span>index 810a5e3..475da8b 100644</span><br><span>--- a/res/res_pjsip/pjsip_manager.xml</span><br><span>+++ b/res/res_pjsip/pjsip_manager.xml</span><br><span>@@ -507,6 +507,9 @@</span><br><span> <parameter name="Allowoverlap"></span><br><span> <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='allow_overlap']/synopsis/node())"/></para></span><br><span> </parameter></span><br><span style="color: hsl(120, 100%, 40%);">+ <parameter name="OverlapContext"></span><br><span style="color: hsl(120, 100%, 40%);">+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='overlap_context']/synopsis/node())"/></para></span><br><span style="color: hsl(120, 100%, 40%);">+ </parameter></span><br><span> </syntax></span><br><span> </managerEventInstance></span><br><span> </managerEvent></span><br><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index e7ba3ed..ae2e0e4 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -3713,8 +3713,10 @@</span><br><span> </span><br><span> fetch_callerid_num(session, rdata, cid_num, sizeof(cid_num));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ /* If there's an overlap_context override specified, use that; otherwise, just use the endpoint's context */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (!strcmp(session->exten, pickupexten) ||</span><br><span style="color: hsl(0, 100%, 40%);">- ast_exists_extension(NULL, session->endpoint->context, session->exten, 1, S_OR(cid_num, NULL))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_exists_extension(NULL, S_OR(session->endpoint->overlap_context, session->endpoint->context), session->exten, 1, S_OR(cid_num, NULL))) {</span><br><span> /*</span><br><span> * Save off the INVITE Request-URI in case it is</span><br><span> * needed: CHANNEL(pjsip,request_uri)</span><br><span>@@ -3729,7 +3731,7 @@</span><br><span> */</span><br><span> if (session->endpoint->allow_overlap && (</span><br><span> !strncmp(session->exten, pickupexten, strlen(session->exten)) ||</span><br><span style="color: hsl(0, 100%, 40%);">- ast_canmatch_extension(NULL, session->endpoint->context, session->exten, 1, S_OR(cid_num, NULL)))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_canmatch_extension(NULL, S_OR(session->endpoint->overlap_context, session->endpoint->context), session->exten, 1, S_OR(cid_num, NULL)))) {</span><br><span> /* Overlap partial match */</span><br><span> return SIP_GET_DEST_EXTEN_PARTIAL;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19836">change 19836</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/+/19836"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Ibbcd4a8b11402428a187fb56b8d4e7408774a0db </div>
<div style="display:none"> Gerrit-Change-Number: 19836 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>