Summary:ASTERISK-12604: [patch] DISA does not accept extensions beginning with "#"
Reporter:John Covert (jcovert)Labels:
Date Opened:2008-08-17 22:44:06Date Closed:2008-12-09 10:46:50.000-0600
Versions:Frequency of
Environment:Attachments:( 0) app_disa.c.patch
( 1) x.tmp
Description:As those familiar with central office and PBX dialplans in North America know, while "#" is often used as a terminator for variable length numbers, it has always also been accepted as an initial character.

When I recently (finally, now that Mac OS X seems to work with the latest patches) upgraded my production PBX to 1.4, I discovered that I was unable to dial extensions in a DISA's context which had the pattern "_#XX"

To correct this, in the check for an extension terminated by '#' (line 301 of app_disa.c), I now also check for "i>0", so that the test only succeeds and breaks out of the loop if the '#' is not the first character.

To comply with industry standards and practice, I suggest and request this patch become a permanent part of Asterisk.


A full solution would be to check for dialplan patterns accessible from the DISA which contain embedded '#' characters and only terminate input if not matching one of these.  Although in North America, the '#' is typically only used as a single initial character (addressed by my simple patch), in Europe, the '#' character may be used most commonly also as a second character of a longer string which begins with either '#' or '*'.
Comments:By: snuffy (snuffy) 2008-08-17 23:08:15

Could you please submit a unified patch 'diff -u file1 file2'

By: John Covert (jcovert) 2008-10-23 07:05:43

Could we get some action on this, please?  Bug still exists in

Since a null extension is not meaningful, and since telephony practice clearly allows things to begin with a "#" (e.g. #xx feature codes), and since this is a change from past behavior which breaks existing dialplans, and since the proposed fix is both trivial, clear, and works, could we get this committed in both the 1.4 and 1.6 branches, please?


By: Russell Bryant (russell) 2008-10-24 17:02:15

I'm not really happy with changing how this delimiter works.  Besides, it's pretty easy to work around this using dialplan ...

By: John Covert (jcovert) 2008-11-28 12:44:52.000-0600

I'm reopening this because this has really broken existing applications.

>I'm not really happy with changing how this delimiter works.

This only changes the behaviour if "#" is entered as the first character when connected to a DISA.  Previously, this worked correctly and allowed the DISA's dialplan to contain entries with a "#" at the beginning, or even a single "#", which would terminate immediately, as now, but going to that extension, rather than to "i", which is the only place a single "#" can go to now, since a null extension is meaningless.

>it's pretty easy to work around this using dialplan

Not with a DISA.  The change that created this bug made it necessary to either (a) locally implement my simple change or (b) not use a DISA at all, and just create an IVR with Dialtone recorded in a file for Background.

Please reconsider this simple patch, restoring prior behaviour, which complied with typical industry numbering plans, which allowed "#" as an initial character, only treating it as a terminator later.

By: Tilghman Lesher (tilghman) 2008-11-29 03:12:43.000-0600

Why not just use a combination of Authenticate, Playtones, and WaitExten ?  It performs the way you expect, without any change in code.

By: John Covert (jcovert) 2008-11-29 07:40:40.000-0600

Playtones does not behave the way the dialtone in a DISA behaves.  If it did, there would be no need for DISA at all.  In a DISA, the dialtone breaks on digit press.  Playtones continues until you do an explicit StopPlayTones.  You'd have to implement the first-digit-translation separately in the dialplan, rather than letting extension matching take care of it.

Remember, this extremely simple code change restores to DISA the ability to accept a "#" as a initial digit, a capability DISA had before the change in which "#" was made a terminator.  In the telephony industry, "#" is is frequently an initial digit.  DISA used to work correctly, and no longer does.

With my incredibly trivial code change, if someone NEEDS to accept a single "#", all that is needed is

exten => #,1,DoSomething(..)

And this is exactly what would have been needed before "#" was made a terminator!


By: Digium Subversion (svnbot) 2008-11-29 12:33:13.000-0600

Repository: asterisk
Revision: 159853

U   trunk/apps/app_readexten.c

r159853 | tilghman | 2008-11-29 12:33:13 -0600 (Sat, 29 Nov 2008) | 2 lines

Allow the '#' sign to exist within an extension (inspired by issue ASTERISK-12604)



By: John Covert (jcovert) 2008-11-29 12:51:30.000-0600

Brilliant!  Nice new 1.6 app.

Now if only both DISA and regular extension matching in chan_dahdi and chan_iax would work that way!  Common code for all three would be great.


By: Tilghman Lesher (tilghman) 2008-11-30 17:03:14.000-0600

Resolved by change to ReadExten.

By: Digium Subversion (svnbot) 2008-12-09 10:46:49.000-0600

Repository: asterisk
Revision: 162014

U   branches/1.4/apps/app_disa.c

r162014 | russell | 2008-12-09 10:46:49 -0600 (Tue, 09 Dec 2008) | 5 lines

Allow DISA to handle extensions that start with #.

(closes issue ASTERISK-12604)
Reported by: jcovert