[asterisk-users] sip show peers

Danny Nicholas danny at debsinc.com
Tue Nov 22 09:21:35 CST 2011


Re-compile channels/chan_sip.c because this is what is limiting you
/*! \brief  _sip_show_peers: Execute sip show peers command */
static int _sip_show_peers(int fd, int *total, struct mansession *s, const
struct message *m, int argc, const char *argv[])
{
        regex_t regexbuf;
        int havepattern = FALSE;

#define FORMAT2 "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8s %-10s %-10s\n"
#define FORMAT  "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8d %-10s %-10s\n"

        char name[256];
        int total_peers = 0;
        int peers_mon_online = 0;
        int peers_mon_offline = 0;
        int peers_unmon_offline = 0;
        int peers_unmon_online = 0;
        const char *id;
        char idtext[256] = "";
        int realtimepeers;

        realtimepeers = ast_check_realtime("sippeers");

        if (s) {        /* Manager - get ActionID */
                id = astman_get_header(m,"ActionID");
                if (!ast_strlen_zero(id))
                        snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n",
id);
        }

        switch (argc) {
        case 5:
                if (!strcasecmp(argv[3], "like")) {
                        if (regcomp(&regexbuf, argv[4], REG_EXTENDED |
REG_NOSUB))
                                return RESULT_SHOWUSAGE;
                        havepattern = TRUE;
                } else
                        return RESULT_SHOWUSAGE;
        case 3:
                break;
        default:
                return RESULT_SHOWUSAGE;
        }

        if (!s) /* Normal list */
                ast_cli(fd, FORMAT2, "Name/username", "Host", "Dyn", "Nat",
"ACL", "Port", "Status", (realtimepeers ? "Realtime" : ""));
the 25.25s definition of FORMAT and FORMAT2 means you get 25 characters to
display.   You should be able to change the 25.25 to something like 50.50 (I
tried 45.45 and it worked for me). 

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Jerry Geis
Sent: Tuesday, November 22, 2011 9:01 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] sip show peers

  Is there a way with the command (1.4.42) for sip show peers to see the
FULL "Name/Username" field???

I have long names and mine are being truncated.

Thanks

Jerry

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to
Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list