当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::addDial方法代码示例

本文整理汇总了PHP中Response::addDial方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::addDial方法的具体用法?PHP Response::addDial怎么用?PHP Response::addDial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response::addDial方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initcall

function initcall()
{
    if ($_REQUEST["CallStatus"] == "completed") {
        // receives request from Twilio server when a call ends
        // remove call from active calls
        // saves call info in DB as current call
        $callGuid = $_REQUEST["CallGuid"];
        $db = new PDO("sqlite:twilio.db");
        $query = "UPDATE Calls SET Status = 'ended' WHERE CallGuid = '{$callGuid}'";
        $db->exec($query);
    } else {
        // dial all saved numbers for your account
        $numbers = getNumbersToCall();
        // get numbers
        $r = new Response();
        for ($i = 0; $i < count($numbers); $i++) {
            $r->addDial($numbers[$i]);
        }
        $r->Respond();
        // saves call info in DB as current call
        $callGuid = $_REQUEST["CallGuid"];
        $caller = $_REQUEST["Caller"];
        $callLocation = $_REQUEST["CallerCity"] != "" ? $_REQUEST["CallerCity"] : ($_REQUEST["CallerState"] != "" ? $_REQUEST["CallerState"] : ($_REQUEST["CallerZip"] != "" ? $_REQUEST["CallerZip"] : ($_REQUEST["CallerCountry"] != "" ? $_REQUEST["CallerCountry"] : "")));
        $db = new PDO("sqlite:twilio.db");
        $query = "INSERT INTO Calls (CallGuid, Caller, Location, Status) VALUES ('{$callGuid}', '{$caller}', '{$callLocation}', 'active')";
        $db->exec($query);
    }
}
开发者ID:Timothee,项目名称:Notwilfications,代码行数:28,代码来源:index.php

示例2: connect

 function connect($number, $ext)
 {
     header('X-WP-Click2Call: ' . WP_CLICK2CALL_VERSION);
     $twilio = new Response();
     $greeting = get_option('wpc2c_custom_greeting');
     if (!empty($greeting)) {
         $twilio->addSay($greeting);
     }
     $dial = $twilio->addDial();
     $dial_options = array();
     if (!empty($ext)) {
         $dial_options = array('sendDigits' => $ext);
     }
     $dial->addNumber($number, $dial_options);
     $twilio->Respond();
 }
开发者ID:Clutterbug,项目名称:Tortie,代码行数:16,代码来源:wp-click2call.php

示例3: Response

<?php

require_once "./plivo.php";
// Feth the from_number from the URL
$from_numbr = $_REQUEST['From'];
$r = new Response();
// Add Dial tag
$params = array('callerId' => $from_numbr);
$d = $r->addDial($params);
$number = "2222222222";
$d->addNumber($number);
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Output
<Response>
    <Dial callerId="1111111111">
        <Number>2222222222</Number>
    </Dial>
</Response>
*/
开发者ID:pontocertosms,项目名称:php_examples,代码行数:21,代码来源:forward_calls.php

