[Freeswitch-users] Event socket: api vs. bgapi

Anthony Minessale anthony.minessale at gmail.com
Fri May 16 06:13:48 PDT 2008


when you do bgapi you actually have to subscribe to the background job event
to get the results.
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.

The bgapi returns a job-uuid that you need to save and use it to tie the
background_job event to the original request.

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.

Also to further complicate things, bgapi is an event socket command only so
it cannot be used from cli xml-rpc etc.
BUT, there is actually a *bgapi* FSAPI command you can execute to run any
FSAPI in the same fashion.

so raw event socket command
api bgapi show channels

is the same as raw event socket command

bgapi show channels

but, you can also say "bgapi show channels" from the cli/xml-rpc/dialplan
etc as well.


On Fri, May 16, 2008 at 1:08 AM, Michael Collins <mcollins at fcnetwork.com>
wrote:

>  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?
>
>
>
> -MC
>
>
>   ------------------------------
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Michael
> Collins
> *Sent:* Thursday, May 15, 2008 4:59 PM
> *To:* freeswitch-users at lists.freeswitch.org
> *Subject:* [Freeswitch-users] Event socket: api vs. bgapi
>
>
>
> Question:
>
>
>
> Are there compelling reasons **not** 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.
>
>
>
> Thanks,
>
> MC
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080516/3acd885a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list