From 504cfd10704b88fa91ce744d330882290101eb05 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Wed, 29 Aug 2012 16:44:48 +0000 Subject: 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371823 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'channels/chan_sip.c') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 9cfa64f64..5661a6e85 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -18934,6 +18934,14 @@ static char *_sip_qualify_peer(int type, int fd, struct mansession *s, const str 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 @@ static char *_sip_qualify_peer(int type, int fd, struct mansession *s, const str 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 @@ static int manager_sip_qualify_peer(struct mansession *s, const struct message * a[3] = peer; _sip_qualify_peer(1, -1, s, m, 4, a); - astman_append(s, "\r\n\r\n" ); return 0; } -- cgit v1.2.3