<br><br><div class="gmail_quote">On Fri, Oct 16, 2009 at 11:53 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;">
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>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">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">http://wiki.freeswitch.org/wiki/Mod_dptools</a><br><br>On the other hand, API commands are listed here:<br><a href="http://wiki.freeswitch.org/wiki/Mod_commands">http://wiki.freeswitch.org/wiki/Mod_commands</a><br>
<br>dptools require a session object, api commands require an api object...<br><br>-MC<br></div></div><br>