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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 13 12:36:10 CST 2010


Author: russell
Date: Mon Dec 13 12:36:06 2010
New Revision: 298283

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298283
Log:
Check if we can match a peer on an unauthed MESSAGE and use its context if so.

Modified:
    team/russell/messaging/channels/chan_sip.c
    team/russell/messaging/doc/asterisk-messaging.txt

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=298283&r1=298282&r2=298283
==============================================================================
--- team/russell/messaging/channels/chan_sip.c (original)
+++ team/russell/messaging/channels/chan_sip.c Mon Dec 13 12:36:06 2010
@@ -15484,6 +15484,23 @@
 			return;
 		}
 		/* Auth was successful.  Proceed. */
+	} else {
+		struct sip_peer *peer;
+
+		/*
+		 * MESSAGE outside of a call, not authenticating it.
+		 * Check to see if we match a peer anyway so that we can direct
+		 * it to the right context.
+		 */
+
+		peer = find_peer(NULL, &p->recv, TRUE, FINDPEERS, 0, p->socket.type);
+		if (peer) {
+			/* Only if no auth is required. */
+			if (ast_strlen_zero(peer->secret) && ast_strlen_zero(peer->md5secret)) {
+				ast_string_field_set(p, context, peer->context);
+			}
+			peer = unref_peer(peer, "from find_peer() in receive_message");
+		}
 	}
 
 	if (!(msg = ast_msg_alloc())) {

Modified: team/russell/messaging/doc/asterisk-messaging.txt
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/doc/asterisk-messaging.txt?view=diff&rev=298283&r1=298282&r2=298283
==============================================================================
--- team/russell/messaging/doc/asterisk-messaging.txt (original)
+++ team/russell/messaging/doc/asterisk-messaging.txt Mon Dec 13 12:36:06 2010
@@ -135,6 +135,7 @@
         ; Assuming only messages hit this exten
         exten => _.,1,GotoIf($["${CUT(MESSAGE(body), ,1)}" = "originate"]?originate:invalid)
         exten => _.,n(originate),Originate(${CUT(MESSAGE(body), ,2)})
+        exten => _.,n(invalid),Hangup()
 
 
 Example 4:




More information about the asterisk-commits mailing list