[asterisk-users] Calling Directory app from AGI

Steve Edwards asterisk.org at sedwards.com
Mon Jan 31 15:55:32 CST 2011


On Mon, 31 Jan 2011, Mike Diehl wrote:

> I've got an agi script that calls the directory function, which seems to 
> work to a point.  However, once the caller has selected an entry, I need 
> my agi script to find out which extension was selected.  I've RTFM'd and 
> don't see that the extension is returned.  Nor is a variable set, as far 
> as I can see.
> 
> Is there a way to get this information from the directory application?

No channel variable is set, but it would be a simple modification to the 
source code to return the extension instead of dialing it.

Another course of action would be to break your AGI into 2 parts and then 
'catch' the exten in the 'dial-context.' For example, assuming you are 
using the 'default' voicemail context and the 'directory-test' 
dial-context, you would execute the directory application like (1.2):

 	exec_agi("exec directory default|directory-test");

and then in your dialplan you would have something like:

[directory-test]
         exten = _!.,1,                  verbose(1,[${EXTEN}@${CONTEXT}])
         exten = _!.,n,                  agi(part-two,--extension=${EXTEN})
         exten = _!.,n,                  hangup()

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000


More information about the asterisk-users mailing list