Merge "res_pjsip_session: Enable RFC3578 overlap dialing support."

pull/7/head
Joshua Colp 8 years ago committed by Gerrit Code Review
commit c1ab8ca74c

@ -141,6 +141,10 @@ res_pjsip
added to both transport and subscription_persistence, an alembic upgrade added to both transport and subscription_persistence, an alembic upgrade
should be run to bring the database tables up to date. should be run to bring the database tables up to date.
* A new option, allow_overlap, has been added to endpoints which allows
overlap dialing functionality to be enabled or disabled. The option defaults
to enabled.
res_pjsip_transport_websocket res_pjsip_transport_websocket
------------------ ------------------
* Removed non-secure websocket support. Firefox and Chrome have not allowed * Removed non-secure websocket support. Firefox and Chrome have not allowed

@ -595,6 +595,7 @@
; "yes") ; "yes")
;aggregate_mwi=yes ; (default: "yes") ;aggregate_mwi=yes ; (default: "yes")
;allow= ; Media Codec s to allow (default: "") ;allow= ; Media Codec s to allow (default: "")
;allow_overlap=yes ; Enable RFC3578 overlap dialing support. (default: "yes")
;aors= ; AoR s to be used with the endpoint (default: "") ;aors= ; AoR s to be used with the endpoint (default: "")
;auth= ; Authentication Object s associated with the endpoint (default: "") ;auth= ; Authentication Object s associated with the endpoint (default: "")
;callerid= ; CallerID information for the endpoint (default: "") ;callerid= ; CallerID information for the endpoint (default: "")

@ -0,0 +1,31 @@
"""add pjsip allow_overlap
Revision ID: 8fce4c573e15
Revises: f638dbe2eb23
Create Date: 2017-03-21 15:14:27.612945
"""
# revision identifiers, used by Alembic.
revision = '8fce4c573e15'
down_revision = 'f638dbe2eb23'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
YESNO_NAME = 'yesno_values'
YESNO_VALUES = ['yes', 'no']
def upgrade():
############################# Enums ##############################
# yesno_values have already been created, so use postgres enum object
# type to get around "already created" issue - works okay with mysql
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
op.add_column('ps_endpoints', sa.Column('allow_overlap', yesno_values))
def downgrade():
op.drop_column('ps_endpoints', 'allow_overlap')

@ -765,6 +765,8 @@ struct ast_sip_endpoint {
unsigned int preferred_codec_only; unsigned int preferred_codec_only;
/*! Do we allow an asymmetric RTP codec? */ /*! Do we allow an asymmetric RTP codec? */
unsigned int asymmetric_rtp_codec; unsigned int asymmetric_rtp_codec;
/*! Do we allow overlap dialling? */
unsigned int allow_overlap;
}; };
/*! URI parameter for symmetric transport */ /*! URI parameter for symmetric transport */

@ -100,6 +100,9 @@
<configOption name="allow"> <configOption name="allow">
<synopsis>Media Codec(s) to allow</synopsis> <synopsis>Media Codec(s) to allow</synopsis>
</configOption> </configOption>
<configOption name="allow_overlap" default="yes">
<synopsis>Enable RFC3578 overlap dialing support.</synopsis>
</configOption>
<configOption name="aors"> <configOption name="aors">
<synopsis>AoR(s) to be used with the endpoint</synopsis> <synopsis>AoR(s) to be used with the endpoint</synopsis>
<description><para> <description><para>
@ -2134,6 +2137,9 @@
<parameter name="SubscribeContext"> <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> <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>
<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> </syntax>
</managerEventInstance> </managerEventInstance>
</managerEvent> </managerEvent>

@ -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", "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", "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", "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()) { if (ast_sip_initialize_sorcery_transport()) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n"); ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");

@ -1986,10 +1986,17 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
return SIP_GET_DEST_EXTEN_FOUND; 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; 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); pjsip_inv_terminate(invite->session->inv_session, 416, PJ_TRUE);
} }
goto end; goto end;
case SIP_GET_DEST_EXTEN_NOT_FOUND:
case SIP_GET_DEST_EXTEN_PARTIAL: 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: default:
ast_log(LOG_NOTICE, "Call from '%s' (%s:%s:%d) to extension '%s' rejected because extension not found in context '%s'.\n", 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, ast_sorcery_object_get_id(invite->session->endpoint), invite->rdata->tp_info.transport->type_name, invite->rdata->pkt_info.src_name,

Loading…
Cancel
Save