First Pivot Script:
<?php header('content-type:application/json'); ?> { "module":"tts", "data":{ "text": "Please select your Provider and CallerID", "engine": "flite" }, "children": { "_": { "module": "collect_dtmf", "data": { "max_digits": 3, "collection_name": "custom_name" }, "children": { "_": { "module": "pivot", "data": { "voice_url": "http://portal.example.com/pivot/resource-cid-select.php" }, "children": {} } } } } }
Second Pivot Script:
<?php function signalwire($digitspl) { $signalwire = array("1631XXXXXXX", "1786XXXXXXX", "+1929XXXXXXX", "1848XXXXXXX", "1716XXXXXXX"); $calleeid = '+' . $_REQUEST['To']; header('content-type:application/json'); ?> { "module": "dynamic_cid", "data": { "action": "static", "caller_id" : { "name": "<?= $signalwire[$digitspl]; ?>", "number": "<?= $signalwire[$digitspl]; ?>" } }, "children": { "_": { "module":"resources", "data": { "use_local_resources": false , "outbound_flags": [ "signalwire" ], "to_did": "<?= $calleeid ?>" }, "children": {} } } } <?php } function bulkvs($digitspl) { $bulkvs = array("1929XXXXXXX", "+1561XXXXXXX", "1786XXXXXXX", "1862XXXXXXXX"); header('content-type:application/json'); ?> { "module": "dynamic_cid", "data": { "action": "static", "caller_id" : { "name": "<?= $bulkvs[$digitspl]; ?>", "number": "<?= $bulkvs[$digitspl]; ?>" } }, "children": { "_": { "module":"resources", "data": { "use_local_resources": false , "outbound_flags": ["bulkvs"], "to_did": "<?= $calleeid ; ?>" }, "children": {} } } } <?php } $digitsel = $_REQUEST['Digits']; $digitspl = $digitsel['custom_name']; if($digitspl['0'] === '1' ){ signalwire($digitspl['1']); } elseif($digitspl['0'] === '2') { bulkvs($digitspl['1']) ; } else { $calleeid = '+' . $_REQUEST['To']; header('content-type:application/json'); ?> { "module":"resources", "data": { "use_local_resources": false , "to_did": "<?= $digitspl ?>" }, "children": {} } } <?php }
These pivot scripts can help as a quick method. For example, if you dial 12, it would choose the assigned provider as first digit and the third callerid as the second one.
First digit:
> 1. 'Signalwire' <
2. Bulkvs
Second digit:
1. 1631XXXXXXX
2. 1786XXXXXXX
> 3. '1929XXXXXXX' <