[asterisk-dev] [asterisk-users] Calling Directory app from AGI

Mike Diehl mdiehl at diehlnet.com
Tue Feb 15 02:08:08 CST 2011


"Tilghman Lesher" <tilghman at meg.abyt.es> wrote:
> On Monday 31 January 2011 22:21:14 Mike Diehl wrote:
>> Steve Edwards wrote:
>> > 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.
>> 
>> Is this a patch that anyone else would be interested in?  I could
>> probably figure out how to accept a flag, say 'r', and return the
>> extension.  I'm not an official asterisk developer, but I could/would
>> sign a release. --
> 
> Mike, that sounds great.  The right way to go about this is through the
> issue tracker at https://issues.asterisk.org.  This is also where you
would
> need to sign your license agreement for the contribution.  Just mark your
> issue as Severity: Feature, and it'll probably find its way into 1.10.

Well, I got it working.  I'll go through the regular channels and fill out
the release shortly.  In the mean time, the patch is so trivial, I thought
I'd post it to see if I had done anything blatently wrong:

Comments?

# diff app_directory.c app_directory.c.orig 


98,100d97
<                                       <option name="s">
<                                               Do not connect call. 
Instead set ${DIR_EXTEN} to the selected extension.</para>
<                                       </option>
135d131
<       OPT_SET =           (1 << 6),
143d138
<       OPT_ARG_SET =         4,
145c140
<       OPT_ARG_ARRAY_SIZE =  5,
---
>       OPT_ARG_ARRAY_SIZE =  4,
162d156
<       AST_APP_OPTION_ARG('s', OPT_SET, OPT_ARG_SET),
715a710
> 
732,739d726
<       }
< 
<       if (count == 1) {
<               pbx_builtin_setvar_helper(chan, "DIR_EXTEN",
sorted[0]->exten);
<               ast_log(LOG_WARNING, "User entered %s, which matched %s
(%s).\n", 
<                       ext, sorted[0]->exten, sorted[0]->name);
< 
<               return 1;
<       }

--

Take care and have fun,
Mike Diehl.





More information about the asterisk-dev mailing list