[Freeswitch-users] caller-hunt-destination in lua

Tim St. Pierre fs-list at communicatefreely.net
Tue Oct 26 20:03:31 PDT 2010


Hello,

I am making extensive use of lua as a dialplan, and for the most part, it works really well.

The one problem I'm having is where I use execute_extension in an XML dialplan to execute the lua
dialplan and return.

In this situation, I would like to know what the hunt destination is, as opposed to the
dialed_destination.  They are not always the same.

For example:
<condition field="destination_number" expression="^(5\d{3})$">
	<action="execute_extension" data="$1 lua extension.lua"/>
</condition>

How do I know what the value of $1 was in the lua script?

Right now, I am using session:getVariable("caller_destination"), and it works for the most part, but
problems arise if there are nested executes.

If I execute an extension in a dialplan, that then executes another dialplan, the above variable
returns the destination in the first dialplan, whereas I want the destination in the most recent
dialplan (the one we are actually hunting in).

I tried passing it to the lua script as an argument, but it didn't show up in the argv[] table.

Any suggestions?





More information about the FreeSWITCH-users mailing list