On 8/1/07, John Lange <[EMAIL PROTECTED]> wrote:
>
> How can you build a extension string that allows the caller to enter a
> number followed by the "#" key when the number is a variable length?
>

Could you just have an extension that captures single digits, appends them
to a variable and then exits when it gets '#'.  It would be like a while
loop that gets one char at a time.

It's been a while since I've played with something like this so I'll include
some pseudo code to illustrate the idea.  It would have to be implemented as
a macro I imagine.  Some problems I can see already include the need for
"autofallthrough=no" but I think that's a global setting that's best left at
default (for 1.2 and up).  Fortunately, using N instead of X removes all
that extension sort order problems.

[GetSomeDigits]
; Note this is just pseudo code, it won't work without modification
exten => t,1, {$ReturnVar} = {$SomeVar}
exten => t,2, {$SomeVar} = ""

exten => _N,1, {$SomeVar} = {$SomeVar} + {$EXTEN}

exten => #,1, {$ReturnVar} = {$SomeVar}
exten => #,2, {$SomeVar} = ""
exten => #,3, Noop(Exit and Return result)

I'd be interested to know if I'm overlooking anything or whether others
think that's feasible.

Dave

Reply via email to