How to get actual number of channel in asterisk 13?

In asterisk 1.4 number of channel was specified in chan->name.
e.g. number 62:
asterisk 1.4 ZAPTEL: Zap/62-1
How to get actual number of channel in asterisk 13?
e.g. in chan->name this number of span only.
asterisk 13 DAHDI: DAHDI/I2/102-1

P.S. Maybe JColp know answer.

Here is what R.Mudget say about extentons.conf:

You can use the AMI action DAHDIShowChannels to get the current channel mapping.

There is an AMI event that you can look for:
Event: DAHDIChannel Channel: name Uniqueid: id DAHDISpan: 5
DAHDIChannel: 23

It is generated whenever a call is assigned to a B channel or a call moves to a different B channel.

There is also the CHANNEL() dialplan function:
CHANNEL(dahdi_channel)
CHANNEL(dahdi_span)
CHANNEL(dahdi_type)

The DAHDIChannel event and CHANNEL() function are mentioned in the UPGRADE.txt file.

Richard

But how do I get an actual number of channel in c-language API?

That information is only available inside the chan_dahdi channel driver. You cannot directly access that information outside that module. For another C module to get that information you will have to use the ast_str_substitute_variables() function to evaluate the “${CHANNEL(dahdi_channel)}” expression on a DAHDI channel.

1 Like