Trunk Edit
This service is used to edit a trunk.
Parameters
| Parameters | Required[**]/Optional[*] | Defined Data | Sample Data | Description |
|---|---|---|---|---|
| id_ | ** | - | 6033876dc92de036d1390923 | Unique identifier of the trunk obtained from search |
| trunk_type | * | SIP/IAX2/DAHDI | SIP | Trunk Type |
| name | * | - | trunk_name_new2 | Trunk Name |
| register_string | * | - | some-register-string | - |
| active | * | yes/no | no | Active/Inactive |
| deny | * | - | 0.0.0.0/0.0.0.0 | - |
| permit | * | - | 0.0.0.0/0.0.0.0 | - |
| dtmfmode | * | - | rfc2833 | DTMF Standard |
| canreinvite | * | yes/no | no | - |
| directmedia | * | yes/no | no | - |
| context | * | - | from-pstn | - |
| host | * | - | 192.168.1.100 | Service Provider IP |
| type | * | User/Peer/Friend | friend | - |
| nat | * | yes/no/Force Report & Co-Media | force_rport, comedia | - |
| port | * | - | 5060 | - |
| qualify | * | yes/no | yes | - |
| insecure | * | Port/Invite/Port & Invite | port, invite | - |
| disallow | * | - | all | - |
| allow | * | - | ulaw, alaw | - |
Sample Invocation
Example Code
PHP
<?PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'HTTP://192.168.1.100/API/v4/PBX/trunks/update',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"_id":"6033876dc92de036d1390923",
"trunk_type":"SIP",
"name":"trunk_name_new2",
"register_string":"3591011020:as#3591011020@192.168.1.100/3591011020\\t",
"active":"no",
"deny":"0.0.0.0/0.0.0.0",
"permit":"0.0.0.0/0.0.0.0",
"dtmfmode":"rfc2833",
"canreinvite":"no",
"directmedia":"no",
"context":"from-pstn",
"host":"192.168.1.100",
"type":"friend",
"nat":"force_rport,comedia",
"port":"5060",
"qualify":"yes",
"insecure":"port,invite",
"disallow":"all",
"allow":"ulaw,alaw",
"more_options":"fromuser=3591011020\\nusername=3591011020\\nsecret=as#3591011020",
"description":""
}',
CURLOPT_HTTPHEADER => array(
'X-APIKEY: SAMPLE_API_KEY',
'Authorization: Basic dGVzdDpBYTEyMzQ1Ng==',
'Content-Type: application/JSON'
),
));
$response = curl_exec($curl);
if (!curl_errno($curl)) {
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo 'response code:'.$httpcode, '<br/>';
}
curl_close($curl);
echo $response;
?>