summaryrefslogtreecommitdiff
path: root/res/res_pjsip_exten_state.c
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-07-06 10:29:27 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-07-06 10:30:27 -0400
commit1c949eea6cbd644a9e96b447381faecc5230b85c (patch)
tree6751441fd90236a6d600eed8027555f2039b39bf /res/res_pjsip_exten_state.c
parent9e10aa84969b3b6e57dde5a637c47f17f1fd4ef7 (diff)
res_pjsip: Added "subscribe_context" to endpoint
If specified, incoming SUBSCRIBE requests will be searched for the matching extension in the indicated context. If no "subscribe_context" is specified, then the "context" setting is used. ASTERISK-25471 #close Change-Id: I3fb7a15f5bc154079bd348c08b7ad1cdd2d5e514
Diffstat (limited to 'res/res_pjsip_exten_state.c')
-rw-r--r--res/res_pjsip_exten_state.c10
1 files changed, 7 insertions, 3 deletions
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(