summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2012-08-29 16:44:48 +0000
committerJonathan Rose <jrose@digium.com>2012-08-29 16:44:48 +0000
commit504cfd10704b88fa91ce744d330882290101eb05 (patch)
tree5326c8149b97a25d896592b363057347e5018bb9 /channels/chan_sip.c
parent44d854938b68311fca83fa95cb65c0ac826a2c7a (diff)
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
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c20
1 files changed, 19 insertions, 1 deletions
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;
}