bandwidth / php-bandwidth Goto Github PK
View Code? Open in Web Editor NEWPHP SDK for Bandwidth Voice and Messaging APIs
Home Page: http://dev.bandwidth.com/
License: MIT License
PHP SDK for Bandwidth Voice and Messaging APIs
Home Page: http://dev.bandwidth.com/
License: MIT License
Can you guys issue a new release? The last release was almost a year ago, so when I run composer update, it's not getting the latest changes (the character limit). Thanks!
while trying to play an audio I get the fileUrl is not valid and only shows the root url passed.
while speakSentence i get "{"category":"forbidden","code":"call-invalid-state","message":"Unable to update call c-XXXXXXXX. Invalid call state COMPLETED","details":[{"name":"callId","value":"c-XXXXXXXX"},{"name":"callState","value":"COMPLETED"},{"name":"requestMethod","value":"POST"},{"name":"remoteAddress","value":"69.64.72.223"},{"name":"requestPath","value":"users/u-ikxknyw3kmvhrgderfslf2q/calls/c-XXXXXXXX/audio/"}]} " Does not matter if the call is active, started or completed.
A little help would help
When sending a message I get this error on my server, but not locally.
The server is using php 5.4.16, locally I'm using php 7.0.10 - could that be the issue?
when using "composer require bandwidth/catapult"
the returned result is sometimes "Nothing to install or update" this
needs to be looked into.
$phoneNumbers = new PhoneNumbers();
$params = [
'state' => 'fl',
'quantity' => 1
];
$numbers = $phoneNumbers->batchAllocateLocal($params);
is throwing
PHP Fatal error: Uncaught Exception: function: validate_search_query not found in Catapult\PhoneNumbers
thrown in /vendor/bandwidth/catapult/source/resource/Base.php on line 96
"user-agent":"php-bandwidth-{version-number-of-package}"
for any request to catapultThe speakSentence function fails for both the Conference and ConferenceMember models. I've traced this to a malformed audio url being returned by ConferenceMember->getAudioUrl() and no implementation of Conference->getAudioUrl.
I've implemented a fix that I have verified on my own system and am initiating a pull request.
I was getting this error message when sending text message
(line: 84) - APPLICATION: [Jan/01/17:18:51:18] - Text message was too long. use: warn[FALSE] to omit.
I only have 165 characters in the message. I think the API supposedly should accept strings up to 2048, right?
Testing this, BAML is producing when it should generate
e..g http://ap.bandwidth.com/docs/xml/gather/
I ran this example
$ php sample-baml.php Gather requestUrl http://hello.com
The following BaML was generated:
exampleShould be
exampleI don't seem to be able to get around not having this file. The documentation implies that if you supply the credentials to the credentials constructor like
$cred = new Catapult\Credentials($bandwidth_user_id, $bandwidth_api_token, $bandwidth_api_secret);
then you do not need the file. If you look at the constructor
public function __construct($user_token='',
$api_token='',
$api_secret='')
{
$file = self::$credentials_opts['file'];
/* only consider parameter init if all provided */
if (isset(self::$credentials_opts['path'])) {
self::$credentials_opts['path'] = self::$credentials_opts['path'] . DIRECTORY_SEPARATOR . self::$credentials_opts['file'];
} else {
self::$credentials_opts['path'] = realpath(getcwd()) . DIRECTORY_SEPARATOR . self::$credentials_opts['file'];
}
/**
* check if the file is accessible
* when it is "credentials.json"
* this should
*
* this needs to only validate the directory
*/
if (!is_file(self::$credentials_opts['path'])) {
throw new \CatapultApiException("$file was not found in directory " . self::$credentials_opts['path']);
}
if ($user_token && $api_token && $api_secret)
$this->credentials = new CredentialsUser($user_token, $api_token, $api_secret);
else
$this->credentials = file_get_contents(self::$credentials_opts['path']);
}
it checks for the file no matter what. Would it be possible to change it so we do not have to provide the credentials.json file?
The MMS example is not working, two issues
you have to first upload media to Bandwidth servers, otherwise you get an error "must be first stored as a Catapult media"
Example is send to and from the same phone number
"from" => $argv[1],
"to" => $argv[1],
Suggested fix, simplify this example into a single message example and combine with /media upload
Trying to run this
$call = new Catapult\Call(array(
"from" => new Catapult\PhoneNumber($_POST['fromPhoneNumber']),
"to" => new Catapult\PhoneNumber($_POST['toPhoneNumber']),
"callbackUrl" => "https://".$_SERVER['HTTP_HOST']."/callback.php",
"callbackHttpMethod" => "GET"
));
Produces:
CatapultWarning: callbackHttpMethod is not a valid term in model Catapult\Call
However, callbackHttpMethod is a valid paramter
http://ap.bandwidth.com/docs/rest-api/calls/#resource396
Looking at the parameters described here (https://dev.bandwidth.com/ap-docs/methods/calls/postCallsCallIdGather.html), there seems to be a mismatch here (https://github.com/Bandwidth/php-bandwidth/blob/master/source/models/Gather.php) in lines 38, 39.
Also, I see the following misspelling <"terinatingDigits"> and <prompt.sentance> .
warnings in Strict(2048) mode that
need to be fixed, (function declation and compatability)
ex:
Strict (2048): Declaration of Catapult\Endpoints::load() should be compatible with Catapult\GenericResource::load($props) [APP/Vendor/Catapult/source/models/Endpoints.php, line 103]
I encountered two errors with the conference class.
getMembers() relies on the existence of ConferenceMembersCollection extending CollectionObject. This was not implemented and thus caused a missing class error to be thrown.
Conference->addMember does properly create the member, but when attempting to fetch the newly created member information from the API, it fails to pass in the memberId and so causes a resource not found error to be thrown.
I've traced and patched both of these and will initiate a pull request.
use Catapult\Client;
use Catapult\Message;
use Catapult\PhoneNumber;
use Catapult\TextMessage;
...
$result = new Message([
'from' => new PhoneNumber($from),
'to' => new PhoneNumber($to),
'text' => new TextMessage($message),
]);
...
Version: 0.8.2
This causes a resolver error on:
[2018-03-13 11:42:09] local.DEBUG: Sleeping extra 3 seconds.
[2018-03-13 11:42:09] local.ERROR: ErrorException: sizeof(): Parameter must be an array or an object that implements Countable in C:\laragon\webroots\playhq\attendence-laravel\vendor\bandwidth\catapult\source\resource\Resolver.php:47
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'sizeof(): Param...', 'C:\\laragon\\webr...', 47, Array)
#1 C:\laragon\webroots\playhq\attendence-laravel\vendor\bandwidth\catapult\source\resource\Resolver.php(47): sizeof(Object(Catapult\DataPacket))
MMS should allow an array of URLs to send as one payload.
MMS no longer requires the URL to be a valid catapult url, any URL can be used.
http://ap.bandwidth.com/docs/rest-api/messages/
New Messages should be created like:
$mms_array = array('<url1>', '<url2>', '<url3');
$message1 = new Catapult\Message(array(
"from" => $argv[1],
"to" => $argv[2],
"text" => $text1,
"media" => $mms_array
));
Issue: #2
Status: Resolved
Please update to v0.7.3, as the prefixed 'v' in version naming plays better with package management support
We're looking at the shape of our SDKs and seeing if they justify a re-write, or just need better docs, or something else.
Please make some suggestions for the PHP SDK. I'm open to pretty much everything.
Thanks for your feedback. If you want to hit me up directly feel free (dtolb @ bandwidth.com)
Saw this error when trying to use MessageMulti to send multiple messages.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.