[svn-commits] jrose: trunk r371823 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 29 11:44:52 CDT 2012


Author: jrose
Date: Wed Aug 29 11:44:48 2012
New Revision: 371823

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371823
Log:
chan_sip: Send a manager event to confirm SIPqualifypeer completes

Prior to this patch, Issuing SIPqualifypeer either resulted in an
error or if it succeeded, a few \r\ns.  This patch adds a
SIPqualifypeerComplete event issued as a response when the command
is successfully executed.

(closes issue AST-969)
Reported by: John Bigelow


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=371823&r1=371822&r2=371823
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Aug 29 11:44:48 2012
@@ -18934,6 +18934,14 @@
 	struct sip_peer *peer;
 	int load_realtime;
 
+	const char *id = astman_get_header(m,"ActionID");
+	char idText[256] = "";
+
+	if (!ast_strlen_zero(id)) {
+		snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
+	}
+
+
 	if (argc < 4)
 		return CLI_SHOWUSAGE;
 
@@ -18943,9 +18951,20 @@
 		sip_unref_peer(peer, "qualify: done with peer");
 	} else if (type == 0) {
 		ast_cli(fd, "Peer '%s' not found\n", argv[3]);
+		return CLI_SUCCESS;
 	} else {
 		astman_send_error(s, m, "Peer not found");
-	}
+		return CLI_SUCCESS;
+	}
+
+	if (type != 0) {
+		astman_append(s,
+		"Event: SIPqualifypeerComplete\r\n"
+		"%s"
+		"\r\n",
+		idText);
+	}
+
 	return CLI_SUCCESS;
 }
 
@@ -18966,7 +18985,6 @@
 	a[3] = peer;
 
 	_sip_qualify_peer(1, -1, s, m, 4, a);
-	astman_append(s, "\r\n\r\n" );
 	return 0;
 }
 




More information about the svn-commits mailing list