On Monday 08 Sep 2014, Anurag Rana wrote: > @A J Stiles : If you could provide an example as you said, It would be very > nice. Thanks.
This is excerpted from a dialplan application I wrote. It's actually a PIN entry but should be usable for any general purpose application. Sound files referred to will need to be created by you. [get_pin] exten => s,1,Set(pin=) exten => s,n,Set(PINLENGTH=4) exten => s,n(prompt),Background(ajs-enter_pin) ; Build up the PIN digit by digit. The WaitExten() will be cut short by any ; keystroke, so we can use a quite longish timeout. exten => s,n(nextdigit),WaitExten(30) exten => s,n,Playback(ajs-sorry_didnt_get) exten => s,n,GoToIf($[${LEN(${pin})}<1]?prompt:saysofar) exten => s,n(saysofar),Playback(ajs-digits_so_far) exten => s,n,SayDigits(${pin}) exten => s,n,Goto(nextdigit) ; We need a "h" extension (for tidying up after ourselves) in this context; ; because the call may be placed from within this context. exten => h,1,NoOp(Clearing up) exten => *,1,Playback(ajs-start_again) exten => *,2,GoTo(get_pin,s,1) exten => #,1,Hangup() exten => _X,1,Set(pin=${pin}${EXTEN:0:1}) exten => _X,n,NoOp(PIN so far is ${pin}) exten => _X,n,GoToIf($[${LEN(${pin})}>=${PINLENGTH}]?got_all:need_more) exten => _X,n(need_more),GoTo(get_pin,s,nextdigit) ; We have all 4 digits ..... exten => _X,n(got_all),NoOp(PIN is ${pin}) -- AJS Note: Originating address only accepts e-mail from list! If replying off- list, change address to asterisk1list at earthshod dot co dot uk . -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users