[asterisk-bugs] [Asterisk 0017683]: [patch] I could not find an easy way to access DAHDI channel and span number from the dialplan.

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Jul 27 05:14:54 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17683 
====================================================================== 
Reported By:                mrwho
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17683
Category:                   Channels/chan_dahdi/NewFeature
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     feedback
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 274530 
Request Review:              
====================================================================== 
Date Submitted:             2010-07-22 05:52 CDT
Last Modified:              2010-07-27 05:14 CDT
====================================================================== 
Summary:                    [patch] I could not find an easy way to access 
DAHDI channel and span number from the dialplan.
Description: 
  I could not find an easy way to access from the dialplan the span and the
PRI channel being used by an Asterisk channel. As a quick solution I
patched chan_dahdi so that it will populate - if applicable - two
variables:

  PRI_CHANNEL: the PRI channel number
  PRI_SPAN: the PRI span number

  These variables can then be used in the dialplan. The patch it's pretty
simple, even if I don't know how much it could be needed by others.
====================================================================== 

---------------------------------------------------------------------- 
 (0125106) mrwho (reporter) - 2010-07-27 05:14
 https://issues.asterisk.org/view.php?id=17683#c125106 
---------------------------------------------------------------------- 
Well, it seems that in some cases the "CHANNEL" implementation is not
enough. As an example, if we need to access the information about SPAN and
PRI channel externally and we set two variables in the dialplan like so:

<pre>
exten => _X!,n, Set(PRI_CHANNEL=${CHANNEL(pri_channel})
exten => _X!,n, Set(PRI_SPAN=${CHANNEL(pri_span})
</pre>

  it all works out well for the main leg of the call. The other leg will
have the variables populated only after the "Dial" has completed and jumped
to the relevant part of the dialplan.

  Setting the variables for the channel from the chan_dahdi code allows
for external programs interfacing to asterisk to access that information
from the moment the channel is set-up.

  Since this may be a very exotic setting - isn't after all ISDN an exotic
phone system - I made a patch including both solutions, to activate the
creation of the channel variables being set automatically you will need to
uncomment in chan_dahdi.c the following line:

<code>
/* #define PRI_VARS 1 */
</code>

  I believe that like this we can satisfy a wider range of needs. On the
other hand: my beliefs are often wrong. :) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-07-27 05:14 mrwho          Note Added: 0125106                          
======================================================================




More information about the asterisk-bugs mailing list