diff options
author | Joshua Colp <jcolp@digium.com> | 2016-07-12 17:14:23 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-07-12 17:14:23 -0500 |
commit | 90d4ebbb40b7ee062d015d0400f3d8e93c77e0f5 (patch) | |
tree | 0e08c0a9e77a7d5804ad29b683cfcb59135a1fce /res | |
parent | 8654727eb79830b2dce50359c71205d92b02472c (diff) | |
parent | 1c949eea6cbd644a9e96b447381faecc5230b85c (diff) |
Merge "res_pjsip: Added "subscribe_context" to endpoint"
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip.c | 12 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 1 | ||||
-rw-r--r-- | res/res_pjsip_exten_state.c | 10 |
3 files changed, 20 insertions, 3 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c index d99c1cf84..af2f93749 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -900,6 +900,15 @@ mask with a slash ('/') </para></description> </configOption> + <configOption name="subscribe_context"> + <synopsis>Context for incoming MESSAGE requests.</synopsis> + <description><para> + If specified, incoming SUBSCRIBE requests will be searched for the matching + extension in the indicated context. + If no <replaceable>subscribe_context</replaceable> is specified, + then the <replaceable>context</replaceable> setting is used. + </para></description> + </configOption> </configObject> <configObject name="auth"> <synopsis>Authentication type</synopsis> @@ -1964,6 +1973,9 @@ <parameter name="ActiveChannels"> <para>The number of active channels associated with this endpoint.</para> </parameter> + <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> </syntax> </managerEventInstance> </managerEvent> diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 8a5ff416a..a8b451767 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1859,6 +1859,7 @@ int ast_res_pjsip_initialize_configuration(void) ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_deny", "", endpoint_acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_permit", "", endpoint_acl_handler, NULL, NULL, 0, 0); ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_acl", "", endpoint_acl_handler, contact_acl_to_str, NULL, 0, 0); + ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subscribe_context", "", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct ast_sip_endpoint, subscription.context)); 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_exten_state.c b/res/res_pjsip_exten_state.c index 25b9bf1fe..9bb53bfe3 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -412,9 +412,11 @@ static void subscription_shutdown(struct ast_sip_subscription *sub) static int new_subscribe(struct ast_sip_endpoint *endpoint, const char *resource) { - if (!ast_exists_extension(NULL, endpoint->context, resource, PRIORITY_HINT, NULL)) { + const char *context = S_OR(endpoint->subscription.context, endpoint->context); + + if (!ast_exists_extension(NULL, context, resource, PRIORITY_HINT, NULL)) { ast_log(LOG_NOTICE, "Extension state subscription failed: Extension %s does not exist in context '%s' or has no associated hint\n", - resource, endpoint->context); + resource, context); return 404; } @@ -432,7 +434,9 @@ static int subscription_established(struct ast_sip_subscription *sip_sub) return -1; } - ast_copy_string(exten_state_sub->context, endpoint->context, sizeof(exten_state_sub->context)); + ast_copy_string(exten_state_sub->context, + S_OR(endpoint->subscription.context, endpoint->context), + sizeof(exten_state_sub->context)); ast_copy_string(exten_state_sub->exten, resource, sizeof(exten_state_sub->exten)); if ((exten_state_sub->id = ast_extension_state_add_destroy_extended( |