[asterisk-users] how to match "no callerid" in 1.6 ?
Leif Madsen
leif.madsen at asteriskdocs.org
Sat Jul 25 07:28:24 CDT 2009
Philipp Kempgen wrote:
> Louis-David Mitterrand schrieb:
>> On Fri, Jul 24, 2009 at 10:37:38AM +0200, Michiel van Baak wrote:
>>> On 10:17, Fri 24 Jul 09, Louis-David Mitterrand wrote:
>>>> This used to work fine in 1.4:
>>>>
>>>> exten => 2131/,1,NoOp(reject3: ${CALLERID(num)})
>>>> exten => 2131/,n,Playback(no_unknow_callerid_here)
>>>> exten => 2131/,n,Hangup
>>>>
>>>> And now, after upgrading to 1.6.1.x it matches every callerid.
>
>> Why remove the elegant and minimal <exten>/<emtpy>
>> notation
>
> Not that need the <exten>/<callerid> syntax for anything but I'd say
> this is a bug and a regression.
> The syntax is exten[/callerid] so the "/" clearly says that there
> is a second "argument" even if that happens to be an empty string.
While this could be a bug and a regression, I don't see how using the
exten[/callerid] notation is really better than the GotoIf()
Personally, the GotoIf() makes much more sense to me, because you're placing the
matching logic in a single place, as opposed to an error prone method of adding
an ending / at the end of every line of that extension.
Typically I try to get away from a pattern match as soon as I can, by doing
something like:
exten => _[A-Za-z0-9].,1,Set(EXTENSION=${EXTEN})
exten => _[A-Za-z0-9].,n,Goto(start,1)
exten => start,1,Verbose(2,Incoming call from ${CALLERID(num)} to extension
${EXTENSION})
exten => start,n,GotoIf($[${CALLERID(num)} = 5551212]?bad_callerid,1)
exten => start,n,...
exten => bad_callerid,1,Verbose(2,A very bad man!)
exten => bad_callerid,n,Hangup()
I think that is a better method than constantly typing a complex pattern match,
or adding additional extra characters that could potentially be missed, and
leading to additional debugging, or errors in dialplan.
Leif Madsen.
http://www.leifmadsen.com
http://www.oreilly.com/catalog/asterisk
More information about the asterisk-users
mailing list