[Asterisk-bugs] [Asterisk 0010082]: Application and function to determine existence of extensions but not jump to it yet

noreply at bugs.digium.com noreply at bugs.digium.com
Sun Jul 8 22:18:15 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10082 
====================================================================== 
Reported By:                chappell
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10082
Category:                   Applications/General
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 59300 
Disclaimer on File?:        Yes 
Request Review:              
====================================================================== 
Date Submitted:             06-28-2007 12:05 CDT
Last Modified:              07-08-2007 22:18 CDT
====================================================================== 
Summary:                    Application and function to determine existence of
extensions but not jump to it yet
Description: 
Attached are a new dialplan command (application) and a new dialplan
function.

The command ReadExten works much like Read.  However, instead of simply
accepting digits until an inter-digit time runs out, it tests the dialed
digits against a specified context and returns when it determines that a
number valid in that context has been dialed.

The function ISEXTEN determines whether a given context, extension, and
priority exist or not.

We use this new features in a calling-card IVR.  It invites the caller to
dial a number.  When a valid number is detected, it plays "connecting..."
and jumps to the context, like so:

[ivr-system-access]
exten => s,1,Answer

; Let the user dial a number in this context.
exten =>
s,n(repeat),ReadExten(number,custom/system-access-dial-extension,,n)
exten => s,n,GotoIf(${ISNULL(${number})}?i,1)

; Dispatch non-extension menu items.
exten => s,n,GotoIf(${ISEXTEN(phones,${number})}?:phones,${number},1)

; Put thru call to the dialed extension.
exten => s,n,Verbose(2,${CALLERID(all)} (${CDR(accountcode)}) dialed
${number})
exten => s,n,Background(custom/system-access-connecting,noanswer)
exten => s,n,Dial(Local/${number}@ivr-system-access-extensions/n,,Hg)

; Call ended.  Go bad so that the user can dial again.
exten => s,n,Verbose(2,${CALLERID(all)} (${CDR(accountcode)}) ended call
to ${number})
exten => s,n,Goto(s,begin)

exten => 1,1,Playback(option-one)
exten => 1,n,Hangup

exten => i,1,Playback(custom/system-access-invalid-extension)
exten => i,n,Goto(s,repeat)

include => phones


====================================================================== 

---------------------------------------------------------------------- 
 Corydon76 - 07-08-07 22:18  
---------------------------------------------------------------------- 
Okay, now that your license has been approved, I have an answer to my
question:  it'll continue to wait, but if the user enters no more digits
within digit_timeout, it will return a valid result.

One thing I don't think is entirely desireable is your autojump code in
the resolution of invalid or timeout extensions.  The suggested method for
these exceptions is to set a status channel variable.  I'd suggest a name
such as READEXTENSTATUS with possible values of "OK", "TIMEOUT", or
"INVALID".

Also, you have a few formatting issues (like spaces in several places
where there should be a tab, "if(", and a few others).  See the coding
guidelines.

Finally, unless you've intended to assign copyright to Digium, you should
probably change the copyright to yourself, as the standard license is not a
assignment of copyright.

On the whole, it's a good start, and I'm happy to see this go in once the
criticisms are addressed. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-08-07 22:18  Corydon76      Note Added: 0066760                          
======================================================================




More information about the Asterisk-bugs mailing list