diff options
-rw-r--r-- | CHANGES | 12 | ||||
-rw-r--r-- | channels/pjsip/dialplan_functions.c | 5 | ||||
-rw-r--r-- | contrib/ast-db-manage/config/versions/154177371065_add_default_from_user.py | 22 | ||||
-rw-r--r-- | include/asterisk/res_pjsip.h | 11 | ||||
-rw-r--r-- | res/res_pjsip.c | 8 | ||||
-rw-r--r-- | res/res_pjsip/config_global.c | 21 | ||||
-rw-r--r-- | res/res_pjsip_transport_websocket.c | 2 | ||||
-rw-r--r-- | res/res_rtp_asterisk.c | 3 |
8 files changed, 79 insertions, 5 deletions
@@ -177,6 +177,18 @@ cdr_adaptive_odbc names. This setting is configurable for cdr_adaptive_odbc via the quoted_identifiers in configuration file cdr_adaptive_odbc.conf. + +------------------------------------------------------------------------------ +--- Functionality changes from Asterisk 13.5.0 to Asterisk 13.6.0 ------------ +------------------------------------------------------------------------------ + +Dialplan Functions +------------------ + * The CHANNEL function, when used on a PJSIP channel, now exposes a 'call-id' + extraction option when using with the 'pjsip' signalling option. It will + return the SIP Call-ID associated with the INVITE request that established + the PJSIP channel. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 13.4.0 to Asterisk 13.5.0 ------------ ------------------------------------------------------------------------------ diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c index 24daac8dc..b86cfad53 100644 --- a/channels/pjsip/dialplan_functions.c +++ b/channels/pjsip/dialplan_functions.c @@ -318,6 +318,9 @@ <literal>type</literal> parameter must be provided. It specifies which signalling parameter to read.</para> <enumlist> + <enum name="call-id"> + <para>The SIP call-id.</para> + </enum> <enum name="secure"> <para>Whether or not the signalling uses a secure transport.</para> <enumlist> @@ -594,6 +597,8 @@ static int channel_read_pjsip(struct ast_channel *chan, const char *type, const if (ast_strlen_zero(type)) { ast_log(LOG_WARNING, "You must supply a type field for 'pjsip' information\n"); return -1; + } else if (!strcmp(type, "call-id")) { + snprintf(buf, buflen, "%.*s", (int) pj_strlen(&dlg->call_id->id), pj_strbuf(&dlg->call_id->id)); } else if (!strcmp(type, "secure")) { #ifdef HAVE_PJSIP_GET_DEST_INFO pjsip_host_info dest; diff --git a/contrib/ast-db-manage/config/versions/154177371065_add_default_from_user.py b/contrib/ast-db-manage/config/versions/154177371065_add_default_from_user.py new file mode 100644 index 000000000..7e6cf994f --- /dev/null +++ b/contrib/ast-db-manage/config/versions/154177371065_add_default_from_user.py @@ -0,0 +1,22 @@ +"""add default_from_user + +Revision ID: 154177371065 +Revises: 26f10cadc157 +Create Date: 2015-09-04 14:13:59.195013 + +""" + +# revision identifiers, used by Alembic. +revision = '154177371065' +down_revision = '26f10cadc157' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.add_column('ps_globals', sa.Column('default_from_user', sa.String(80))) + + +def downgrade(): + op.drop_column('ps_globals', 'default_from_user') diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index 508a7be38..b7b875d0f 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -2018,6 +2018,17 @@ char *ast_sip_get_debug(void); */ char *ast_sip_get_endpoint_identifier_order(void); +/*! + * \brief Retrieve the global default from user. + * + * This is the value placed in outbound requests' From header if there + * is no better option (such as an endpoint-configured from_user or + * caller ID number). + * + * \retval The global default_from_user value. + */ +const char *ast_sip_get_default_from_user(void); + /*! \brief Determines whether the res_pjsip module is loaded */ #define CHECK_PJSIP_MODULE_LOADED() \ do { \ diff --git a/res/res_pjsip.c b/res/res_pjsip.c index b8463cecd..4af886b4b 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -1286,6 +1286,11 @@ Identifier names are usually derived from and can be found in the endpoint identifier module itself (res_pjsip_endpoint_identifier_*)</synopsis> </configOption> + <configOption name="default_from_user" default="asterisk"> + <synopsis>When Asterisk generates an outgoing SIP request, the From header username will be + set to this value if there is no better option (such as CallerID) to be + used.</synopsis> + </configOption> </configObject> </configFile> </configInfo> @@ -2333,10 +2338,9 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u pjsip_sip_uri *sip_uri; pjsip_transport_type_e type = PJSIP_TRANSPORT_UNSPECIFIED; int local_port; - char uuid_str[AST_UUID_STR_LEN]; if (ast_strlen_zero(user)) { - user = ast_uuid_generate_str(uuid_str, sizeof(uuid_str)); + user = ast_sip_get_default_from_user(); } /* Parse the provided target URI so we can determine what transport it will end up using */ diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c index 42ba23487..b348896c8 100644 --- a/res/res_pjsip/config_global.c +++ b/res/res_pjsip/config_global.c @@ -34,6 +34,7 @@ #define DEFAULT_DEBUG "no" #define DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous" #define DEFAULT_MAX_INITIAL_QUALIFY_TIME 0 +#define DEFAULT_FROM_USER "asterisk" static char default_useragent[256]; @@ -46,6 +47,8 @@ struct global_config { AST_STRING_FIELD(debug); /*! Order by which endpoint identifiers are checked (comma separated list) */ AST_STRING_FIELD(endpoint_identifier_order); + /*! User name to place in From header if there is no better option */ + AST_STRING_FIELD(default_from_user); ); /* Value to put in Max-Forwards header */ unsigned int max_forwards; @@ -179,6 +182,22 @@ unsigned int ast_sip_get_max_initial_qualify_time(void) return time; } +const char *ast_sip_get_default_from_user(void) +{ + const char *from_user; + struct global_config *cfg; + + cfg = get_global_cfg(); + if (!cfg) { + return DEFAULT_FROM_USER; + } + + from_user = cfg->default_from_user; + ao2_ref(cfg, -1); + + return from_user; +} + /*! * \internal * \brief Observer to set default global object if none exist. @@ -292,6 +311,8 @@ int ast_sip_initialize_sorcery_global(void) ast_sorcery_object_field_register(sorcery, "global", "max_initial_qualify_time", __stringify(DEFAULT_MAX_INITIAL_QUALIFY_TIME), OPT_UINT_T, 0, FLDSET(struct global_config, max_initial_qualify_time)); + ast_sorcery_object_field_register(sorcery, "global", "default_from_user", DEFAULT_FROM_USER, + OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_from_user)); if (ast_sorcery_instance_observer_add(sorcery, &observer_callbacks_global)) { return -1; diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c index e48b630e7..3157a940f 100644 --- a/res/res_pjsip_transport_websocket.c +++ b/res/res_pjsip_transport_websocket.c @@ -419,7 +419,7 @@ static int load_module(void) CHECK_PJSIP_MODULE_LOADED(); pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE, "WS", 5060, &transport_type_ws); - pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE, "WSS", 5060, &transport_type_wss); + pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE | PJSIP_TRANSPORT_SECURE, "WSS", 5060, &transport_type_wss); if (ast_sip_register_service(&websocket_module) != PJ_SUCCESS) { return AST_MODULE_LOAD_DECLINE; diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 545e21634..09a0fef97 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -706,8 +706,7 @@ static void ast_rtp_ice_start(struct ast_rtp_instance *instance) ao2_iterator_destroy(&i); if (has_rtp && has_rtcp && - pj_ice_sess_create_check_list(rtp->ice, &ufrag, &passwd, ao2_container_count( - rtp->ice_active_remote_candidates), &candidates[0]) == PJ_SUCCESS) { + pj_ice_sess_create_check_list(rtp->ice, &ufrag, &passwd, cand_cnt, &candidates[0]) == PJ_SUCCESS) { ast_test_suite_event_notify("ICECHECKLISTCREATE", "Result: SUCCESS"); pj_ice_sess_start_check(rtp->ice); pj_timer_heap_poll(timer_heap, NULL); |