[svn-commits] dvossel: trunk r324302 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 21 10:49:28 CDT 2011


Author: dvossel
Date: Tue Jun 21 10:49:23 2011
New Revision: 324302

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324302
Log:
Fixes issue with finding correct extension when message context is used.

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=324302&r1=324301&r2=324302
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jun 21 10:49:23 2011
@@ -16116,6 +16116,15 @@
 		}
 	}
 
+	/* 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 @@
 	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);




More information about the svn-commits mailing list