Erlang Receive from FreeSWITCH mod_erlang_event
I see by the Wiki, that if the Erlang application wants to receive any events from FreeSWITCH, it must provide a single receiver for all events. It would then have to distribute the events. However, the situation does not seem to be obvious for receiving responses to API requests. If Erlang Process A makes API call C1 and Process B also makes API call C2. Will the response to C1 be sent to the receive entry for Process A and the response to C2 be sent to the receive entry for process B? Regards, Paul David Swardstrom
it has inbound and outbound mode just as in event_socket For inbound, means an erlang process must connect to freeswitch and register events it want to receive For outbound, it also has two way to receive events 1) You start a process in erlang and route the call to that process in dialplan <action application="erlang" data="myhandler mynode@myserver"/> 2) freeswitch can start a process using rpc:call for each call <action application="erlang" data="myhandler:launch mynode@myserver"/> Sure there's another way to tell freeswitch to find an erlang process, check the wiki for detail: <action application="erlang" data="myhandler:! mynode@server"/> In outbound mode, only events happend on the specified channel( the same UUID) will send to erlang. But it will send ALL events with that UUID. To be clear: 1) Inbound, freeswitch send all events matching event-type you registered, say channel::hangup 2) Outbound, freeswitch send all events related to a channel which you routed to erlang, all events have the same UUID. You can send multi-channel to one erlang process in outbound mode, say you may want one erlang process to handle both the a-leg and b-leg. 2010/7/13 David Swardstrom <dswardstrom@remotelink.com>:
I see by the Wiki, that if the Erlang application wants to receive any events from FreeSWITCH, it must provide a single receiver for all events. It would then have to distribute the events.
However, the situation does not seem to be obvious for receiving responses to API requests.
If Erlang Process A makes API call C1 and Process B also makes API call C2. Will the response to C1 be sent to the receive entry for Process A and the response to C2 be sent to the receive entry for process B?
API call can get API respond from freeswitch(either ok or other fails message) but has nothing to do with events.
Regards, Paul David Swardstrom
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Blog: http://www.dujinfang.com Proj: http://www.freeswitch.org.cn
On Mon, Jul 12, 2010 at 04:53:03PM -0500, David Swardstrom wrote:
I see by the Wiki, that if the Erlang application wants to receive any events from FreeSWITCH, it must provide a single receiver for all events. It would then have to distribute the events.
However, the situation does not seem to be obvious for receiving responses to API requests.
If Erlang Process A makes API call C1 and Process B also makes API call C2. Will the response to C1 be sent to the receive entry for Process A and the response to C2 be sent to the receive entry for process B?
Yes, the module sends the API or bgAPI response to the pid which executed the request. This is unrelated to how events are handled (although I've considered allowing multiple event receivers). Andrew
participants (3)
-
Andrew Thompson
-
David Swardstrom
-
Seven Du