First off, welcome to FreeSWITCH!<br><br>I would recommend that you do as much as possible in the dialplan and as little as possible in Lua. Lua makes things like if/then/else blocks trivially easy. The XML dialplan makes connecting calls trivially easy. The sweet spot is to find a nice balance. From what I see in your samples below, you don't even need the receivewithwhisper.lua on the b-leg. You could create a very simple dialplan extension that has each of the dp apps that you are executing in that Lua script. Then your execute_on_answer will be a transfer to that extension instead of calling Lua.<br>
<br>Maybe something like this...<br><br>Modify initiator script:<br><span style="font-family:courier new,monospace">new_session = freeswitch.Session("[execute_on_answer=transfer:whisper_answer]sofia/external/12345@mydest");
</span><br><br>Then add an extension:<br><br><span style="font-family:courier new,monospace"><extension name="whisper answer"></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> <condition field="destination_number" expression="^whisper_answer$"></span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> <action application="answer"/></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> <action application="playback" data="ConnectingToCaller.wav"/></span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">
<action application="conference" data="CONFTEST@default+flags{endconf, moderator}"/></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
<action application="hangup"/></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">
</condition></span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"></extension></span><br><br>Tinker with that and see what you can get accomplished.<br><br>-MC<br>
<br><div class="gmail_quote">On Thu, Jul 19, 2012 at 6:18 AM, Alpha Niner <span dir="ltr"><<a href="mailto:alphaniner@me.com" target="_blank">alphaniner@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>Hi,<br><br>Firstly apologies for the newbie question. I've tried searching the various documentation and trying a few different things but to no avail, so I've come here to ask for help. I think my problem relates to sessions, but I'm not totally sure.<br>
<br>What I'm trying to do is:<br><br>1. A lua script is run by someone calling into FS (the initiator)<br>2. They select an option, which originates and makes an outbound call to another phone number<br>3. The 3rd party (hopefully) answers their phone and receives a prompt that they're going to be connected (the receiver)<br>
4. Both parties join a conference and talk to each other (a conference as there may be other parties in future)<br><br>To do this I'm creating a session and using execute_on_answer to run the second script and provide the prompt to the receiving party. However the receiving party never hears a prompt, comes into the conference, immediately drops out and hangs up.<br>
<br>Here are the scripts, they're pretty simple;<br><br>The initiator:<br><br>session:answer()
<br>session:streamFile("WaitForOutdial.wav")
<br>new_session = freeswitch.Session("[execute_on_answer=lua /usr/local/freeswitch/scripts/receivewithwhisper.lua]sofia/external/12345@mydest");
<br>session:execute("conference", "CONFTEST@default+flags{endconf, moderator}")
<br>session:hangup();<br><br>The above works fine and the outbound call is placed. The script below is then executed but the receiving phone rings but nothing is heard, the conference is joined/exited and it terminates again;<br>
<br><br>The receiver (receivewithwhisper.lua):<br><br>session:answer()
<br>session:streamFile("ConnectingToCaller.wav")
<br>session:execute("conference", "CONFTEST@default+flags{endconf, moderator}")
<br>session:hangup();<br><br>The receiving scripts runs when the receiver answers their phone, and executes (quickly) and terminates. I was expecting it to drop into the conference and I'd be able to talk to the other person. It does join the conference, but then exits right away and falls through to the hangup section.<br>
<br>As I say, I'm not exactly sure if this is the best way (maybe there's another - suggestions are welcome) and not exactly sure what the problem is although I suspect it's something to do with the sessions?<br>
<br>Any help, advice, corrections or examples would be appreciated. It's all done in lua and I've tried to avoid session.originate as I understand this is deprecated.<br><br>Thanks<br><br>Adam<br><br><br></div></div>
<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>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.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://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
Join Us At ClueCon - Aug 7-9, 2012<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org">http://www.OSTAG.org</a><br><br><br>