How Many DAHDI Channels In Use?

Hi… this would seem like something basic, but I’m having a hard time figuring out how to reliably determine how many DAHDI channels are in use concurrently at any given time.

We have a T1 line.

We’re using FreePBX as the front end, and on the status page it shows “Total active calls”, “Internal calls”, “External calls”, and “Total active channels”, but I don’t think any of these indicate how many DAHDI channels are in use.

On the back end, I’ve been playing around with “core show channels” and “dahdi show channels”, but I’m not confident how to interpret the output properly.

Anyone know? Thanks!

lsdahdi from linux shell will show you something like this:

1 PRI        CAS         (In use) (SWEC: MG2) (EC: MG2)  
  2 PRI        CAS         (In use) (SWEC: MG2)  
  3 PRI        CAS         (In use) (SWEC: MG2)  
  4 PRI        CAS         (In use) (SWEC: MG2) (EC: MG2)  
  5 PRI        CAS         (In use) (SWEC: MG2)  
  6 PRI        CAS         (In use) (SWEC: MG2)  
  7 PRI        CAS         (In use) (SWEC: MG2)  
  8 PRI        CAS         (In use) (SWEC: MG2)  
  9 PRI        CAS         (In use) (SWEC: MG2)  
 10 PRI        CAS         (In use) (SWEC: MG2)  
 11 PRI        CAS         (In use) (SWEC: MG2) (EC: MG2)  
 12 PRI        CAS         (In use) (SWEC: MG2)  
 13 PRI        CAS         (In use) (SWEC: MG2) (EC: MG2)  
 14 PRI        CAS         (In use) (SWEC: MG2)  
 15 PRI        CAS         (In use) (SWEC: MG2)  
 16 PRI                     
 17 PRI        CAS         (In use) (SWEC: MG2)  
 18 PRI        CAS         (In use) (SWEC: MG2)  
 19 PRI        CAS         (In use) (SWEC: MG2)  
 20 PRI        CAS         (In use) (SWEC: MG2)  
 21 PRI        CAS         (In use) (SWEC: MG2)  
 22 PRI        CAS         (In use) (SWEC: MG2)  
 23 PRI        CAS         (In use) (SWEC: MG2)  
 24 PRI        CAS         (In use) (SWEC: MG2)  
 25 PRI        CAS         (In use) (SWEC: MG2)  
 26 PRI        CAS         (In use) (SWEC: MG2)  
 27 PRI        CAS         (In use) (SWEC: MG2)  
 28 PRI        CAS         (In use) (SWEC: MG2)  
 29 PRI        CAS         (In use) (SWEC: MG2)  
 30 PRI        CAS         (In use) (SWEC: MG2)  
 31 PRI        CAS         (In use) (SWEC: MG2)  

The last column (EC: MG2) show an active channel. Maybe you can use that.

“dahdi show channels” will show you all the DAHDI channels configured in the system. “core show channels” will show you all the currently active channels. So what I think you want are all the active DAHDI channels.

Something like:

