diff --git a/README b/README index 2aab816..4745a00 100644 --- a/README +++ b/README @@ -66,6 +66,7 @@ This chan_capi version includes: - ISDN hold. - CAPI Line Interconnect. - Eicon DIVA Server VoIP/RTP +- CLI command "capi show channels" shows details on channel status. Permissions =========== @@ -275,6 +276,28 @@ FAXFORMAT : 0 = SFF FAXPAGES : Number of pages received FAXID : The ID of the remote fax maschine + +CLI command "capi show channels" +================================ +This CLI command shows detailed info on all CAPI channels. +Column description: + Line-Name : the name of the interface as defined in capi.conf + NTmode : is the line in NT mode instead fo TE mode + state : the state of the channel, like 'Conn', 'Disc', 'Dial', ... + i/o : incoming or outgoing line + bproto : protocol on CAPI ('fax', 'voice' or 'rtp') + isdnstate : a string which may consists of the following characters + * = PBX is active + G = Line-Interconnect (CAPI bridge) active + B = b-channel is up + b = b-channel is requested + P = Progress was signaled + H = this line is on hold + T = this line is in transfer (ECT) mode + S = SETUP[_ACK] was signaled + ton : type of number value + number : the caller-number and destination-number + Asterisk variables used/set by chan_capi ======================================== diff --git a/chan_capi.c b/chan_capi.c index 5f53d7a..5e09f4d 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -4609,6 +4609,29 @@ static char *show_state(int state) } return "-----"; } +static char *show_isdnstate(unsigned int isdnstate, char *str) +{ + str[0] = '\0'; + + if (isdnstate & CAPI_ISDN_STATE_PBX) + strcat(str, "*"); + if (isdnstate & CAPI_ISDN_STATE_LI) + strcat(str, "G"); + if (isdnstate & CAPI_ISDN_STATE_B3_UP) + strcat(str, "B"); + if (isdnstate & CAPI_ISDN_STATE_B3_PEND) + strcat(str, "b"); + if (isdnstate & CAPI_ISDN_STATE_PROGRESS) + strcat(str, "P"); + if (isdnstate & CAPI_ISDN_STATE_HOLD) + strcat(str, "H"); + if (isdnstate & CAPI_ISDN_STATE_ECT) + strcat(str, "T"); + if (isdnstate & (CAPI_ISDN_STATE_SETUP | CAPI_ISDN_STATE_SETUP_ACK)) + strcat(str, "S"); + + return str; +} /* * do command capi show channels @@ -4616,12 +4639,14 @@ static char *show_state(int state) static int capi_show_channels(int fd, int argc, char *argv[]) { struct capi_pvt *i; + char iochar; + char i_state[80]; if (argc != 3) return RESULT_SHOWUSAGE; ast_cli(fd, "CAPI B-channel information:\n"); - ast_cli(fd, "Line-Name NTmode state bproto isdnstate ton number\n"); + ast_cli(fd, "Line-Name NTmode state i/o bproto isdnstate ton number\n"); ast_cli(fd, "----------------------------------------------------------------\n"); cc_mutex_lock(&iflock); @@ -4630,13 +4655,21 @@ static int capi_show_channels(int fd, int argc, char *argv[]) if (i->channeltype != CAPI_CHANNELTYPE_B) continue; + if ((i->state == 0) || (i->state == CAPI_STATE_DISCONNECTED)) + iochar = '-'; + else if (i->outgoing) + iochar = 'O'; + else + iochar = 'I'; + ast_cli(fd, - "%-16s %s %s %s 0x%08x (0x%02x) '%s'->'%s'\n", + "%-16s %s %s %c %s %-10s 0x%02x '%s'->'%s'\n", i->name, i->ntmode ? "yes":"no ", show_state(i->state), + iochar, show_bproto(i->bproto), - i->isdnstate, + show_isdnstate(i->isdnstate, i_state), i->cid_ton, i->cid, i->dnid