示例4: switch

        default:
            break;
    }
}
// This loop exists only so that we can quickly make state transitions by
// setting a new DIAL_ACTION and jumping to the top of the loop.
$keepLooping = true;
while ($keepLooping) {
    // By default we'll only go once through the loop.
    $keepLooping = false;
    switch ($state[DIAL_ACTION]) {
        case DIAL_STATE_DIAL:
            error_log('numbers left to try');
            if ($state[DIAL_NUMBER_INDEX] < count($numbers)) {
                // There are still more numbers left to try
                $dial = $response->addDial(array('action' => current_url()));
                if ($dial_whom_selector === 'user-or-group') {
                    $name = null;
                    if ($dial_whom_user_or_group instanceof VBX_User) {
                        $name = $dial_whom_user_or_group->first_name . " " . $dial_whom_user_or_group->last_name;
                    } else {
                        if ($dial_whom_user_or_group instanceof VBX_Group) {
                            $name = $dial_whom_user_or_group->name;
                        } else {
                            // In practice, this should never ever happen.
                            $name = "Unknown";
                        }
                    }
                    $dial->addNumber($numbers[$state[DIAL_NUMBER_INDEX]], array('url' => site_url('twiml/whisper?name=' . urlencode($name))));
                } else {
                    // If we're just dialing an arbitrary number, we don't announce anything about
开发者ID:benrasmusen,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例5: switch

    }
}
// This loop exists only so that we can quickly make state transitions by
// setting a new DIAL_ACTION and jumping to the top of the loop.
$keepLooping = true;
while ($keepLooping) {
    // By default we'll only go once through the loop.
    $keepLooping = false;
    error_log(var_export($state, true));
    error_log($state[DIAL_ACTION]);
    switch ($state[DIAL_ACTION]) {
        case DIAL_STATE_DIAL:
            error_log('numbers left to try');
            if ($state[DIAL_NUMBER_INDEX] < count($numbers)) {
                // There are still more numbers left to try
                $dial = $response->addDial();
                if ($dial_whom_selector === 'user-or-group') {
                    $name = null;
                    if ($dial_whom_user_or_group instanceof VBX_User) {
                        $name = $dial_whom_user_or_group->first_name . " " . $dial_whom_user_or_group->last_name;
                    } else {
                        if ($dial_whom_user_or_group instanceof VBX_Group) {
                            $name = $dial_whom_user_or_group->name;
                        } else {
                            // In practice, this should never ever happen.
                            $name = "Unknown";
                        }
                    }
                    $dial->addNumber($numbers[$state[DIAL_NUMBER_INDEX]], array('url' => site_url('twiml/whisper?name=' . urlencode($name))));
                } else {
                    // If we're just dialing an arbitrary number, we don't announce anything about
开发者ID:howethomas,项目名称:OpenVBX,代码行数:31,代码来源:twiml.php

示例6: elseif

    }
    if ($cname) {
        $dial_params['callerName'] = $cname;
    }
    if (substr($dst, 0, 4) == "sip:") {
        $is_sip_user = TRUE;
    } else {
        $is_sip_user = FALSE;
    }
    if ($is_sip_user and in_array($disable_call, array("all", "sip"))) {
        $r->addHangup(array("reason" => "busy"));
    } elseif (!$is_sip_user and in_array($disable_call, array("all", "number"))) {
        $r->addHangup(array("reason" => "busy"));
    } else {
        if ($dial_music) {
            $dial_params["dialMusic"] = $dial_music;
            $d = $r->addDial($dial_params);
        } else {
            $d = $r->addDial($dial_params);
        }
        if ($is_sip_user) {
            $d->addUser($dst);
        } else {
            $d->addNumber($dst);
        }
    }
} else {
    $r->addHangup();
}
header("Content-Type: text/xml");
echo $r->toXML();
开发者ID:jeanfrancis,项目名称:jeanfrancis.github.io,代码行数:31,代码来源:plivo_directdial.php

示例7: Response

<?php

require 'plivo.php';
$dst = $_REQUEST['To'];
$src = $_REQUEST['CLID'];
if (!$src) {
    $src = $_REQUEST['From'];
}
$cname = $_REQUEST['CallerName'];
$response = new Response();
if ($dst) {
    $dial_params = array();
    if ($src) {
        $dial_params['callerId'] = $src;
    }
    if ($cname) {
        $dial_params['callerName'] = $cname;
    }
    $dial = $response->addDial($dial_params);
    if (substr($dst, 0, 4) == "sip:") {
        $dial->addUser($dst);
    } else {
        $dial->addNumber($dst);
    }
} else {
    $response->addHangup();
}
header("Content-Type: text/xml");
echo $response->toXML();
开发者ID:davidangelcb,项目名称:voice,代码行数:29,代码来源:plivo_directdial.php

示例8: Response

<?php

require_once 'plivo.php';
$r = new Response();
$d = $r->addDial(array("callerId" => "2XXXXXXX"));
$d->addNumber('1XXXXXXX');
echo $r->toXML();
// Output:
// <Response>
// <Dial callerId="2XXXXXXX">
// <Number>1XXXXXXX</Number>
// </Dial>
// </Response>
?>

开发者ID:davidangelcb,项目名称:voice,代码行数:14,代码来源:plivo_dial_xml.php

示例9: testDialConvience

 public function testDialConvience()
 {
     $r = new Response();
     $r->addDial();
     $expected = '<Response><Dial></Dial></Response>';
     $this->assertXmlStringEqualsXmlString($expected, $r->asUrl(False));
 }
开发者ID:hellobhanu,项目名称:TxtConnect,代码行数:7,代码来源:test_twiml.php

示例10: dirname

<?php

// Include the PHP Plivo Rest library
require "./plivohelper.php";
$base_http = "http://" . dirname($_SERVER["SERVER_NAME"] . $_SERVER["PHP_SELF"]);
/* Render RESTXML */
$r = new Response();
if (isset($_POST['HangupCause']) && isset($_POST['RingStatus'])) {
    $hangup_cause = $_POST['HangupCause'];
    $ring_status = $_POST['RingStatus'];
    $r->addSpeak("Dial Hangup Cause is " . $hangup_cause);
    $r->addSpeak("Dial Ring Status is " . $ring_status);
    $r->addSpeak("Dial Ended");
} else {
    $r->addSpeak("Dial Test");
    $d = $r->addDial(array('action' => $base_http . "/answered.php", 'timeLimit' => 60, 'hangupOnStar' => 'true'));
    $d->addNumber("4871", array('gateways' => "sofia/gateway/pstn", 'gatewayTimeouts' => 30));
    $d->addNumber("1749", array('gateways' => "sofia/gateway/pstn", 'gatewayTimeouts' => 30));
}
$r->Respond();
开发者ID:muthukumaroptisol,项目名称:plivohelper-php,代码行数:20,代码来源:dial.php

示例11: connect

 function connect($number)
 {
     $twilio = new Response();
     $twilio->addDial($number);
     $twilio->Respond();
 }
开发者ID:nmani,项目名称:wp-click2call,代码行数:6,代码来源:wp-click2call.php

示例12: Response

$r = new Response();
$r->append(new Say("Hello World", array("voice" => "man", "language" => "fr", "loop" => "10")));
$r->append(new Dial("4155551212", array("timeLimit" => "45")));
$r->append(new Play("http://www.mp3.com"));
$r->Respond();
/* outputs:
   <Response>
       <Say voice="man" language="fr" loop="10">Hello World</Say>
       <Play>http://www.mp3.com</Play>
       <Dial timeLimit="45">4155551212</Dial>
   </Response>
   */
// The same XML can be created above using the convencience methods
$r = new Response();
$r->addSay("Hello World", array("voice" => "man", "language" => "fr", "loop" => "10"));
$r->addDial("4155551212", array("timeLimit" => "45"));
$r->addPlay("http://www.mp3.com");
//$r->Respond();
// ========================================================================
// Gather, Redirect
$r = new Response();
$g = $r->append(new Gather(array("numDigits" => "1")));
$g->append(new Say("Press 1"));
$r->append(new Redirect());
//$r->Respond();
/* outputs:
   <Response>
   	<Gather numDigits="1">
   		<Say>Press 1</Say>
   	</Gather>
   	<Redirect/>
开发者ID:hellobhanu,项目名称:TxtConnect,代码行数:31,代码来源:example_twiml.php

示例13: Response

$r->addRedirect($redirect);
Header('Content-type: text/xml');
echo $r->toXML();
?>

<!--connect.php-->

<?php 
require_once "./plivo.php";
$r = new Response();
// Add Speak tag
$body = "Connecting your call..";
$attributes = array('action' => "https://example.com/dial_status.php", 'method' => "GET", 'redirect' => "true");
$r->addSpeak($body);
// Add Dial tag
$d = $r->addDial($attributes);
$number = "11111111111";
$d->addNumber($number);
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Output
<Response>
    <Speak>Please wait while your call is being transferred</Speak>
    <Redirect>
        https://glacial-harbor-8656.herokuapp.com/testing.php/connect
    </Redirect>
</Response>

<Response>
    <Speak>Connecting your call..</Speak>
开发者ID:pontocertosms,项目名称:php_examples,代码行数:31,代码来源:call_transfer.php

示例14:

     $collectInput->setTermChar('#');
     $r->addCollectDtmf($collectInput);
     $_SESSION['next_goto'] = 'Menu1_CheckInput1';
 } else {
     if ($_REQUEST['event'] == 'GotDTMF' && $_SESSION['next_goto'] == 'Menu1_CheckInput1') {
         //input will come in data param
         //print print parameter data value
         if ($_REQUEST['data'] == '') {
             //if value null, caller has not given any dtmf
             //no input handled
             $r->addPlayText('you have not entered any input');
             $_SESSION['next_goto'] = 'Menu1';
         } else {
             $_SESSION['dial'] = $_REQUEST['data'];
             $r->addPlayText('please wait while we transfer your call to our customer care');
             $r->addDial($_SESSION['dial'], 'true', 1000, 30, 'ring');
             $_SESSION['next_goto'] = 'Dial1_Status';
         }
     } else {
         if ($_REQUEST['event'] == 'Record' && $_SESSION['next_goto'] == 'Record_Status') {
             //recorded file will be come as  url in data param
             //print parameter data value
             $r->addPlayText('your recorded audio is ');
             $_SESSION['record_url'] = $_REQUEST['data'];
             $r->addPlayAudio($_SESSION['record_url']);
             $r->addPlayText('Thanks you for calling, have a nice day');
             $r->addHangup();
         } else {
             if ($_REQUEST['event'] == 'Dial' && $_SESSION['next_goto'] == 'Dial1_Status') {
                 //dial url will come data param  //if dial record false then data value will be -1 or null
                 //dial status will come in status (answered/not_answered) param
开发者ID:developers-truckaurbus,项目名称:KooKoo-PHP,代码行数:31,代码来源:demo.php

示例15: Response

<?php

require_once "./plivo.php";
// Add Speak tag
$body = 'Connecting your call..';
$r = new Response();
// Add speak element
$r->addSpeak($body);
// Add Dial tag
$number = "2222222222";
$d = $r->addDial();
$d->addNumber($number);
Header('Content-type: text/xml');
echo $r->toXML();
/*
Sample Output
<Response>
    <Speak>Connecting your call..</Speak>
    <Dial>
        <Number>2222222222</Number>
    </Dial>
</Response>
*/
开发者ID:pontocertosms,项目名称:php_examples,代码行数:23,代码来源:connect_call.php


注:本文中的Response::addDial方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。