mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 16:33:34 +00:00
Remove some dead code found in _sip_show_peers()
Review: https://reviewboard.asterisk.org/r/1696/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -17397,18 +17397,21 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
|
|
||||||
if (s) { /* Manager - get ActionID */
|
if (s) { /* Manager - get ActionID */
|
||||||
id = astman_get_header(m, "ActionID");
|
id = astman_get_header(m, "ActionID");
|
||||||
if (!ast_strlen_zero(id))
|
if (!ast_strlen_zero(id)) {
|
||||||
snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
|
snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 5:
|
case 5:
|
||||||
if (!strcasecmp(argv[3], "like")) {
|
if (!strcasecmp(argv[3], "like")) {
|
||||||
if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
|
if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB)) {
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
}
|
||||||
havepattern = TRUE;
|
havepattern = TRUE;
|
||||||
} else
|
} else {
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
}
|
||||||
case 3:
|
case 3:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -17456,7 +17459,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
|
|
||||||
qsort(peerarray, total_peers, sizeof(struct sip_peer *), peercomparefunc);
|
qsort(peerarray, total_peers, sizeof(struct sip_peer *), peercomparefunc);
|
||||||
|
|
||||||
for(k=0; k < total_peers; k++) {
|
for(k = 0; k < total_peers; k++) {
|
||||||
char status[20] = "";
|
char status[20] = "";
|
||||||
char srch[2000];
|
char srch[2000];
|
||||||
char pstatus;
|
char pstatus;
|
||||||
@@ -17484,17 +17487,18 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(peer->username) && !s)
|
if (!ast_strlen_zero(peer->username) && !s) {
|
||||||
snprintf(name, sizeof(name), "%s/%s", peer->name, peer->username);
|
snprintf(name, sizeof(name), "%s/%s", peer->name, peer->username);
|
||||||
else
|
} else {
|
||||||
ast_copy_string(name, peer->name, sizeof(name));
|
ast_copy_string(name, peer->name, sizeof(name));
|
||||||
|
}
|
||||||
|
|
||||||
pstatus = peer_status(peer, status, sizeof(status));
|
pstatus = peer_status(peer, status, sizeof(status));
|
||||||
if (pstatus == 1)
|
if (pstatus == 1) {
|
||||||
peers_mon_online++;
|
peers_mon_online++;
|
||||||
else if (pstatus == 0)
|
} else if (pstatus == 0) {
|
||||||
peers_mon_offline++;
|
peers_mon_offline++;
|
||||||
else {
|
} else {
|
||||||
if (ast_sockaddr_isnull(&peer->addr) ||
|
if (ast_sockaddr_isnull(&peer->addr) ||
|
||||||
!ast_sockaddr_port(&peer->addr)) {
|
!ast_sockaddr_port(&peer->addr)) {
|
||||||
peers_unmon_offline++;
|
peers_unmon_offline++;
|
||||||
@@ -17503,18 +17507,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(srch, sizeof(srch), FORMAT2, name,
|
if (!s) { /* Normal CLI list */
|
||||||
tmp_host,
|
|
||||||
peer->host_dynamic ? " D " : " ", /* Dynamic or not? */
|
|
||||||
ast_test_flag(&peer->flags[2], SIP_PAGE3_NAT_AUTO_RPORT) ?
|
|
||||||
ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " A " : " a " :
|
|
||||||
ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " N " : " ", /* NAT=yes? */
|
|
||||||
peer->ha ? " A " : " ", /* permit/deny */
|
|
||||||
tmp_port, status,
|
|
||||||
peer->description ? peer->description : "",
|
|
||||||
realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
|
|
||||||
|
|
||||||
if (!s) {/* Normal CLI list */
|
|
||||||
ast_cli(fd, FORMAT2, name,
|
ast_cli(fd, FORMAT2, name,
|
||||||
tmp_host,
|
tmp_host,
|
||||||
peer->host_dynamic ? " D " : " ", /* Dynamic or not? */
|
peer->host_dynamic ? " D " : " ", /* Dynamic or not? */
|
||||||
@@ -17524,7 +17517,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
peer->ha ? " A " : " ", /* permit/deny */
|
peer->ha ? " A " : " ", /* permit/deny */
|
||||||
tmp_port, status,
|
tmp_port, status,
|
||||||
peer->description ? peer->description : "",
|
peer->description ? peer->description : "",
|
||||||
realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
|
realtimepeers ? (peer->is_realtime ? "Cached RT" : "") : "");
|
||||||
} else { /* Manager format */
|
} else { /* Manager format */
|
||||||
/* The names here need to be the same as other channels */
|
/* The names here need to be the same as other channels */
|
||||||
astman_append(s,
|
astman_append(s,
|
||||||
@@ -17558,22 +17551,25 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
|
|||||||
ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT) ? "yes" : "no", /* TEXTSUPPORT=yes? */
|
ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT) ? "yes" : "no", /* TEXTSUPPORT=yes? */
|
||||||
peer->ha ? "yes" : "no", /* permit/deny */
|
peer->ha ? "yes" : "no", /* permit/deny */
|
||||||
status,
|
status,
|
||||||
realtimepeers ? (peer->is_realtime ? "yes":"no") : "no",
|
realtimepeers ? (peer->is_realtime ? "yes" : "no") : "no",
|
||||||
peer->description);
|
peer->description);
|
||||||
}
|
}
|
||||||
ao2_unlock(peer);
|
ao2_unlock(peer);
|
||||||
peer = peerarray[k] = sip_unref_peer(peer, "toss iterator peer ptr");
|
peer = peerarray[k] = sip_unref_peer(peer, "toss iterator peer ptr");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s)
|
if (!s) {
|
||||||
ast_cli(fd, "%d sip peers [Monitored: %d online, %d offline Unmonitored: %d online, %d offline]\n",
|
ast_cli(fd, "%d sip peers [Monitored: %d online, %d offline Unmonitored: %d online, %d offline]\n",
|
||||||
total_peers, peers_mon_online, peers_mon_offline, peers_unmon_online, peers_unmon_offline);
|
total_peers, peers_mon_online, peers_mon_offline, peers_unmon_online, peers_unmon_offline);
|
||||||
|
}
|
||||||
|
|
||||||
if (havepattern)
|
if (havepattern) {
|
||||||
regfree(®exbuf);
|
regfree(®exbuf);
|
||||||
|
}
|
||||||
|
|
||||||
if (total)
|
if (total) {
|
||||||
*total = total_peers;
|
*total = total_peers;
|
||||||
|
}
|
||||||
|
|
||||||
ast_free(peerarray);
|
ast_free(peerarray);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user