phparia
phparia copied to clipboard
requests are made not accordingly to Asterisk documentation
So far I've tried Channels::createChannel, which expects the body to be passed as a Json object, but the library passes urlencoded values. As a result, variables are not set.
This works:
$response = $this->client->getEndpoint()->post($uri, [
\GuzzleHttp\RequestOptions::JSON => [
'endpoint' => $endpoint,
'extension' => $extension,
'context' => $context,
'priority' => $priority,
'label' => $label,
'app' => $app,
'appArgs' => $appArgs,
'callerId' => $callerId,
'timeout' => $timeout,
'channelId' => $channelId,
'otherChannelId' => $otherChannelId,
'formats' => $formats,
'variables' => array_map('strval', $variables)
]
]);
Another thing is for instance the Channels::setVariable method, which by Asterisk doc does not return a variable, but just a HTTP status. As a result, setting a variable with the API generates a json decoding exception.
I'm very busy on another project at the moment. Would you be able to submit a fix for this?
I have a fork I'm working with which contains the fixes, I have not yet submitted the fix to the master repo because I suspect that there are more, and I want to be done with the fixes I need for my project before doing that. But eventually, I will.
@wormling why hasn't the fix made by @pietrobaricco still been merged?