Core Show Channels question

Hi guys,
I’m trying to monitor active channels with "core show channels"
This is my command so far:

watch “asterisk -rx ‘core show channels’ | egrep “(call|channel|SIP)””

Output:

Every 2.0s: asterisk -rx 'core show channels' | egrep "(call|channel|SIP)" Thu Feb       23 13:31:27 2017
SIP/xxxx-00001056    [email protected] Up      Dial(DAHDI/r0/xxxxxxxxxxx,300,
2 active channels
1 active call
4708 calls processed

I need to filter it some more, the only line that I want is the SIP/… line
and not the lines with Every 2.0s: asterisk… and active channels and active call and calls processed

Any ideas?
thanks

The first line is from watch so don’t use iit

while [ true ]; do clear;rasterisk -x 'core show channels verbose'|grep SIP;sleep 2;done

should work

Yes it does, thanks!
Now I’m trying to add a cut, but it does nothing…
The actual output that I need is (eventually I’ll put it in a datagrid in VB.NET):
First field would be titled “From” and will have “SIP/xxxx” (or DAHDI/xxxxxxxxxxx, depending if the call is coming in or from extension)
Second field would be titled “To” and will have “DAHDI/xxxxxxxxxxx” (or SIP/xxxx, depending if the extension is calling out or to another extension)
Something like this…

1 Like

take out the “clear”, watch what happens , read the manuals for awk, sed, grep, cut,watch and tee (all these are bash primitives)

change my suggestion to

while [ true ]; do rasterisk -x ‘core show channels verbose’|grep SIP;sleep 2;done| tee -a stuffyouneedtoinvestigate

Be resourceful ( I am a consultant, I would charge you 135 bucks an hour for that triviality with a one hour minimum , but that would be your wastage that I would happily accept :wink: )

Thanks, I will do some digging into it…