[Freeswitch-dev] BACKGROUND_JOB event

Anthony Minessale anthony.minessale at gmail.com
Mon Apr 28 19:17:13 EDT 2008


it's not a serialized event. it's actually the output of the command in
question.

The correct way to deal with it is to subscribe to the BACKGROUND_JOB event
and
use the Job-UUID header to match the packet to the uuid given as a response
to the submission of the request.
When a match exists the body of that event will be the output generated by
the API call.


On Mon, Apr 28, 2008 at 5:45 PM, Juan Jose Comellas <juanjo at comellas.org>
wrote:

> Whenever a call to a command is made using bgapi, a BACKGROUND_JOB
> event is sent by FreeSWITCH when the command is completed. A
> BACKGROUND_JOB event looks like this:
>
> -------------- cut --------------
> Content-Length: 614
> Content-Type: text/event-plain
>
> Job-UUID: d19f2410-1548-11dd-9eeb-0d886880e312
> Job-Command: originate
> Job-Command-Arg: sofia/default/user2.comellas%40192.168.1.40%3A5061%202001
> Event-Name: BACKGROUND_JOB
> Core-UUID: f17f3284-1543-11dd-9eeb-0d886880e312
> FreeSWITCH-Hostname: comellas
> FreeSWITCH-IPv4: 192.168.1.38
> FreeSWITCH-IPv6: 127.0.0.1
> Event-Date-Local: 2008-04-28%2014%3A30%3A47
> Event-Date-GMT: Mon,%2028%20Apr%202008%2017%3A30%3A47%20GMT
> Event-Date-timestamp: 1209403847575107
> Event-Calling-File: mod_event_socket.c
> Event-Calling-Function: api_exec
> Event-Calling-Line-Number: 602
> Content-Length: 41
>
> +OK d19f45e4-1548-11dd-9eeb-0d886880e312
> -------------- cut --------------
>
> >From what MikeJ told me over IRC, the body of a BACKGROUND_JOB message
> is actually a serialized event containing the response to the original
> command. The problem is that the content-type of the message is the
> same as that used by any normal event. This makes it difficult to have
> a generic parser, because we have to analyze the body of the message
> to determine whether we are dealing with a normal event or a
> BACKGROUND_JOB. The other problem I see is that the body containing
> the serialized event does not have a content-type of its own.
>
> An example of a message with the above mentioned problems addressed
> could look like this:
>
> -------------- cut --------------
> Content-Length: 643
> Content-Type: text/background-response-wrapper-plain
>
> Job-UUID: d19f2410-1548-11dd-9eeb-0d886880e312
> Job-Command: originate
> Job-Command-Arg: sofia/default/user2.comellas%40192.168.1.40%3A5061%202001
> Event-Name: BACKGROUND_JOB
> Core-UUID: f17f3284-1543-11dd-9eeb-0d886880e312
> FreeSWITCH-Hostname: comellas
> FreeSWITCH-IPv4: 192.168.1.38
> FreeSWITCH-IPv6: 127.0.0.1
> Event-Date-Local: 2008-04-28%2014%3A30%3A47
> Event-Date-GMT: Mon,%2028%20Apr%202008%2017%3A30%3A47%20GMT
> Event-Date-timestamp: 1209403847575107
> Event-Calling-File: mod_event_socket.c
> Event-Calling-Function: api_exec
> Event-Calling-Line-Number: 602
> Content-Type: api/background-response
> Content-Length: 41
>
> +OK d19f45e4-1548-11dd-9eeb-0d886880e312
> -------------- cut --------------
>
> What do you think? Is a change similar to what I propose feasible?
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> 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-dev/attachments/20080428/71d45c33/attachment.html 


More information about the Freeswitch-dev mailing list