aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-02 20:49:45 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-02 20:49:45 +0000
commitd6199734e23aac123cda4075ad33e575341d46fe (patch)
tree495a9f705f2c7d92e243448cde3127147bf0c2c7 /channels
parent66b5b6c9daa19f3ddcf233322a9c9d8e9d0b7d6c (diff)
Make subscribecontext behave as advertised. It will now look for the presence of a hint in the given context (be it subscribecontext or context).
(closes issue #10702) Reported by: slavon git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@88366 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5a8fb58d3..cf4ddeb43 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -8688,17 +8688,27 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
ast_string_field_set(p, context, domain_context);
}
+ /* If the request coming in is a subscription and subscribecontext has been specified use it */
+ if (req->method == SIP_SUBSCRIBE && !ast_strlen_zero(p->subscribecontext))
+ ast_string_field_set(p, context, p->subscribecontext);
+
if (sip_debug_test_pvt(p))
ast_verbose("Looking for %s in %s (domain %s)\n", uri, p->context, p->domain);
- /* Check the dialplan for the username part of the request URI,
- the domain will be stored in the SIPDOMAIN variable
- Return 0 if we have a matching extension */
- if (ast_exists_extension(NULL, p->context, uri, 1, from) ||
- !strcmp(uri, ast_pickup_ext())) {
- if (!oreq)
- ast_string_field_set(p, exten, uri);
- return 0;
+ /* If this is a subscription we actually just need to see if a hint exists for the extension */
+ if (req->method == SIP_SUBSCRIBE) {
+ char hint[AST_MAX_EXTENSION];
+ return (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten) ? 0 : -1);
+ } else {
+ /* Check the dialplan for the username part of the request URI,
+ the domain will be stored in the SIPDOMAIN variable
+ Return 0 if we have a matching extension */
+ if (ast_exists_extension(NULL, p->context, uri, 1, from) ||
+ !strcmp(uri, ast_pickup_ext())) {
+ if (!oreq)
+ ast_string_field_set(p, exten, uri);
+ return 0;
+ }
}
/* Return 1 for pickup extension or overlap dialling support (if we support it) */
@@ -14657,16 +14667,6 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
/* Get destination right away */
gotdest = get_destination(p, NULL);
- /* Initialize the context if it hasn't been already;
- note this is done _after_ handling any domain lookups,
- because the context specified there is for calls, not
- subscriptions
- */
- if (!ast_strlen_zero(p->subscribecontext))
- ast_string_field_set(p, context, p->subscribecontext);
- else if (ast_strlen_zero(p->context))
- ast_string_field_set(p, context, default_context);
-
/* Get full contact header - this needs to be used as a request URI in NOTIFY's */
parse_ok_contact(p, req);