it's probably related to escaping the data.<br>I was sick of watching you suffer so i added api_on_answer variable to trunk.<br><br><br><div class="gmail_quote">On Fri, Oct 23, 2009 at 3:54 AM, Henry Huang <span dir="ltr"><<a href="mailto:red.rain.seven@gmail.com">red.rain.seven@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks to c6burns on IRC channel for the tip to use <font color="#3366ff">execute_on_answer</font> in combination with <font color="#3366ff">eval, </font>and of course everyone here that pointing me to the right direction.<div>
<font color="#3366ff"><br></font></div><div><font color="#3366ff"><font color="#000000">I was able to execute </font>sched_api<font color="#000000"> with </font>eval<font color="#000000">, but not with the combination of execute_on_answer. The argument just don't get parsed as the eval argument. Here is the code:</font></font></div>
<div><br></div><div><font color="#3366ff"><font color="#000000"><span style="background-color: rgb(255, 255, 102);">setVariable("execute_on_answer", "eval sched_api(+%ld none uuid_displace <some uuid> start /usr/local/freeswitch/sounds/en/us/callie/misc/8000/final.wav 20 mux)");</span></font></font></div>
<div><br></div><div><br></div><div><font color="#3366ff"><font color="#000000">Here is the log:</font></font></div><div><div><font color="#009900">2009-10-23 16:17:53.633189 [DEBUG] switch_scheduler.c:214 Added task 2 sched_api_function (none) to run at 1256285888</font></div>
<div><font color="#009900">EXECUTE sofia/internal/<a href="mailto:1688004@192.168.1.66" target="_blank">1688004@192.168.1.66</a> <b>eval(+OK </b>Added: 2</font></div><div><font color="#009900">)</font></div>
<div><br></div><div><div><font color="#ff0000">2009-10-23 16:18:04.52701 [DEBUG] switch_channel.c:1927 sofia/internal/<a href="mailto:1688004@192.168.1.66" target="_blank">1688004@192.168.1.66</a> <b>execute on answer: eval(sched_api(+37 none uuid_displace 84d74f41-8668-4138-943f-f076e94046ad start /usr/local/freeswitch/sounds/en/us/callie/misc/8000/final.wav 20 mux))</b></font></div>
<div><font color="#ff0000">EXECUTE sofia/internal/<a href="mailto:1688004@192.168.1.66" target="_blank">1688004@192.168.1.66</a> eval(sched_api(+37 none uuid_displace 84d74f41-8668-4138-943f-f076e94046ad start /usr/local/freeswitch/sounds/en/us/callie/misc/8000/final.wav 20 mux))</font></div>
<div><br></div><div><br></div><div>The first part of the log is when I just do execute("eval", "${sched_api(+%ld none uuid_displace <some uuid> start /usr/local/freeswitch/sounds/en/us/callie/misc/8000/final.wav 20 mux)}"); And I simple get a OK, and then later on the sched_api gets executed. </div>
<div><br></div><div>However, on the excerpt of the second log. which I use the combination with execute_on_answer like specified in the yellow hight code above. It doesn't simply return a OK, instead it shows the whole blob of code. and does nothing later. </div>
</div><div><br></div></div><div><div></div><div class="h5"><div><font color="#3366ff"><font color="#000000"><br></font></font><br><div class="gmail_quote">On Thu, Oct 22, 2009 at 4:09 AM, Anthony Minessale <span dir="ltr"><<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yes you need an API object as described in other email.<br><br>Which line of code from java caused that segfault <br>
It looks like a simple NULL string issue that we may want to hunt down.<div>
<div></div><div><br><br><div class="gmail_quote">On Wed, Oct 21, 2009 at 4:44 AM, Henry Huang <span dir="ltr"><<a href="mailto:red.rain.seven@gmail.com" target="_blank">red.rain.seven@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I can't seem to find the right thing to use in mod_java to execute api commands, only api_after_bridge<div>
<br></div><div><br></div><div><div>2009-10-21 17:42:46.593094 [NOTICE] mod_sofia.c:1509 Pre-Answer sofia/internal/<a href="mailto:1688003@192.168.1.66" target="_blank">1688003@192.168.1.66</a>!</div>
<div>#</div><div># A fatal error has been detected by the Java Runtime Environment:</div><div>#</div><div># SIGSEGV (0xb) at pc=0x004e4480, pid=1927, tid=16116624</div><div>#</div><div># JRE version: 6.0_16-b01</div><div>
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode linux-x86 )</div><div># Problematic frame:</div><div># C [libc.so.6+0x6f480] strcpy+0x10</div><div>#</div><div># An error report file with more information is saved as:</div>
<div># /usr/local/freeswitch/bin/hs_err_pid1927.log</div><div><font color="#ff0000">2009-10-21 17:42:59.883729 [ERR] switch_core_session.c:1374 Invalid Application sched_api</font></div><div>2009-10-21 17:42:59.883729 [NOTICE] switch_core_session.c:1375 Hangup sofia/internal/<a href="mailto:1688003@192.168.1.66" target="_blank">1688003@192.168.1.66</a> [CS_EXECUTE] [DESTINATION_OUT_OF_ORDER]</div>
<div>#</div><div># If you would like to submit a bug report, please visit:</div><div># <a href="http://java.sun.com/webapps/bugreport/crash.jsp" target="_blank">http://java.sun.com/webapps/bugreport/crash.jsp</a></div>
<div># The crash happened outside the Java Virtual Machine in native code.</div>
<div># See problematic frame for where to report the bug.</div><div><br></div><br><div class="gmail_quote"><div><div></div><div>On Sat, Oct 17, 2009 at 3:37 AM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><br><br><div class="gmail_quote"><div>On Fri, Oct 16, 2009 at 11:53 AM, Henry Huang <span dir="ltr"><<a href="mailto:red.rain.seven@gmail.com" target="_blank">red.rain.seven@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
So how would you trigger it from a script dialplan? The only time it seemed to work is when I did setVariable("api_after_bridge", "sched_api blah blah blah");<br>but then it gets executed after the channel's been teared down. I thought api_after_bridge means right after the call gets connected. <br>
<br>I need something to execute an api command right before or right after the call gets bridged. <br><br></blockquote></div><div>api_after_bridge is a channel variable, so using setVariable works just fine. If you need to sched_api is an API only. Check these out:<br>
<a href="http://wiki.freeswitch.org/wiki/Mod_commands#Misc._Commands" target="_blank">http://wiki.freeswitch.org/wiki/Mod_commands#Misc._Commands</a><br><br>So you need an API object in order to use it. I don't know the syntax for creating an api obj in Java but in Lua it goes like this:<br>
api = freeswitch.API();<br>res = api:execute("sched_api","+300 none my_api my_api_args")<br><br>Remember, if the method you are using isn't found in the dial plan tools then it isn't a dial plan application. Make sure it's on the list:<br>
<a href="http://wiki.freeswitch.org/wiki/Mod_dptools" target="_blank">http://wiki.freeswitch.org/wiki/Mod_dptools</a><br><br>On the other hand, API commands are listed here:<div><br><a href="http://wiki.freeswitch.org/wiki/Mod_commands" target="_blank">http://wiki.freeswitch.org/wiki/Mod_commands</a><br>
<br></div>dptools require a session object, api commands require an api object...<br><br>-MC<br></div></div><br>
<br></div></div><div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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></div></blockquote></div><div><br><br clear="all"><br>-- <br>Henry Huang<br>UniC Solution - Communication Unified<br>VoIP & Open Source software Consultant<br>
</div></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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></div></div>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
<a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">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>Henry Huang<br>UniC Solution - Communication Unified<br>VoIP & Open Source software Consultant<br>
</div>
</div></div><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>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>