API Click To Call Not Working

Hi VitalPbx,

can you check why this api not working

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.example.com/api/v2/core/click_to_call',
  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 =>'{
    "caller": 201,
    "callee": 043321989,
    "cos_id": 1,
    "cid_name": "My PBX",
    "cid_number": 043321989,
    "variables": {
        "X-APP": "Postman",
        "X-CAMPAIGN": "sales"
    }
}',
  CURLOPT_HTTPHEADER => array(
    'app-key: fa12f92c59579fbeed9eb9ba88449893',
    'tenant: db494559b6584de6'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
?>

Response :

{"status":"validation","message":"You have not provided a valid caller","data":[]}

Thanks

Are you following the latest postman documentation?

Hi Sir,

Yes…

Thanks

Yes, you are lucky here. It used to take me hours:

"CURLOPT_POSTFIELDS => json_encode([
						"caller" => "201",
						"callee" => 043321989,
						"cos_id" => 1,
						"cid_name" => "My PBX",
						"cid_number" => "043321989",
						"variables" => [
							"X-APP" => "Postman",
							"X-CAMPAIGN" => "sales"
                        ]
					]),

important:
json_encode([
]

Postman should be updated regarding this.

1 Like

Hi @mo10

Many thanks…i will try.

Are there any news on this?

Hi @mo10

It working well!!

Cool, always mark the solution with the button.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.