[asterisk-commits] twilson: branch russell/messaging r320882 - in /team/russell/messaging: chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 25 16:05:22 CDT 2011


Author: twilson
Date: Wed May 25 16:05:10 2011
New Revision: 320882

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=320882
Log:
Make sure we use the correct extension for MESSAGEs

Modified:
    team/russell/messaging/channels/chan_sip.c
    team/russell/messaging/include/asterisk/message.h
    team/russell/messaging/main/message.c

Modified: team/russell/messaging/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/channels/chan_sip.c?view=diff&rev=320882&r1=320881&r2=320882
==============================================================================
--- team/russell/messaging/channels/chan_sip.c (original)
+++ team/russell/messaging/channels/chan_sip.c Wed May 25 16:05:10 2011
@@ -16099,6 +16099,7 @@
 	res |= ast_msg_set_from(msg, "%s", get_in_brackets(from));
 	res |= ast_msg_set_body(msg, "%s", ast_str_buffer(buf));
 	res |= ast_msg_set_context(msg, "%s", p->context);
+	res |= ast_msg_set_exten(msg, "%s", p->exten);
 
 	if (res) {
 		ast_msg_destroy(msg);

Modified: team/russell/messaging/include/asterisk/message.h
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/include/asterisk/message.h?view=diff&rev=320882&r1=320881&r2=320882
==============================================================================
--- team/russell/messaging/include/asterisk/message.h (original)
+++ team/russell/messaging/include/asterisk/message.h Wed May 25 16:05:10 2011
@@ -150,6 +150,15 @@
 		ast_msg_set_context(struct ast_msg *msg, const char *fmt, ...);
 
 /*!
+ * \brief Set the dialplan extension for this message
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int __attribute__((format(printf, 2, 3)))
+		ast_msg_set_exten(struct ast_msg *msg, const char *fmt, ...);
+	
+/*!
  * \brief Set a variable on the message
  * \note Setting a variable that already exists overwrites the existing variable value
  *

Modified: team/russell/messaging/main/message.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/main/message.c?view=diff&rev=320882&r1=320881&r2=320882
==============================================================================
--- team/russell/messaging/main/message.c (original)
+++ team/russell/messaging/main/message.c Wed May 25 16:05:10 2011
@@ -154,6 +154,7 @@
 	struct ast_str *from;
 	struct ast_str *body;
 	struct ast_str *context;
+	struct ast_str *exten;
 	struct ao2_container *vars;
 };
 
@@ -367,6 +368,11 @@
 		return NULL;
 	}
 
+	if (!(msg->exten = ast_str_create(16))) {
+		ao2_ref(msg, -1);
+		return NULL;
+	}
+
 	if (!(msg->vars = ao2_container_alloc(1, msg_data_hash_fn, msg_data_cmp_fn))) {
 		ao2_ref(msg, -1);
 		return NULL;
@@ -427,6 +433,18 @@
 
 	va_start(ap, fmt);
 	res = ast_str_set_va(&msg->context, 0, fmt, ap);
+	va_end(ap);
+
+	return res < 0 ? -1 : 0;
+}
+
+int ast_msg_set_exten(struct ast_msg *msg, const char *fmt, ...)
+{
+	va_list ap;
+	int res;
+
+	va_start(ap, fmt);
+	res = ast_str_set_va(&msg->exten, 0, fmt, ap);
 	va_end(ap);
 
 	return res < 0 ? -1 : 0;
@@ -605,7 +623,7 @@
 {
 	struct ast_pbx_args pbx_args;
 
-	ast_explicit_goto(chan, ast_str_buffer(msg->context), ast_str_buffer(msg->to), 1);
+	ast_explicit_goto(chan, ast_str_buffer(msg->context), AS_OR(msg->exten, "s"), 1);
 
 	memset(&pbx_args, 0, sizeof(pbx_args));
 	pbx_args.no_hangup_chan = 1,




More information about the asterisk-commits mailing list