sip show peers

Home » Asterisk Users » sip show peers
Asterisk Users 4 Comments

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

4 thoughts on - sip show peers

  • I believe it is set by a character length for formatting the output.

    What are you trying to accomplish? Are you just viewing it in the CLI or are you writing monitoring scripts?

    Can you switch names so that they are unique in the beginning?

  • 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 %-10sn”
    #define FORMAT “%-25.25s %-15.15s %-3.3s %-3.3s %-3.3s %-8d %-10s %-10sn”

    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: %srn”,
    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).

  • If I understand correct you need to increase qualify value.

    Regards,

    Faisal Hanif