<html><body bgcolor="#FFFFFF"><div>Thanks. I'll get this on the wiki right away. Clarification questions: does one need to subscribe to the background job just once per session in order to receive all subsequent bgapi events? Also, is it the case that subscribing to "events plain all" does not include bgapi events? I'm testing and it looks like that's the case but I want to confirm.</div><div><br class="webkit-block-placeholder"></div><div>Thanks,</div><div>MC<br><br>Sent from my iPhone</div><div><br>On May 16, 2008, at 6:13 AM, "Anthony Minessale" <<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>when you do bgapi you actually have to subscribe to the background job event to get the results.<br>Since it's an async operation, the command is executed in it's own thread and when the results are collected they are put in the event's body.<br>
<br>The bgapi returns a job-uuid that you need to save and use it to tie the background_job event to the original request.<br><br>The decision to use api vs bgapi is weather or not you want to get the results right away or not. So usually show channels etc is a case where you want to do it in the foreground.<br>
<br>Also to further complicate things, bgapi is an event socket command only so it cannot be used from cli xml-rpc etc.<br>BUT, there is actually a *bgapi* FSAPI command you can execute to run any FSAPI in the same fashion.<br>
<br>so raw event socket command<br>api bgapi show channels<br><br>is the same as raw event socket command<br><br>bgapi show channels<br><br>but, you can also say "bgapi show channels" from the cli/xml-rpc/dialplan etc as well.<br>
<br><br><div class="gmail_quote">On Fri, May 16, 2008 at 1:08 AM, Michael Collins <<a href="mailto:mcollins@fcnetwork.com"><a href="mailto:mcollins@fcnetwork.com">mcollins@fcnetwork.com</a></a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Followup question: I can use api to send "show
channels" or "oz list" but when I use bgapi to send those
commands I don't get anything back from the event socket. Any
thoughts?</span></font></p>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">-MC</span></font></p>
<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">
<div>
<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">
<hr align="center" size="2" width="100%">
</span></font></div>
<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></a>
[mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Michael
Collins<br>
<b><span style="font-weight: bold;">Sent:</span></b> Thursday, May 15, 2008 4:59
PM<br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a></a><br>
<b><span style="font-weight: bold;">Subject:</span></b> [Freeswitch-users] Event
socket: api vs. bgapi</span></font></p>
</div><div><div></div><div class="Wj3C7c">
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Question:</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Are there compelling reasons *<b><span style="font-weight: bold;">not</span></b>* to use api for simple commands like "show
channels" or "oz list"? Since api is blocking and bgapi
is non-blocking I just wondered if there are recommendations for when to use
each one. I can definitely see why you'd use bgapi for an
"originate" command. I didn't see anything on the wiki
that discussed when to use api vs. bgapi so I'll be happy to write up a
blurb on the recommended use of each one.</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks,</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">MC</span></font></p>
</div></div></div>
</div>
</div>
<br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
<a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/"><a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a></a><br>ClueCon <a href="http://www.cluecon.com/"><a href="http://www.cluecon.com/">http://www.cluecon.com/</a></a><br>
<br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:<a href="mailto:anthony_minessale@hotmail.com">anthony_minessale@hotmail.com</a></a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a></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:<a href="mailto:888@conference.freeswitch.org">888@conference.freeswitch.org</a></a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:<a href="mailto:guest@conference.freeswitch.org">guest@conference.freeswitch.org</a>/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:<a href="mailto:conf+888@conference.freeswitch.org">conf+888@conference.freeswitch.org</a></a><br>pstn:213-799-1400
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Freeswitch-users mailing list</span><br><span><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></span><br><span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br><span>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a></span><br><span><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br></div></blockquote></body></html>