summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-03-22 17:08:08 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-03-22 17:08:08 -0500
commitc1ab8ca74cec45730107cca3ed47fc61460365e4 (patch)
treeed493e880d480741455c2b1fc3e9fecc8556a2e7 /res
parent3a50311c17e4de1998a01bbe939d02fd418fc13a (diff)
parent6b7697ed486fc3a8e5e7a72344437e66bd4ae507 (diff)
Merge "res_pjsip_session: Enable RFC3578 overlap dialing support."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip.c6
-rw-r--r--res/res_pjsip/pjsip_configuration.c1
-rw-r--r--res/res_pjsip_session.c24
3 files changed, 27 insertions, 4 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 962c4be4f..e4bcb7038 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -100,6 +100,9 @@
<configOption name="allow">
<synopsis>Media Codec(s) to allow</synopsis>
</configOption>
+ <configOption name="allow_overlap" default="yes">
+ <synopsis>Enable RFC3578 overlap dialing support.</synopsis>
+ </configOption>
<configOption name="aors">
<synopsis>AoR(s) to be used with the endpoint</synopsis>
<description><para>
@@ -2134,6 +2137,9 @@
<parameter name="SubscribeContext">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='subscribe_context']/synopsis/node())"/></para>
</parameter>
+ <parameter name="Allowoverlap">
+ <para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='allow_overlap']/synopsis/node())"/></para>
+ </parameter>
</syntax>
</managerEventInstance>
</managerEvent>
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index c8ff42708..02562e782 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1938,6 +1938,7 @@ int ast_res_pjsip_initialize_configuration(void)
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "preferred_codec_only", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, preferred_codec_only));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "asymmetric_rtp_codec", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, asymmetric_rtp_codec));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtcp_mux", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtcp_mux));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_overlap", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_overlap));
if (ast_sip_initialize_sorcery_transport()) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index de073d304..5f42dab9f 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1986,10 +1986,17 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
return SIP_GET_DEST_EXTEN_FOUND;
}
- /* XXX In reality, we'll likely have further options so that partial matches
- * can be indicated here, but for getting something up and running, we're going
- * to return a "not exists" error here.
+
+ /*
+ * Check for partial match via overlap dialling (if enabled)
*/
+ if (session->endpoint->allow_overlap && (
+ !strncmp(session->exten, pickupexten, strlen(session->exten)) ||
+ ast_canmatch_extension(NULL, session->endpoint->context, session->exten, 1, NULL))) {
+ /* Overlap partial match */
+ return SIP_GET_DEST_EXTEN_PARTIAL;
+ }
+
return SIP_GET_DEST_EXTEN_NOT_FOUND;
}
@@ -2106,8 +2113,17 @@ static int new_invite(void *data)
pjsip_inv_terminate(invite->session->inv_session, 416, PJ_TRUE);
}
goto end;
- case SIP_GET_DEST_EXTEN_NOT_FOUND:
case SIP_GET_DEST_EXTEN_PARTIAL:
+ ast_debug(1, "Call from '%s' (%s:%s:%d) to extension '%s' - partial match\n", ast_sorcery_object_get_id(invite->session->endpoint),
+ invite->rdata->tp_info.transport->type_name, invite->rdata->pkt_info.src_name, invite->rdata->pkt_info.src_port, invite->session->exten);
+
+ if (pjsip_inv_initial_answer(invite->session->inv_session, invite->rdata, 484, NULL, NULL, &tdata) == PJ_SUCCESS) {
+ ast_sip_session_send_response(invite->session, tdata);
+ } else {
+ pjsip_inv_terminate(invite->session->inv_session, 484, PJ_TRUE);
+ }
+ goto end;
+ case SIP_GET_DEST_EXTEN_NOT_FOUND:
default:
ast_log(LOG_NOTICE, "Call from '%s' (%s:%s:%d) to extension '%s' rejected because extension not found in context '%s'.\n",
ast_sorcery_object_get_id(invite->session->endpoint), invite->rdata->tp_info.transport->type_name, invite->rdata->pkt_info.src_name,