SwitchX.Event (SwitchX v1.0.1)

View Source

Summary

Functions

Dumps a SwitchX.Event into a string URI encoded

Callback implementation for Access.fetch/2.

Updates a SwitchX.Event with another event message and body, see Map.merge/2

Create a Event from a plain message from freeswitch,

Given a SwichX.Event.Headers and a body string create a new Event

Callback implementation for Access.pop/2.

Functions

dump(event)

@spec dump(event :: SwitchX.Event) :: event_string :: String

Dumps a SwitchX.Event into a string URI encoded

Returns

  event_string

Example

iex> SwitchX.Event.new(SwitchX.Event.Headers.new(%{foo: "bar 53"}), "body")
     |> SwitchX.Event.dump()

"foo: bar%2053

body"

fetch(body, key)

Callback implementation for Access.fetch/2.

get(body, key, default)

get_and_update(body, key, fun)

Callback implementation for Access.get_and_update/3.

merge(event, new)

@spec merge(event :: SwitchX.Event, new :: SwitchX.Event) :: SwitchX.Event

Updates a SwitchX.Event with another event message and body, see Map.merge/2

new()

@spec new() :: SwitchX.Event

new(message)

@spec new(message :: String) :: SwitchX.Event
@spec new(headers :: SwitchX.Event.Header) :: SwitchX.Event

Create a Event from a plain message from freeswitch,

new(headers, body)

@spec new(headers :: SwitchX.Event.Header, body :: String) :: SwitchX.Event

Given a SwichX.Event.Headers and a body string create a new Event

pop(body, key)

Callback implementation for Access.pop/2.