Jump to content
KAZOOcon: hackathon signup and details here! ×

Create a call flow manually, but route to the call flow programatically


Paul M

Recommended Posts

In my use case, I want to create a number of call flows manually. When an incoming call is received, I will check the phone number against a database and then based on the state of the number in the database, I want to route to one of the flows that were created. 

Is this approach possible? If so, how should the flows be created in the UI? Is the Pivot callflow the best option to handle the programmable portion? 

Link to comment
Share on other sites

You can do this with Pivot and Preflow. We've done this in a lot of different ways, mostly using PHP scripts.
First, create the callflows you want to route the calls to, then check in Futon / CouchDB for the Callflow ID's. (however this might be possible to integrate directly into the PHP script instead of making different pre-defined callflows).
Then create a callflow with a Pivot request, pointing to the PHP script.
The PHP script then can route the call to the correct Callflow ID, it just has to return '{"module":"callflow","data":{"id":"<callflow_id>"}}'

To make the Pivot script run every time a call is being connected in you can select that as Preflow in the Callflow app -> Account Settings -> Misc -> Preflow.

Example Pivot callflow below:
image.png.843ba929107574f2e0489bb5a3d8ee82.png

Example PHP script:

<?php
header("content-type: application/json");
$nextcallflow="0219483204983";
die ('{"module":"callflow","data":{"id":"'.$nextcallflow.'"}}');

 

Edited by tomas_ (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...