Filtering pjsip show channels

Hi to all,
I’m using

asterisk -rx "pjsip show channels"

to show ringing and active calls, but since I have a lot of extensions ringing at same time, I got something like this

    [[email protected] ~]# 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

so…is there a way to filter this in a way that will show only one entries for each incoming call ringing and up? many thanks

Hi @wassy83 you can use asterisk -rx 'core show channels verbose' | grep Up

1 Like

thank you but again there are too much duplicates! I just want to know how many inbound calls are ringing and how many calls are up

This might be a job for AMI Interface programming. You can get all of the same information, but it’s easier to ‘program’ with.

1 Like

Indeed. The CLI is really focused on human usage, not machine usage. They are two different approaches to displaying/filtering/showing data. AMI is for machine.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.