Skip to content
Snippets Groups Projects
Commit 17f0f4c3 authored by Joshua Colp's avatar Joshua Colp
Browse files

Merged revisions 88366 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r88366 | file | 2007-11-02 17:49:45 -0300 (Fri, 02 Nov 2007) | 4 lines

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: https://origsvn.digium.com/svn/asterisk/trunk@88367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent a7c6c47e
No related branches found
No related tags found
No related merge requests found
...@@ -9560,17 +9560,27 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) ...@@ -9560,17 +9560,27 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
ast_string_field_set(p, context, domain_context); 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)) if (sip_debug_test_pvt(p))
ast_verbose("Looking for %s in %s (domain %s)\n", uri, p->context, p->domain); 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, /* If this is a subscription we actually just need to see if a hint exists for the extension */
the domain will be stored in the SIPDOMAIN variable if (req->method == SIP_SUBSCRIBE) {
Return 0 if we have a matching extension */ char hint[AST_MAX_EXTENSION];
if (ast_exists_extension(NULL, p->context, uri, 1, from) || return (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten) ? 0 : -1);
!strcmp(uri, ast_pickup_ext())) { } else {
if (!oreq) /* Check the dialplan for the username part of the request URI,
ast_string_field_set(p, exten, uri); the domain will be stored in the SIPDOMAIN variable
return 0; 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) */ /* Return 1 for pickup extension or overlap dialling support (if we support it) */
...@@ -15891,16 +15901,6 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, ...@@ -15891,16 +15901,6 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
/* Get destination right away */ /* Get destination right away */
gotdest = get_destination(p, NULL); 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 */ /* Get full contact header - this needs to be used as a request URI in NOTIFY's */
parse_ok_contact(p, req); parse_ok_contact(p, req);
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment