Skip to content

Commit 2ec77d2

Browse files
committed
Merge pull request huffman#10 from hypernumbers/master
Minor bug
2 parents 4efb886 + 8ea1c28 commit 2ec77d2

File tree

6 files changed

+636
-520
lines changed

6 files changed

+636
-520
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ called State is "Edinburgh"
161161
(...)
162162
163163
```
164-
**NOTE** This work is not complete. the various Twilio parameters are being implemented gradually. Paramaters not currently handled are returned as a list in the field `#twilio.custom_params`. If you see parameters in that field consider adding clauses to the function `twilio_web_util:make_r/7` and adding information to the records in `twilio_web.hrl`.
164+
**NOTE** This work is not complete. the various Twilio parameters are being implemented gradually. Parameters not currently handled are returned as a list in the field `#twilio.custom_params`. If you see parameters in that field consider adding clauses to the function `twilio_web_util:make_r/7` and adding information to the records in `twilio_web.hrl`.
165165
166166
Why Extended TwiML?
167167
===================
@@ -302,7 +302,7 @@ The signature of the external function is very straightforward:
302302

303303
```erlang
304304
external_function(_State) ->
305-
{random(), [], {Type, Fun/2}.
305+
{#twiml{}, [{Type, Fun/2}]}.
306306
```
307307

308308
where Type is one of the following atoms:
@@ -330,6 +330,14 @@ There are a number of steps to be gone through before using Extended TwiML:
330330
* Extended TwiML is commented out in ``twilio_web.hrl``- you will need to uncomment it
331331
* NOTE Extended TwiML (mostly) avoids you needing to build State Machines in URLs - with one exception. There is a ``#goto_EXT{}`` record which forces a goto on to Twilio - it tells Twilio to ask for a particular state of the FSM. If you have bound your application to ``http://example.com/some/page`` all the POST's will come to it - with the exception of GOTO's. If there is a record ``#goto_EXT{goto = "1.2.3"}`` the next twilio request will be to ``http://example.com/some/page/1.2.3`` The example in ``twilio_ext.hrl`` is set up for Twilio being bound to the root (ie ``http://example.com/``). It you bind it elsewhere you will need to handle those paths yourself.
332332

333+
### Phonecall_srv.erl
334+
335+
The phone call supervision tree has a phonecall supervisor which spawns a process for all phone calls. This behaves slightly differently for inbound and outbound phone calls.
336+
337+
Inbound phone numbers **MUST** be set up with the callback status URL enabled in Twilio. This means that when a call is completed the application is notified by Twilio and the phonecall_srv can be sent a ``call complete`` message to terminate itself and clean up.
338+
339+
Outbound calls **DO NOT** receive a ``call complete`` or ``recording`` message and must clean up after themselves. An outbound call receives allready 'knows' the URL of its recording - so the simplest way to clean up after an outbound call is just to do a ``call complete`` call on it immediately after serving up the TwiML that makes the call.
340+
333341
### Developers' Notes
334342

335343
Extended TwiML has the following api:
@@ -340,6 +348,16 @@ Extended TwiML has the following api:
340348
* ``twiml:compile/1`` takes a list of TwiML records and compiles them to the FSM
341349
* ``twiml:compile/2`` takes a list of TwiML records and a atom which describes the compilation target - can be one of ``html``, ``ascii`` or ``fsm``
342350

351+
## Other Material
352+
353+
Slides of a talk about Extended Twiml at the Erlang User Conference 2012:
354+
355+
http://www.docstoc.com/docs/document-preview.aspx?doc_id=128095466
356+
357+
Presentation at TechMeetup in Glasgow:
358+
359+
http://vimeo.com/47162182
360+
343361
License
344362
=======
345363

include/phonecall_srv.hrl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%% the state record of the phonecall_srv
2+
-record(pc_state, {twiml_ext = null, initial_params = null, log = null, fsm = null,
3+
currentstate = "1", history = [], eventcallbacks = []}).

0 commit comments

Comments
 (0)