Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 309171) +++ channels/chan_dahdi.c (working copy) @@ -6742,7 +6742,42 @@ ast_mutex_lock(&p->lock); snprintf(buf, len, "%f", p->txgain); ast_mutex_unlock(&p->lock); + } else if (!strcasecmp(data, "dahdi_channel")) { + ast_mutex_lock(&p->lock); + snprintf(buf, len, "%d", p->channel); + ast_mutex_unlock(&p->lock); + } else if (!strcasecmp(data, "dahdi_span")) { + ast_mutex_lock(&p->lock); + snprintf(buf, len, "%d", p->span); + ast_mutex_unlock(&p->lock); + } else if (!strcasecmp(data, "dahdi_type")) { + ast_mutex_lock(&p->lock); + switch (p->sig) { +#if defined(HAVE_OPENR2) + case SIG_MFCR2: + ast_copy_string(buf, "mfc/r2", len); + break; +#endif /* defined(HAVE_OPENR2) */ #if defined(HAVE_PRI) + case SIG_PRI_LIB_HANDLE_CASES: + ast_copy_string(buf, "pri", len); + break; +#endif /* defined(HAVE_PRI) */ + case 0: + ast_copy_string(buf, "pseudo", len); + break; +#if defined(HAVE_SS7) + case SIG_SS7: + ast_copy_string(buf, "ss7", len); + break; +#endif /* defined(HAVE_SS7) */ + default: + /* The only thing left is analog ports. */ + ast_copy_string(buf, "analog", len); + break; + } + ast_mutex_unlock(&p->lock); +#if defined(HAVE_PRI) #if defined(HAVE_PRI_REVERSE_CHARGE) } else if (!strcasecmp(data, "reversecharge")) { ast_mutex_lock(&p->lock); @@ -13003,6 +13038,7 @@ nobch_channel = CHAN_PSEUDO - 1; } pvt->channel = nobch_channel; + pvt->span = pri->span; chan->channel = pvt->channel; dahdi_nobch_insert(pri, pvt); Index: UPGRADE.txt =================================================================== --- UPGRADE.txt (revision 309171) +++ UPGRADE.txt (working copy) @@ -72,6 +72,10 @@ The new channel naming for PRI channels is: DAHDI/i/[:]- +* Added CHANNEL(dahdi_span), CHANNEL(dahdi_channel), and CHANNEL(dahdi_type) + so the dialplan can determine the B channel currently in use by the channel. + Use CHANNEL(no_media_path) to determine if the channel even has a B channel. + * The ChanIsAvail application has been changed so the AVAILSTATUS variable no longer contains both the device state and cause code. The cause code is now available in the AVAILCAUSECODE variable. If existing dialplan logic Index: funcs/func_channel.c =================================================================== --- funcs/func_channel.c (revision 309171) +++ funcs/func_channel.c (working copy) @@ -224,6 +224,22 @@ chan_dahdi provides the following additional options: + + R/O DAHDI channel related to this channel. + + + R/O DAHDI span related to this channel. + + + R/O DAHDI channel type, one of: + + + + + + + + R/O PRI Keypad digits that came in with the SETUP message.