you can pass the caller_id_number parameter to the Lua script e.g.
<action application="lua" data="/usr/local/freeswitch/scripts/foo.lua ${caller_id_number}"/>
-nandy


On Mon, Apr 5, 2010 at 11:00 PM, Uzo Uzo <uzoechi@yahoo.com> wrote:
I probably am doing this wrong, but here is what I have.
I have a bunch of DID's.  I want my lua script to intercept all calls then
handle them based on which DID was called.

What I have done is create my lua script foo.lua

then in the dialplan/default.xml

I have
<extension name="mylua">
 <condition field="destination_number" "expression="^1002$">
 <action application="lua" data="/usr/local/freeswitch/scripts/foo.lua"/>
</condition>
</extension>

then i forward all my DIDs to extension 1002@myfreeswitchbox

when I get a call to the DID the lua script intercepts it, is this the best way?

from the lua script,  I can do session:getVariable("caller_id_number")

but that gives me the caller id of the incoming number, which is cool.
which variable can i examine to get the DID number?

thanks.