summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-06-21 15:49:23 +0000
committerDavid Vossel <dvossel@digium.com>2011-06-21 15:49:23 +0000
commitb005d8dd53d1f4e3084bf1dfcfcf731d45805655 (patch)
tree2cbde6ed4b36f03b029713121dba021e39e51a80 /channels
parent92dcabe7268794253e51b7e4b018038a2286fa5b (diff)
Fixes issue with finding correct extension when message context is used.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324302 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 70f8d7dc8..41d539ecd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -16116,6 +16116,15 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req, struct a
}
}
+ /* Override the context with the message context _BEFORE_
+ * getting the destination. This way we can guarantee the correct
+ * extension is used in the message context when it is present. */
+ if (!ast_strlen_zero(p->messagecontext)) {
+ ast_string_field_set(p, context, p->messagecontext);
+ } else if (!ast_strlen_zero(sip_cfg.messagecontext)) {
+ ast_string_field_set(p, context, sip_cfg.messagecontext);
+ }
+
get_destination(p, NULL, NULL);
if (!(msg = ast_msg_alloc())) {
@@ -16132,14 +16141,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req, struct a
res = ast_msg_set_to(msg, "%s", to);
res |= ast_msg_set_from(msg, "%s", get_in_brackets(from));
res |= ast_msg_set_body(msg, "%s", ast_str_buffer(buf));
-
- if (!ast_strlen_zero(p->messagecontext)) {
- res |= ast_msg_set_context(msg, "%s", p->messagecontext);
- } else if (!ast_strlen_zero(sip_cfg.messagecontext)) {
- res |= ast_msg_set_context(msg, "%s", sip_cfg.messagecontext);
- } else {
- res |= ast_msg_set_context(msg, "%s", p->context);
- }
+ res |= ast_msg_set_context(msg, "%s", p->context);
if (!ast_strlen_zero(p->peername)) {
res |= ast_msg_set_var(msg, "SIP_PEERNAME", p->peername);