Summary:ASTERISK-04619: [patch] alignment/truncation of 'show channels' output and new fields callerid, bridge, duration
Reporter:Frank Sautter (xylome)Labels:
Date Opened:2005-07-19 09:40:33Date Closed:2008-01-15 15:44:04.000-0600
Versions:Frequency of
Environment:Attachments:( 0) showchannels-20050719.rev92.txt
( 1) showchannels-20050720.rev92.txt
Description:little patch, that resolves alignment issues and problems with untruncated output of the cli command 'show channels'.
i will also introduce the display of the associated callerid, the channel which this call is bridged to and the call duration of each channel.


sample output:
Channel          (Context      Extension       Pri) State   Application   Data                 CallerID        Bridged to      Duration
Zap/32-1         (pri-ericsson s                 1) Ringing AppDial       (Outgoing Line)      355             (None)                 -
Zap/1-1          (pri-external 355               1) Ringing Dial          ZAP/g2/355           0251702961772   (None)          00:00:06
Zap/4-1          (pri-external s                 1) Up      Bridged Call  Zap/37-1             02013792217     Zap/37-1               -
Zap/37-1         (pri-ericsson 02013792217       4) Up      Dial          ZAP/g1/02013792217   20              Zap/4-1         00:08:06
4 active channels
2 active calls
Comments:By: Clod Patry (junky) 2005-07-19 11:54:47

I disagree with this patch:
we already have show channels concise for that, no?

By: Frank Sautter (xylome) 2005-07-19 14:17:02

view concise has some of the fields i introduce in this patch, but:
* some of the fields are missing
* the output is hardly human readable
* i made this patch also to align the output correct and truncate each field if the fields are to long

i regulary use show channels to get an overview of how many calls are currently established if i want to take asterisk down our productive server for maintenance (mostly when replacing with a newly built asterisk binary) and therefore a nicely formatted output is easier and faster to read.

so what speaks against changing this?!?

By: Kevin P. Fleming (kpfleming) 2005-07-19 19:36:27

Most (if not all) CLI commands strive to keep their output within 80 columns, but this patch would make the 'show channels' output much wider than that. I don't know if there is an official policy on this, but I've had to revert patches before that changed things to be too wide.

If you can add it as another 'show channels' subcommand, rather than changing the default one, then it would be safe to add even if it is too wide. Alternatively, the subcommand could use two lines per channel to keep the width down.

By: Clod Patry (junky) 2005-07-19 22:57:05

About your 3 points:
1)True, but is it really crucial in these circomptences?
I mean, the bridged peer really important, if you have 30 actives channels, you won't restart now, right? Same for apply.

2) You could easily make a script which parse the show channels concise's output and display the way you want.

3) good job for that.

For restarting, you good easily do: restart when convenient.
FOr duration, why not just adding the duration at the end of show channels concise ?

By: Frank Sautter (xylome) 2005-07-20 06:47:34

ok, i realised kevin's proposal.

* output of 'show channels' is now 80 columns wide (had to truncate some fields a litte more and removed the unnecessary brackets) and proper aligned
* output of 'show channels concise' has to more fields at the end (duration and bridged channel)
* new command 'show channels verbose'. wider fields (less truncation) and more fields (callerid, duration, acountcode, bridged channel)
* other arguments than concise or verbose are sent to show_usage

By: Mark Spencer (markster) 2005-08-07 21:41:46

Added to CVS with some changes

By: Digium Subversion (svnbot) 2008-01-15 15:44:04.000-0600

Repository: asterisk
Revision: 6307

U   trunk/cli.c

r6307 | markster | 2008-01-15 15:44:04 -0600 (Tue, 15 Jan 2008) | 2 lines

Better alignment/truncation of show channels output (bug ASTERISK-4619 with extensive mods)