Telephonist.CallProcessor
Allows you to progress a call through a Telephonist.StateMachine
. See process/3
for more details.
For more information on how to design a compatible state machine, see the docs on Telephonist.StateMachine
.
Summary↑
process(machine, twilio, options \\ %{}) | Process a call with a given default |
Functions
Specs:
- process(atom, %{}, %{}) :: Telephonist.State.t
Process a call with a given default Telephonist.StateMachine
. Returns a new Telephonist.State
for the call. This state includes the correct TwiML for the current state of the call, so that you can render it back to Twilio.
Parameters
machine
: TheTelephonist.StateMachine
to use. This is used as a starting point if the call has not been seen before.twilio
: Amap
of all the Twilio request parameters that were given for the call. This will be forwarded to the StateMachine.options
: An optionalmap
of custom options that you want to pass along to the StateMachine. For example, this could include information like user data, or URLs to use for call redirection or recording handling.
Examples
# The web framework used here is pseudo-code
def index(conn, twilio) do
state = Telephonist.CallProcessor.process(StateMachine, twilio)
render conn, xml: state.twiml
end