Closed ryantxr closed 3 years ago
i get the same when i try to update a phone numbers sub-account using the $client->number->update()
Exception 'Error' with message 'Wrong parameters for Plivo\Exceptions\PlivoResponseException([string $message [, long $code [, Throwable $previous = NULL]]])'
in /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/plivo/plivo-php/src/Plivo/Exceptions/PlivoResponseException.php:36
Stack trace:
#0 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/plivo/plivo-php/src/Plivo/Exceptions/PlivoResponseException.php(36): Exception->__construct(Array, 0, Object(Plivo\Exceptions\PlivoValidationException))
#1 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/plivo/plivo-php/src/Plivo/Resources/Number/NumberInterface.php(130): Plivo\Exceptions\PlivoResponseException->__construct(Array, 0, NULL, Array, 400)
#2 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/tc/sms-providers/src/plivo/Plivo.php(317): Plivo\Resources\Number\NumberInterface->update('16626057518', Array)
#3 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/tc/sms-providers/src/SMS.php(54): TC\SmsProviders\plivo\Plivo->updatePhoneNumber('16626057518', Array)
#4 /home/omeraslam/www/html/projects/FCS/text-calibur/console/controllers/MovePhoneNumbersController.php(35): TC\SmsProviders\SMS->__call('updatePhoneNumb...', Array)
#5 [internal function]: console\controllers\MovePhoneNumbersController->actionIndex('2', '3', 'plivo')
#6 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#8 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/console/Controller.php(184): yii\base\Controller->runAction('', Array)
#9 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/base/Module.php(534): yii\console\Controller->runAction('', Array)
#10 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/console/Application.php(181): yii\base\Module->runAction('move-phone-numb...', Array)
#11 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/console/Application.php(148): yii\console\Application->runAction('move-phone-numb...', Array)
#12 /home/omeraslam/www/html/projects/FCS/text-calibur/vendor/yiisoft/yii2/base/Application.php(392): yii\console\Application->handleRequest(Object(yii\console\Request))
#13 /home/omeraslam/www/html/projects/FCS/text-calibur/yii(27): yii\base\Application->run()
#14 {main}
Code
$response = $this->getClient($phone['provider'], $user_id)->updatePhoneNumber(
$phone['phone'],
[
'app_id' => Yii::$app->params['PLIVO_APP_ID'],
'subaccount' => $authIdTo,
]
);
/**
* @param $phone
* @param $options
* @return mixed
*/
public function updatePhoneNumber($phone, $options)
{
return $this->getClient()->numbers->update($phone, $options);
}
the PlivoResponseException
has the first param of the construct defined as string
public function __construct($message = "", $code = 0, Throwable $previous = null, $responseData, $statusCode)
where as in the NumberInterface
has the if statement which checks if there is no error
key defined and in the else case it throws the PlivoRespnseException
on line 122
} else {
throw new PlivoResponseException(
$responseContents['error'],
0,
null,
$response->getContent(),
$response->getStatusCode()
);
}
but the $responseContents
has the format returned as
Array
(
[api_id] => MY_APP_ID
[error] => Array
(
[error] => This Application-id does not belong to this Account.
)
)
so you are passing an array instead of a string, it should have been $responseContents['error']['error']
as the first parameter of the PlivoResponseException
Plus, the above exception should not be there, as i am using the correct App id and the account if i use Curl command to update the phone number it works correctly with the same set of configurations. Or using postman it works correctly without any exceptions
@ryantxr @buttflattery This has been fixed in our latest update, i.e. v4.18.0. Feel free to contact our support team with any questions.
I am attempting to update the app_id for a phone number and I am getting an exception in the library code.
If I comment out the app_id, it works.
This is the exception/error