PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Voice Call

The Voice Call service can be used to set up a voice connection between two telephone connections. For specific details please read the API Documentation.

Normally the Service works as followed:

  • Call the first participant.

  • If the connection is successful, call the second participant.

  • If second participant connects succesfully, both participants are connected.

  • The call is open until one of the participants hangs up or the expire mechanism intercepts.

Example 808. Call two numbers

<?php
$service 
= new Zend_Service_DeveloperGarden_VoiceCall($config);
$aNumber '+49-30-000001';
$bNumber '+49-30-000002';
$expiration  30;  // seconds
$maxDuration 300// 5 mins
$newCall $service->newCall($aNumber$bNumber$expiration$maxDuration);
echo 
$newCall->getSessionId();

If the call is initiated, you can ask the result object for the session ID and use this session ID for an additional call to the callStatus or tearDownCall() methods. The second parameter on the callStatus() method call extends the expiration for this call.

Example 809. Call two numbers, ask for status, and cancel

<?php
$service 
= new Zend_Service_DeveloperGarden_VoiceCall($config);
$aNumber '+49-30-000001';
$bNumber '+49-30-000002';
$expiration  30// seconds
$maxDuration 300// 5 mins

$newCall $service->newCall($aNumber$bNumber$expiration$maxDuration);

$sessionId $newCall->getSessionId();

$service->callStatus($sessionIdtrue); // extend the call

sleep(10); // sleep 10s and then tearDown

$service->tearDownCall($sessionId);

Zend Framework