Exemple #1
0
 public function testGatherCreate()
 {
     $call = new Catapult\Call();
     $params = new Catapult\Parameters();
     $params->setFrom(new Catapult\PhoneNumber(__DEFAULT_SENDER__));
     $params->setTo(new Catapult\PhoneNumber(__DEFAULT_RECEIVER__));
     $call->create($params);
     $call->wait();
     $gather = new Catapult\Gather($call->id);
     $params->setReason("max-digits");
     $params->setDigits("123");
     $gather->create($params);
     $this->assertEquals($gather->digits, "123");
 }
Exemple #2
0
 public function testBridgeCreate()
 {
     $params = new Catapult\Parameters();
     $call = new Catapult\Call();
     $params->setFrom(new Catapult\PhoneNumber(__DEFAULT_SENDER__));
     $params->setTo(new Catapult\PhoneNumber(__DEFAULT_RECEIVER__));
     $call->create($params);
     $call->wait();
     $call1 = new Catapult\Call();
     $params->setFrom(new Catapult\PhoneNumber(__DEFAULT_SENDER__));
     $params->setTo(new Catapult\PhoneNumber(__DEFAULT_RECEIVER__));
     $call1->create($params);
     $call1->wait();
     $bridge = new Catapult\Bridge();
     $bridge->create(array("callIds" => Catapult\CallCombo::Make($call, $call1)));
 }
<?php

require_once '../source/Catapult.php';
// below is a sample conference
// using Catapult's conference feature
// IMPORTANT: edit credentials.json
// with your information
// or comment out below /w your keys
//
$cred = new Catapult\Credentials('BANDWIDTH_USER_ID', 'BANDWITH_API_TOKEN', 'BANDWIDTH_API_SECRET');
//$cred = new Catapult\Credentials;
// dont forget to comment out the implicit version if using assoc array
$client = new Catapult\Client($cred);
if (!(isset($argv[1]) || isset($argv[2]))) {
    die("\nPlease provide command line input like: \n php ./sample-conference.php 'from' 'to'\n\n");
}
$conference = new Catapult\Conference(array("from" => $argv[1]));
$call = new Catapult\Call();
$call->create(array("from" => new Catapult\PhoneNumber($argv[1]), "to" => new Catapult\PhoneNumber($argv[2]), "conferenceId" => $conference->id));
$call->wait();
$call->speakSentence(array("sentence" => "Hello. This is a sample conference call."));
 public function testStopAudio()
 {
     $params = new Catapult\Parameters();
     $params->setFrom(new Catapult\PhoneNumber(__DEFAULT_SENDER__));
     $call = new Catapult\Call();
     $conference = new Catapult\Conference();
     $conference->create($params);
     $params->setFrom(new Catapult\PhoneNumber(__DEFAULT_SENDER__));
     $params->setTo(new Catapult\PhoneNumber(__DEFAULT_RECEIVER__));
     $params->setConferenceId($conference->id);
     $call->create($params);
     $call->wait();
     $member = $conference->add_member(array("callId" => $call->id, "setJoinTone" => "false"));
     $member->stop_audio();
 }