FSModEvent.Erlang

Interface to mod_erlang_event.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event

Copyright 2015 Marcelo Gornstein marcelog@gmail.com

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Source

Summary

api(node, command, args \\ "")

Runs an API command in foreground

bgapi(node, command, args \\ "", timeout \\ 5000)

Runs an API command in background. Returns a job id. The caller process will receive a message with a tuple like this {:fs_job_result, job_id, status, result}

config_bind(node, type)

Binds the caller process as a configuration provider for the given configuration section. The sections are the same as for mod_xml_curl, see: https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl

config_reply(node, fetch_id, xml)

Sends an XML in response to a configuration message (see config_bind). The XML should be the same as the one supported by mod_xml_curl, see: https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl

event(node, event, value \\ nil)

Subscribe to an event

exit(node)

Closes the connection

handlecall(node, uuid, process \\ nil)

Makes FreeSWITCH send all the events related to the given call uuid to the given regitered process name (or the caller process, if none is given)

nixevent(node, event, value \\ nil)

Unsubscribes from an event

noevents(node)

Disable all events

nolog(node)

Disables logging

pid(node)

Returns the fake pid of the “erlang process” running in the freeswitch erlang node

register_event_handler(node)

Registers the caller process as an event handler. Will receive all events as messages

register_log_handler(node)

Registers the caller process as a log handler. Will receive all logs as messages

sendevent(node, event, headers)

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendevent

sendmsg_exec(name, uuid, command, args \\ "", loops \\ 1)

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

sendmsg_hangup(name, uuid, cause \\ 16)

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

sendmsg_nomedia(node, uuid, info \\ "")

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

sendmsg_unicast(name, uuid, transport \\ "tcp", flags \\ "native", local_ip \\ "127.0.0.1", local_port \\ 8025, remote_ip \\ "127.0.0.1", remote_port \\ 8026)

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

set_log_level(node, level)

Changes the log level

Functions

api(node, command, args \\ "")

Specs:

Runs an API command in foreground.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-api

Source
bgapi(node, command, args \\ "", timeout \\ 5000)

Runs an API command in background. Returns a job id. The caller process will receive a message with a tuple like this {:fs_job_result, job_id, status, result}

Where:

job_id :: String.t status :: :ok | :error result :: :timeout | String.t

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-bgapi

Source
config_bind(node, type)

Specs:

  • config_bind(node, String.t) :: :ok | no_return

Binds the caller process as a configuration provider for the given configuration section. The sections are the same as for mod_xml_curl, see: https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl.

You will receive messages of the type:

{fetch,

, , , , , }

Where FetchID is the ID you received in the request and XMLString is the XML reply you want to send. FetchID and XML can be binaries or strings.

To tell the switch to take some action, send back a reply of the format: {fetch_reply, , }

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-XMLsearchbindings

Source
config_reply(node, fetch_id, xml)

Specs:

Sends an XML in response to a configuration message (see config_bind). The XML should be the same as the one supported by mod_xml_curl, see: https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-XMLsearchbindings

Source
event(node, event, value \\ nil)

Specs:

Subscribe to an event.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-event

Source
exit(node)

Specs:

  • exit(node) :: :ok | no_return

Closes the connection.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-exit

Source
handlecall(node, uuid, process \\ nil)

Specs:

  • handlecall(node, String.t, atom) :: :ok | no_return

Makes FreeSWITCH send all the events related to the given call uuid to the given regitered process name (or the caller process, if none is given).

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-handlecall

Source
nixevent(node, event, value \\ nil)

Specs:

Unsubscribes from an event.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-nixevent

Source
noevents(node)

Specs:

  • noevents(atom) :: pid | no_return

Disable all events.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-noevents

Source
nolog(node)

Specs:

  • nolog(node) :: :ok | no_return

Disables logging.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-nolog

Source
pid(node)

Specs:

  • pid(atom) :: pid | no_return

Returns the fake pid of the “erlang process” running in the freeswitch erlang node.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-getpid

Source
register_event_handler(node)

Specs:

  • register_event_handler(node) :: :ok | no_return

Registers the caller process as an event handler. Will receive all events as messages.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-register_event_handler

Source
register_log_handler(node)

Specs:

  • register_log_handler(node) :: :ok | no_return

Registers the caller process as a log handler. Will receive all logs as messages.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-register_log_handler

Source
sendevent(node, event, headers)

Specs:

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendevent

Source
sendmsg_exec(name, uuid, command, args \\ "", loops \\ 1)

Specs:

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

Source
sendmsg_hangup(name, uuid, cause \\ 16)

Specs:

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

Source
sendmsg_nomedia(node, uuid, info \\ "")

Specs:

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

Source
sendmsg_unicast(name, uuid, transport \\ "tcp", flags \\ "native", local_ip \\ "127.0.0.1", local_port \\ 8025, remote_ip \\ "127.0.0.1", remote_port \\ 8026)

Specs:

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-sendmsg

Source
set_log_level(node, level)

Specs:

  • set_log_level(node, String.t) :: :ok | no_return

Changes the log level.

See: https://freeswitch.org/confluence/display/FREESWITCH/mod_erlang_event#mod_erlang_event-set_log_level

Source