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
This commit is contained in:
Jonathan Rose
2012-08-29 16:44:48 +00:00
parent 44d854938b
commit 504cfd1070

View File

@@ -18934,6 +18934,14 @@ static char *_sip_qualify_peer(int type, int fd, struct mansession *s, const str
struct sip_peer *peer; struct sip_peer *peer;
int load_realtime; 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) if (argc < 4)
return CLI_SHOWUSAGE; 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"); sip_unref_peer(peer, "qualify: done with peer");
} else if (type == 0) { } else if (type == 0) {
ast_cli(fd, "Peer '%s' not found\n", argv[3]); ast_cli(fd, "Peer '%s' not found\n", argv[3]);
return CLI_SUCCESS;
} else { } else {
astman_send_error(s, m, "Peer not found"); 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; return CLI_SUCCESS;
} }
@@ -18966,7 +18985,6 @@ static int manager_sip_qualify_peer(struct mansession *s, const struct message *
a[3] = peer; a[3] = peer;
_sip_qualify_peer(1, -1, s, m, 4, a); _sip_qualify_peer(1, -1, s, m, 4, a);
astman_append(s, "\r\n\r\n" );
return 0; return 0;
} }