[asterisk-dev] PREDIGITS for WaitExten

Timo Teräs timo.teras at iki.fi
Tue Apr 1 09:55:29 CDT 2008


Tilghman Lesher wrote:
> On Tuesday 01 April 2008 03:08:51 Timo Teräs wrote:
>> This way the overlapped dialling would work properly over IAX. E.g. if all
>> digits are not received, the WaitExten() would wait for additional digits;
>> and not just ignore the already received digits, what it does now by
>> default. (Eg. in some cases the PBX might have sent 1230 in the first
>> place. Without the _123! the call would be dropped with invalid extension.
>> With only WaitExten(); it would ignore the first received zero.)
> 
> You can do this already with dialplan logic:
> 
> exten => _123000,1,Verbose(2,000 selected)
> exten => _123001,1,Verbose(2,001 selected)
> exten => _123[1-9]!,1,Dial(Zap/g1/${EXTEN:3})
> exten => _123!,1,Set(PREDIGITS=${EXTEN})
> exten => _123!,n,Set(origcontext=${CONTEXT})
> exten => _123!,n,WaitExten(getmoredigits)
> 
> exten => 123456,1,Verbose(2,Something else)
> 
> [getmoredigits]
> exten => 456,1,Goto(${origcontext},${PREDIGITS}${EXTEN},1)

This would not work. WaitExten does not take context. But also, WaitExten
waits for valid extension. And in above example I would have to duplicate
all my exten => rules in [getmoredigits] with the leading 123 removed.
And it would not work, if the PBX spurted '1230' in the first place. The
WaitExten would wait according to exten rules in the alternate context
which would assume that only '123' was received.

It's way cleaner to get WaitExten accept PREDIGITS. Or alternatively I
could write a new application that basically is
WaitAdditionalDigitsForExten that would wait for additional digits until
another extension matches or timeout comes.

The point is that in above example. If PBX first sent '123' it would
go to WaitExten. Then when additional (overlapped) digit of '1' would come
it would immediate match the _123[1-9]! rule and dial out. Or if the
overlapped digit was '0' it would wait for more digits and getting another
two of '0's would then match 123000. And the same rules would also work
if in the first place was received a full number like "1239321" or
"123000".

So I would want to make _123! act as if it is known that _123 is a known
prefix, but it needs more digits to make a routing decision.

Sort of what chan_zap does when overlapdial=yes and immediate=no. But it
should also work when the call is coming from IAX (or any other) context.

>> I have a rough patch for this (I didn't test it), but it gives a general
>> idea what is needed to achieve this. If you think this would be acceptable,
>> I can make tested patch against 1.6 branch and/or trunk (and sign the
>> license stuff + send the patch to bugs db).
> 
> I can't look at your patch until it's posted on the bugtracker, with the
> appropriate contributor license filed.

Ok. I'll test it a bit, maybe polish it and send it on bugtracker. I signed
the license earlier today.

Cheers,
  Timo




More information about the asterisk-dev mailing list