Once you hangup, unless you have zombie exec, the call ends and it won't transfer nor execute the lua script.

Also, if you have the lua do the hangup, it can directly access all the channel variables itself.

Alternatively, you can set a hangup hook and pass everything:
<action application="set" data="api_hangup_hook=lua callback.lua ${effective_caller_id_number} ${destination_number}"/>

-Avi

On Thu, Jan 1, 2015 at 2:12 PM, Sina Owolabi <notify.sina@gmail.com> wrote:
Avi,

thanks and happy new year!
I'm trying to  using a public extension to receive the call, hangup
and transfer to the extension that is actually doing the lua'ing (so
to speak):

<extension name="callback-caller1">
    <condition field="${caller_id_number}"
expression="^0(\d{10})$"require-nested="false">
       <action application="set" data="effective_caller_id_number=+123${1}"/>
       <action application="set" data="effective_caller_id_name=+123${1}"/>
    </condition>
    <condition field="destination_number" expression="^0123456(7)(8)$">
      <action application="ring_ready" />
      <action application="sleep" data="3000"/>
      <action application="set" data="ringback=%(2000, 4000, 440.0, 480.0)"/>
      <action application="hangup" />
      <action application="transfer" data="1213 XML default"/>
   </condition>

<extension name="1213">
     <condition field="destination_number" expression="^1213$">
        <action application="lua" data="callback.lua
${effective_caller_id_number} ${destination_number}"/>
     </condition

Please is this the proper way to collect data from the first leg to
pass to the lua script?

On Wed, Dec 31, 2014 at 6:36 PM, Avi Marcus <avi@avimarcus.net> wrote:
> I've used a lua script to grab the information (and make sure it's a valid
> callback), hangup, and then run:
>
> freeswitch.msleep(2000); --wait 2 seconds to make sure their side will
> actually have the call over
> api = freeswitch.API()
> api:execute("originate", your-dialstring)
>
> -Avi
>
> On Wed, Dec 31, 2014 at 11:37 AM, Sina Owolabi <notify.sina@gmail.com>
> wrote:
>>
>> Hi List!
>>
>>
>> FreeSWITCHNewbie here.
>> Please can I have some guidance on how to setup call back?
>>
>> I would like to be able to dial the DID attached to the SIP trunk
>> Freeswitch is registered to, and then have freeSWITCH hang up the call
>> and dial the caller id number back through any other SIP trunk
>> FreeSWITCH Is registered with, but with the origination number set to
>> the DID that the first call came through in the first place.
>>
>> Please is this possible just through the dial plan?
>>
>> Thanks for any help!
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting@freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users@lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting@freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users@lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org