我正在使用
asterisk -rx "pjsip show channels"
显示振铃和活动呼叫,但是由于我同时有很多分机振铃,所以我得到了类似的东西
[root@freepbx ~]# asterisk -rx "pjsip show channels"
Channel: <ChannelId........................................> <State.....> <Time.....>
Exten: <DialedExten.............> CLCID: <ConnectedLineCID.......>
==========================================================================================
Channel: PJSIP/214-0001190d/AppDial Ringing 00:00:19
Exten: 214 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/215-0001190e/AppDial Ringing 00:00:19
Exten: 215 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/221-00011909/AppDial Ringing 00:00:19
Exten: 221 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/222-00011910/AppDial Ringing 00:00:19
Exten: 222 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/223-0001190b/AppDial Ringing 00:00:19
Exten: 223 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/225-00011912/AppDial Ringing 00:00:19
Exten: 225 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/226-00011914/AppDial Ringing 00:00:19
Exten: 226 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/227-0001190a/AppDial Ringing 00:00:19
Exten: 227 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/228-00011915/AppDial Ringing 00:00:19
Exten: 228 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/230-00011913/AppDial Ringing 00:00:19
Exten: 230 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/231-000118d7/AppDial Up 00:01:41
Exten: s CLCID: "0566437XX" <0566437XX>
Channel: PJSIP/232-0001190f/AppDial Ringing 00:00:19
Exten: 232 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/234-00011911/AppDial Ringing 00:00:19
Exten: 234 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/235-00011908/AppDial Ringing 00:00:19
Exten: 235 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/236-00011907/AppDial Ringing 00:00:19
Exten: 236 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/237-000118ed/AppDial Up 00:01:01
Exten: s CLCID: "0415346979" <0415346979>
Channel: PJSIP/238-0001190c/AppDial Ringing 00:00:19
Exten: 238 CLCID: "+336506736XX" <+336506736XX>
Channel: PJSIP/272-00011919/AppDial Ringing 00:00:09
Exten: 2030 CLCID: "Venezia:33339180XX" <33339180XX>
Channel: PJSIP/276-0001191a/AppDial Ringing 00:00:09
Exten: 2030 CLCID: "Venezia:33339180XX" <33339180XX>
Channel: PJSIP/ANCONA_UFFICIO-0001184b/Queue Up 00:05:21
Exten: 2000 CLCID: "" <>
Channel: PJSIP/ANCONA_UFFICIO-0001189c/Queue Up 00:03:20
Exten: 2000 CLCID: "" <>
Channel: PJSIP/ANCONA_UFFICIO-000118e9/Queue Up 00:01:14
Exten: 2000 CLCID: "" <>
Channel: PJSIP/VENEZIA_PASSEGGERI-000118e6/Queue Up 00:01:20
Exten: 2000 CLCID: "" <>
Channel: PJSIP/VENEZIA_PASSEGGERI-00011918/Dial Ring 00:00:09
Exten: s CLCID: "" <>
Objects found: 24
所以...有没有一种方法可以过滤此方法,使其在每次振铃和振铃时仅显示一个条目?我尝试过
asterisk -rx "pjsip show channels" | grep -o '"[^"]\+"' | sort -t: -u -k1,1
这将显示预期的输出,但是在显示是否上升或正在振铃之前,我会松开这行,所以我尝试使用
asterisk -rx "pjsip show channels" | grep -B 1 -o '"[^"]\+"' | sort -t: -u -k1,1
但是结果是错误的非常感谢
您使用的是可读版本。只需使用机器可读的
asterisk -rx "pjsip show channels concise"
[请注意,一般来说,问询渠道不稳定。使用其他方式,例如CEL或AMI事件