[Freeswitch-users] Matching CHANNEL_CREATE event to previous originate command
Michael Collins
msc at freeswitch.org
Tue Jun 22 10:58:34 PDT 2010
Actually, you need to subscribe to BACKGROUND_JOB events so that you can
match up the uuid of the call leg with the Job-UUID. Here is a copy and
paste from an actual session I just did, with what I typed in bold:
<291>:*telnet localhost 8021*
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Content-Type: auth/request
auth ClueCon
Content-Type: command/reply
Reply-Text: +OK accepted
*event plain BACKGROUND_JOB*
Content-Type: command/reply
Reply-Text: +OK event listener enabled plain
*bgapi originate user/1001 &park()*
Content-Type: command/reply
Reply-Text: +OK Job-UUID: d601515b-e986-4d56-90f4-101f1a3c279f
Job-UUID: d601515b-e986-4d56-90f4-101f1a3c279f
Content-Length: 581
Content-Type: text/event-plain
Event-Name: BACKGROUND_JOB
Core-UUID: 4a408781-c3ec-4cdd-a8e0-ad13915711ba
FreeSWITCH-Hostname: freeswitch1.yt
FreeSWITCH-IPv4: 10.15.0.91
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2010-06-22%2010%3A51%3A50
Event-Date-GMT: Tue,%2022%20Jun%202010%2017%3A51%3A50%20GMT
Event-Date-Timestamp: 1277229110556854
Event-Calling-File: mod_event_socket.c
Event-Calling-Function: api_exec
Event-Calling-Line-Number: 1374
Job-UUID: d601515b-e986-4d56-90f4-101f1a3c279f
Job-Command: originate
Job-Command-Arg: user/1001%20%26park()
Content-Length: 41
+OK b5d8310a-1085-4ea5-8927-398e9eee0c39
Notice that the Job-UUID that you got in response to the bgapi command
corresponds with the Job-UUID of the BACKGROUND_JOB event. The information
you want, which is the result of the originate command, is found at the end
of the event after "Content-Length" header. In this case the originate was
successful ("+OK") and the call leg's UUID is b5d8310a...
Have fun!
-MC
2010/6/19 Roland Hänel <roland at haenel.me>
> Hello everyone,
>
> I'm using mod_event_socket in inbound mode to 'remote control' a FreeSwitch
> instance. I'm using the raw TCP interface (not any of the available language
> bindings). My problem now is, if I do a command like
>
> bgapi originate sofia/gateway/mygw/0123456789 &park
>
> and try to match the channel which is created by this command to the
> command itself, this seems to be very difficult. I cannot do it on timing
> only, because many channels may be created in a very short time and the
> order of originate-CHANNEL_CREATE will probably not be consistent.
>
> Is there any 'best practice' how to solve this problem?
>
> One solution seems to be to set {origination_uuid=x-y-z-k} in the originate
> section, but this does not reliably work with failover routing (for example,
> if I specify two gateways and the call gets rejected on the first and then
> originated on the second, the origination_uuid will not be the same any
> more).
>
> Greetings,
> Roland
>
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100622/5e7d5eae/attachment.html
More information about the FreeSWITCH-users
mailing list