phparia icon indicating copy to clipboard operation
phparia copied to clipboard

requests are made not accordingly to Asterisk documentation

Open pietrobaricco opened this issue 6 years ago • 3 comments

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.

pietrobaricco avatar May 10 '18 12:05 pietrobaricco

I'm very busy on another project at the moment. Would you be able to submit a fix for this?

wormling avatar May 16 '18 13:05 wormling

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.

pietrobaricco avatar May 18 '18 13:05 pietrobaricco

@wormling why hasn't the fix made by @pietrobaricco still been merged?

nospoon avatar May 23 '19 15:05 nospoon