# asterisk -rx 'core show channels' | grep -e '^DAHDI'
DAHDI/49-1           5550@from-fxo:1      Up      Dial(DAHDI/g0/5550)           
DAHDI/i2/49-1        5550@from-pstn:1     Up      Dial(DAHDI/50)                
DAHDI/50-1           (None)               Up      AppDial((Outgoing Line))      
DAHDI/i1/5550-1      (None)               Up      AppDial((Outgoing Line))      
DAHDI/51-1           5555@read_dtmf:4     Up      Read(vDTMF,,,,,10)            
DAHDI/52-1           s@from-fxs:11        Up      SendDTMF(47491#)   

Show that I have 6 active dahdi channels on this system.

Is there anything more specific you were looking for?

[quote=“navaismo”]lsdahdi from linux shell will show you something like this:
[/quote]
Thanks, but doesn’t look like this one works for me.

This is what I get on my system:

# lsdahdi
### Span  1: WCT1/0 "Wildcard TE121 Card 0" (MASTER) B8ZS/ESF ClockSource
  1 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  2 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  3 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  4 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  5 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  6 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  7 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  8 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
  9 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 10 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 11 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 12 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 13 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 14 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 15 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 16 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 17 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 18 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 19 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 20 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 21 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 22 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 23 PRI        Clear       (In use) (EC: VPMADT032 - INACTIVE)
 24 PRI        HDLCFCS     (In use) (EC: VPMADT032 - INACTIVE)

Nothing that indicates a difference between a line being used or not. There are definitely active lines right now.

[quote=“sruffell”]“dahdi show channels” will show you all the DAHDI channels configured in the system. “core show channels” will show you all the currently active channels. So what I think you want are all the active DAHDI channels.

Something like:

# asterisk -rx 'core show channels' | grep -e '^DAHDI'
DAHDI/49-1           5550@from-fxo:1      Up      Dial(DAHDI/g0/5550)           
DAHDI/i2/49-1        5550@from-pstn:1     Up      Dial(DAHDI/50)                
DAHDI/50-1           (None)               Up      AppDial((Outgoing Line))      
DAHDI/i1/5550-1      (None)               Up      AppDial((Outgoing Line))      
DAHDI/51-1           5555@read_dtmf:4     Up      Read(vDTMF,,,,,10)            
DAHDI/52-1           s@from-fxs:11        Up      SendDTMF(47491#)   

Show that I have 6 active dahdi channels on this system.

Is there anything more specific you were looking for?[/quote]

This is actually what I’ve been doing for the past year, with a slightly different grep statement, and I thought I was getting reliable numbers. However, earlier today, I saw results that exceeded the number of channels I had available.

I have an output of ‘core show channels’ from earlier, and run against both my grep statement and your grep statement, the resulting number of matched lines is 26.

I only have a total of 23 usable channels with my T1, so that can’t be correct.

Channel              Location             State   Application(Data)
DAHDI/i1/X0452Z11YY- (None)               Up      AppDial((Outgoing Line))
DAHDI/pseudo-Z4XX411 s@default:1          Rsrvd   (None)
DAHDI/pseudo-5399294 s@default:1          Rsrvd   (None)
DAHDI/i1/1ZZZZ245YZ3 STARTMEETME@from-int Up      MeetMe(Z102,r,)
DAHDI/i1/1ZZZ2ZZ9321 (None)               Up      AppDial((Outgoing Line))
DAHDI/i1/1ZZZZ245YZ3 STARTMEETME@from-int Up      MeetMe(Z102,r,)
DAHDI/i1/YYZ4Z42X9Z- s@macro-dial-one:42  Up      Dial(SIP/10Y,,TtrI)
DAHDI/pseudo-4251YYY s@default:1          Rsrvd   (None)
DAHDI/pseudo-13X30YY s@default:1          Rsrvd   (None)
DAHDI/pseudo-45151Z4 s@default:1          Rsrvd   (None)
DAHDI/i1/1ZZZZ245YZ3 (None)               Up      AppDial((Outgoing Line))
DAHDI/i1/X043553Z21- STARTMEETME@from-int Up      MeetMe(Z10X,r,)
DAHDI/pseudo-145Z4X4 s@default:1          Rsrvd   (None)
DAHDI/i1/2122015YX3- s@macro-dial:Y       Up      Dial(SIP/13Z&SIP/114&SIP/12Y&S
DAHDI/i1/1ZZZZ245YZ3 STARTMEETME@from-int Up      MeetMe(Z102,r,)
DAHDI/i1/YYZ929103Z- (None)               Up      AppDial((Outgoing Line))
DAHDI/i1/ZX05Z04X4X- STARTMEETME@ivr-1:4  Up      MeetMe(Z1Y5,r,)
DAHDI/i1/ZX05Z04X4X- STARTMEETME@ivr-1:4  Up      MeetMe(Z1Y5,r,)
DAHDI/i1/ZX05Z04X4X- STARTMEETME@ivr-1:4  Up      MeetMe(Z1Y5,r,)
DAHDI/i1/X044Y94X24- (None)               Up      AppDial((Outgoing Line))
DAHDI/i1/1ZZZZ245YZ3 (None)               Up      AppDial((Outgoing Line))
DAHDI/pseudo-200X140 s@default:1          Rsrvd   (None)
DAHDI/i1/X04YX1Z315- STARTMEETME@ivr-1:4  Up      MeetMe(Z10X,r,)
DAHDI/i1/Z4YZ3XY21Y- s@macro-dial:Y       Up      Dial(SIP/21Y&SIP/315&SIP/222&S
DAHDI/pseudo-1951ZZZ s@default:1          Rsrvd   (None)
DAHDI/i1/253Z51Y4ZX- s@macro-dial:Y       Up      Dial(SIP/113&SIP/12X&SIP/12Z&S

Ah, you’ll want to remove the DAHDI/pseudo- channels from your output. Those are DAHDI channels that are created dynamically in order to mix audio from non-dahdi channels with DAHDI using the dahdi based audio mixing engine.

A brief background: In order to bridge channels in the kernel with the smallest amount of latency, DAHDI (and Zaptel before it) always contained an audio mixing engine. This made sense when the common use case was analog handsets or channel banks hanging off your Asterisk server. To alow non-DAHDI based channels to participate in these conferences, it was easiest to keep using the audio mixing engine in the kernel and allow “pseudo” DAHDI channels to be created on the fly that Asterisk could use to feed the audio from other channel technologies into DAHDI for conferencing.

If you update and switch from app_meetme to app_confbridge, Asterisk will no longer create pseudo channels since all the audio is mixed in user space in the Asterisk process.

/dev/dahdi/pseudo (196:255) - A timing-only device. Every time you open it, a new DAHDI channel is created. That DAHDI channel is “pseudo” - DAHDI receives no data in it, and only sends garbage data with the same timing as the DAHDI timing master device.

  1. DAHDI Timing

A PBX system should generally have a single clock. If you are connected to a telephony provider via a digital interface (e.g: E1, T1) you should also typically use the provider’s clock (as you get through the interface). Hence one important job of Asterisk is to provide timing to the PBX.

DAHDI “ticks” once per millisecond (1000 times per second). On each tick every active DAHDI channel reads and 8 bytes of data. Asterisk also uses this for timing, through a DAHDI pseudo channel it opens.

docs.tzafrir.org.il/dahdi-linux/ … o_channels

That is incomplete. The real reason that app_meetme is dependent on the pseudo devices is that they provide the conference bridges, not that they provide timing. Quite a few sources seem to get this wrong.

(Current versions of Asterisk have non-dahdi means of providing timing.)

Thanks for the tip and the background information.

I will revise my grep to exclude the lines with pseudo in it. Hopefully this will provide an accurate number of the actual T1 channels in use!