<div dir="ltr"><div class="gmail_extra"><div><div class="gmail_signature"><div>Two things:</div><div>1) You aren&#39;t grabbing the arg, but the channel variable.. try this in your script:</div><div><div><span style="font-size:12.8000001907349px">caller_id_number</span> = argv[1]</div><div><span style="font-size:12.8000001907349px">number_to_call</span> = argv[2]</div><div><br></div><div>2) I don&#39;t think you&#39;re managing your hangup/callback originate properly.</div><div>I don&#39;t think you want to use bgapi... or maybe you just need a destination. It&#39;s &quot;<a href="http://wiki.freeswitch.org/wiki/Mod_commands#originate">originate</a> sofia/A endpoint&quot; -- you need to specify where it goes to, the lua script can&#39;t &quot;receive&quot; the call. You can have it received by e.g: &amp;lua(pickup.lua)</div><div><br></div><div>api = freeswitch.API()</div><div>api:execute(&quot;originate&quot;, DialString..&quot; &amp;lua(pickup.lua)&quot;);</div></div><div><br></div><div>Also:</div><div>Maybe you want to use it as a hangup hook. Instead of:</div><div><span style="font-size:12.8000001907349px">&lt;action application=&quot;lua&quot; data=&quot;callback.lua </span><span style="font-size:12.8000001907349px">${effective_caller_id_number} ${destination_number}&quot;/&gt;</span><br></div><div><span style="font-size:12.8000001907349px">Do:</span></div><div><span style="font-size:12.8000001907349px">&lt;action application=&quot;</span>set<span style="font-size:12.8000001907349px">&quot; data=&quot;</span>api_hangup_hook=lua <span style="font-size:12.8000001907349px">callback.lua </span><span style="font-size:12.8000001907349px">${effective_caller_id_number} ${destination_number}&quot;/&gt;</span></div><div><span style="font-size:12.8000001907349px">&lt;action application=&quot;</span>hangup<span style="font-size:12.8000001907349px">&quot; data=&quot;</span>486<span style="font-size:12.8000001907349px">&quot;/&gt;</span></div><div dir="ltr"><br></div><div>-Avi </div></div></div>
<br><div class="gmail_quote">On Wed, Jan 7, 2015 at 1:52 AM, Sina Owolabi <span dir="ltr">&lt;<a href="mailto:notify.sina@gmail.com" target="_blank">notify.sina@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi List,<br>
<br>
FreeSWITCH newbie here again.<br>
I am trying to cobble togther a lua callback script, my first attempt<br>
was successful, but I am trying to make it slightly more elegant.<br>
I don&#39;t see any errors when I try to run this but the callback isnt happening.<br>
This is my very second attempt trying to write in lua, so I would be<br>
very grateful for any help.<br>
<br>
The user is expected to dial in, have the call hangup and FreeSWITCH call back.<br>
<br>
I&#39;m passing a modified $effective_caller_id_number and<br>
$destination_number to the lua script:<br>
<br>
&lt;extension name=&quot;callyouback&quot;&gt;<br>
    &lt;condition field=&quot;${caller_id_number}&quot;<br>
expression=&quot;^1(\d{10})$&quot;require-nested=&quot;false&quot;&gt;<br>
       &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_number=+234${1}&quot;/&gt;<br>
       &lt;action application=&quot;set&quot; data=&quot;effective_caller_id_name=+234${1}&quot;/&gt;<br>
    &lt;/condition&gt;<br>
    &lt;condition field=&quot;destination_number&quot; expression=&quot;^012345(6)(7)$&quot;&gt;<br>
      &lt;action application=&quot;set&quot; data=&quot;destination_number=+12312345${1}${2}&quot; /&gt;<br>
      &lt;action application=&quot;lua&quot; data=&quot;callback.lua<br>
${effective_caller_id_number} ${destination_number}&quot;/&gt;<br>
      &lt;action application=&quot;gentones&quot; data=&quot;%(3000,0,430,450,550)&quot;/&gt;<br>
      &lt;action application=&quot;hangup&quot; data=&quot;NORMAL_CLEARING&quot;/&gt;<br>
     &lt;/condition&gt;<br>
<br>
<br>
The script itself:<br>
<br>
api = freeswitch.API();<br>
call_string = &quot;bagpi originate<br>
{origination_caller_id_name=&quot;..caller_id_name..&quot;,origination_caller_id_number=&quot;..caller_id_number..&quot;}sofia/gateway/mysipgate/&quot;..number_to_call..&quot;&quot;<br>
<br>
freeswitch.msleep(5000);<br>
if (session:ready()) then<br>
        caller_id_number = session:getVariable(&quot;destination_number&quot;);<br>
        caller_id_name = session:getVariable(&quot;destination_number&quot;);<br>
        number_to_call = session:getVariable(&quot;effective_caller_id_number&quot;);<br>
<br>
        api:executeString(call_string);<br>
        freeswitch.msleep(2000);<br>
        session:streamFile(&quot;/tmp/get_off_my_lawn.wav&quot;);<br>
        session:hangup(&quot;NORMAL_CLEARING&quot;);<br>
end<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br></div></div>