<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wavix.com/v1/trunks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'label' => 'My trunk',
'password' => '4r=h;EaCB85QNtr2',
'callerid' => '13132847320',
'multiple_numbers' => true,
'ip_restrict' => false,
'allowed_ips' => [
[
'ip' => '127.0.0.1'
]
],
'didinfo_enabled' => true,
'call_restrict' => true,
'call_limit' => 3600,
'cost_limit' => true,
'max_call_cost' => 0.18,
'channels_restrict' => false,
'max_channels' => 2,
'rewrite_enabled' => true,
'rewrite_prefix' => '1',
'rewrite_cond' => '<string>',
'call_recording_enabled' => true,
'transcription_enabled' => true,
'transcription_threshold' => 10,
'machine_detection_enabled' => true,
'encrypted_media' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}