This page contains code snippets that demonstrate various Unified API requests using the PHP language. |
PHP 5.3 or higher is required.
Download here. Do not hesitate to contribute in order to make this example better - we welcome Pull Requests! |
The example below demonstrates how you can use Unified API to connect two public numbers, not registered with VoipNow. It uses the Create Simple PhoneCalls request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/01_public_call.php" -o 01_public_call.php -L |
Unified API can be tested using the Sandbox numbers. The example below uses the Create Simple PhoneCalls request to make the call.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/02_sandbox_call.php" -o 02_sandbox_call.php -L |
The example below demonstrates how you can use Unified API to park a party of an ongoing phone call. It uses the Park PhoneCalls request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/03_park_call.php" -o 03_park_call.php -L |
The example below demonstrates how you can use Unified API to transfer a call to a public number, not registered with VoipNow. It uses the Transfer PhoneCalls request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/04_transfer_call.php" -o 04_transfer_call.php -L |
The example below demonstrates how you can use Unified API to record an ongoing conversation. This action is possible for phone numbers that are registered with VoipNow. The recording is saved in the wav format and uses the StartRecording PhoneCalls request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/05_record_call.php" -o 05_record_call.php -L |
The example below demonstrates how you can use Unified API to log in an agent to a queue. It uses the Update QueueAgents request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/06_agent_login.php" -o 06_agent_login.php -L |
The example below demonstrates how you can use Unified API to list the status of an extension. It uses the List Presence request.
curl "https://raw.githubusercontent.com/4psa/uapi-example-php/master/07_list_registration.php" -o 07_list_registration.php -L |