signalwire-community / signalwire-php Goto Github PK
View Code? Open in Web Editor NEWPHP Library for SignalWire APIs
Home Page: https://signalwire-community.github.io/docs/php/
License: MIT License
PHP Library for SignalWire APIs
Home Page: https://signalwire-community.github.io/docs/php/
License: MIT License
As reported by support:
composer require signalwire/signalwire
Do not run Composer as root/super user! See https://getcomposer.org/root for details
[InvalidArgumentException]
Could not find a version of package signalwire/signalwire matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.
I am making a call and asking to choose 1 to talk to other person. If the user press 1 I am creating a conference and making another call to the next user with machine detection.
The problem is the conference is not being creating at first with the user in it. Here is the function I have.
public function connect_call_lead(Request $request)
{
$response = new LaML();
if ($request->input('Digits')==1) {
$cfnm="someuniquename";
$dial->conference($cfnm); //conference is not creating here
header('Content-Type: text/xml');
echo $response;
$client = new SignalWire(config('app.sig_pro'), config('app.sig_token'));
try {
$call = $client->calls->create(
$request->input('leadphone'),
$request->input('signal_phone'),
array("url" => config('app.url')."/ConnectCallPeople?cfnm=".$cfnm,
"MachineDetection" => "Enable",
"MachineDetectionTimeout" => "20",
"statusCallbackMethod" => "POST",
"statusCallback" => config('app.url')."s2l/getCallOutcome",
"statusCallbackEvent" => array(
"completed"
)
)
);
} catch (Exception $e) {
}
} else {
$response->hangup();
header('Content-Type: text/xml');
echo $response;
}
}
Function if the call is answered
public function ConnectCallPeople(Request $request)
{
$response = new LaML();
if ($request->input('AnsweredBy')==='human') {
$dial = $response->dial();
$dial->conference( $request->input('cfnm'), array(
'startConferenceOnEnter' => True,
'endConferenceOnExit' => True
));
header('Content-Type: text/xml');
echo $response;
}else{
//do something else
}
}
in docs showing from parameter is optional, but the call getting failed when we do not use from
attribute
please check here https://docs.signalwire.com/topics/relay-sdk-php/v2/#api-reference-relay-calling-call-methods-connect
When a call is connected to another number using the $call->connect() method, the $call object has $call->peer set to the call object of the 2nd leg. But the peer parameter of the call retrieved using getCall() is not set to the original call. This means it is not possible to reference the original call object using the peer object.
Since it is a "bridged" call, it would seem that these should point to each other.
EXAMPLE CODE:
$action = yield $call->connect(...$devices);
if ($action->isSuccessful()) {
$connected = $action->getCall();
}
$digitdetect1 = yield $connected->detectDigitAsync();
$digitdetect2 = yield $call->detectDigitAsync();
$detectcb = function($call,$params) {
$call->peer->playSilence(1);
print_r($params);
};
$call->on('detect.update',$detectcb);
$connected->on('detect.update', $detectcb);
RESULT:
When digits are detected on $connected, the following error occurs:
PHP Fatal error: Uncaught Error: Call to a member function playSilence() on null
Why i get that ??
We want to upgrade to Laravel 8, which requires Guzzle 7. Signalwire-php only supports Guzzle 6. Please start supporting Guzzle 7. Thanks!
when I run the php relay client I get below error
$client->calling->newCall([ 'type' => 'phone', 'from' => '+12062371251', 'to' => '+12062371252' ])->then( function($call): void { // Use $call ... echo "call just happened"; }, function ($error) { // An error occured.. echo "an error has occurred"; } );
PHP Fatal error: Declaration of SignalWire\Relay\Calling\Calling::notificationHandler($notification): SignalWire\Relay\Calling\void must be compatible with Sig nalWire\Relay\BaseRelay::notificationHandler($notification): SignalWire\Relay\void in /var/www/html/relay/php/vendor/signalwire/signalwire/src/Relay/Calling/Cal| ling.php on line 7
We recently started receiving this error:
Class 'Twilio\Rest\Fax' not found
From Signalwire PHP driver. Is there a fix to this? It's causing issues for us.
I am trying to send SMS using the example, however when running my PHP file I get this error: Class 'Twilio\Rest\Fax' not found
.
I am using the latest v3.0.0 package, installed via composer.
Any ideas?
Hi,
I am getting this error "Twilio\TwiML\MessageResponse not found". This is coming from signalwire\signwaire\src\LaML\MessagesResponse.php. After looking through the package and checking Twilio's package. It seems that it has been renamed on Twilio to Twilio\TwiML\MessagingResponse.
Can the signalwire-php package please be updated to change this?
Thank you,
Adnan
I'd like to upgrade from twilio/sdk from 5.41.1 to 6.3.0. Signalwire appears to require the old version. Can signalwire support the new sdk version? Thanks!
Hi.
We are using php 8, current package does not support it by dependency from recoil/react.
Trying to find local number . This works if I use twilio SDK directly , but doesn't work when I change the client to SignalWire.
Code
use SignalWire\Rest\Client;
$project = 'myprojectid';
$token = 'mytoken';
$client = new Client($project, $token);
$numbers = $client->availablePhoneNumbers('US')->local->read(
array("areaCode" => "430")
);
Error Log:
staging.ERROR: [HTTP 401] Unable to fetch page {"exception":"[object] (Twilio\\Exceptions\\RestException(code: 401): [HTTP 401] Unable to fetch page at C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Page.php:54)
[stacktrace]
#0 C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Page.php(34): Twilio\\Page->processResponse(Object(Twilio\\Http\\Response))
#1 C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalPage.php(16): Twilio\\Page->__construct(Object(Twilio\\Rest\\Api\\V2010), Object(Twilio\\Http\\Response))
#2 C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList.php(126): Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalPage->__construct(Object(Twilio\\Rest\\Api\\V2010), Object(Twilio\\Http\\Response), Array)
#3 C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList.php(59): Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList->page(Object(Twilio\\Values), 'Twilio\\\\Values\\\\N...')
#4 C:\\xampp\\htdocs\
testdash\\vendor\\twilio\\sdk\\Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList.php(81): Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList->stream(Array, NULL, NULL)
#5 C:\\xampp\\htdocs\
testdash\\app\\Http\\Controllers\\TwilioController.php(218): Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList->read(Array)
#6 [internal function]: App\\Http\\Controllers\\TwilioController->find_phone('US', '430')
#7 C:\\xampp\\htdocs\
Not getting proper error reason if we give the wrong TO number
[2019-07-26 22:13:28] SignalWire.ERROR: Relay command failed with code: 400. Message: Bad request.
When requiring this this package, I got the following error.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires signalwire-community/signalwire 3.1.0 -> satisfiable by signalwire-community/signalwire[v3.1.0].
- signalwire-community/signalwire v3.1.0 requires monolog/monolog ^1.24 || ^2.0 -> found monolog/monolog[1.24.0, ..., 1.27.1, 2.0.0, ..., 2.9.1] but these were not loaded, likely because it conflicts with another require.
Hi,
As there is no international calls or text is allowed, is it possible not to make adding +1 before the number as required. So instead of +18888888888 , if 8888888888 is provided it still takes it as a valid number.
Thanks
Is there any plan to update the Twilio SDK version requirements to the latest version which is https://github.com/twilio/twilio-php/releases/tag/6.25.0?
I got "[HTTP 422] Unable to create record: Areacode is not supported yet"
My code is below:
$client->incomingPhoneNumbers
->create(array(
"friendlyName" => "Test Phone",
"areaCode" => "713"
));
Hi,
I'm trying to create subaccount like twilio provides.
this curl url i'm calling Postman example:
http://.signalwire.com/api/laml/2010-04-01/Accounts/Accounts.json?FriendlyName=SW-234
in post method but its giving 404.
php function :
$sub_account = $sw->api->v2010->accounts->create(array("friendlyName" => $friendlyName));
I'm not getting this question answer, sub-account concept is present or not in Signalwire?
Please help me, thanks!
The client should be able to send in the Space URL during client initialization without using ENV var.
Currently there is no way to set the Space URL without using ENV vars whereas the other clients can set it statically during initialization or client method.
Trying to install signalwire-php v2.x
in laravel 6.x
which uses monolog 2.x
but it seems signalwire-php
requires monolog 1.x
Composer Feedback
composer require signalwire/signalwire
Using version ^2.3 for signalwire/signalwire
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install signalwire/signalwire v2.3.3
- Conclusion: don't install signalwire/signalwire v2.3.2
- Conclusion: don't install signalwire/signalwire v2.3.1
- Conclusion: remove monolog/monolog 2.0.2
- Installation request for signalwire/signalwire ^2.3 -> satisfiable by signalwire/signalwire[v2.3.0, v2.3.1, v2.3.2, v2.3.3].
- Conclusion: don't install monolog/monolog 2.0.2
- signalwire/signalwire v2.3.0 requires monolog/monolog ^1.24 -> satisfiable by monolog/monolog[1.24.0, 1.25.0, 1.25.1, 1.25.2, 1.25.3, 1.x-dev].
- Can only install one of: monolog/monolog[1.24.0, 2.0.2].
- Can only install one of: monolog/monolog[1.25.0, 2.0.2].
- Can only install one of: monolog/monolog[1.25.1, 2.0.2].
- Can only install one of: monolog/monolog[1.25.2, 2.0.2].
- Can only install one of: monolog/monolog[1.25.3, 2.0.2].
- Can only install one of: monolog/monolog[1.x-dev, 2.0.2].
- Installation request for monolog/monolog (locked at 2.0.2) -> satisfiable by monolog/monolog[2.0.2].
Installation failed, reverting ./composer.json to its original content.
code below fails.
$client->on('signalwire.ready', function($session) {
$params = array('type' => 'phone', 'from' => '+1xxx', 'to' => '+1yyy');
$session->calling->dial($params)->done(function($dialResult) {
if (!$dialResult->isSuccessful()) {
echo "\n Error dialing \n";
}
$call = $dialResult->getCall();
$call->on('stateChange', function ($call) {
echo PHP_EOL . $call->id . " state changed to " . $call->state . PHP_EOL;
})
->on('play.stateChange', function ($call, $params) {
echo PHP_EOL . $call->id . " GLOBAL play changed to " . $params->state . PHP_EOL;
});
$call->playAudio('https://cdn.signalwire.com/default-music/welcome.mp3');
})->done(function ($response) {
echo PHP_EOL . $response->message . PHP_EOL;
});
});
$client->connect();
with error below.
PHP Fatal error: Uncaught Error: Call to a member function done() on null in /var/www/html/relay/php/play_sound.php:39 Stack trace: #0 /var/www/html/relay/php/vendor/signalwire/signalwire/src/Handler.php(64): {closure}(Object(SignalWire\Relay\Client)) #1 /var/www/html/relay/php/vendor/signalwire/signalwire/src/Relay/Client.php(184): SignalWire\Handler::trigger('signalwire.read...', Object(SignalWire\Relay\Client), 'f0332ce4-09ce-4...') #2 /var/www/html/relay/php/vendor/react/promise/src/FulfilledPromise.php(39): SignalWire\Relay\Client->SignalWire\Relay\{closure}('signalwire_5db7...') #3 /var/www/html/relay/php/vendor/react/promise/src/Promise.php(66): React\Promise\FulfilledPromise->done(Object(Closure), NULL) #4 /var/www/html/relay/php/vendor/react/promise/src/Promise.php(168): React\Promise\Promise::React\Promise\{closure}(Object(React\Promise\FulfilledPromise)) #5 /var/www/html/relay/php/vendor/react/promise/src/Promise.php(231): React\Promise\Promise->settle(Object(React\Promise\FulfilledPromise)) #6 /var/www/html/relay/ in /var/www/html/relay/php/play_sound.php on line 39
Using $numbers = $client->availablePhoneNumbers('US')->local->read()
if the result set is greater than the page size (50), the endpoint errors. If the result set is less than the page size, no problems.
Error:
PHP Fatal error: Uncaught exception 'Twilio\\Exceptions\\RestException' with message '[HTTP 500] Unable to fetch page' in /twilio/sdk/Twilio/Page.php:54
Stack trace:
#0 /twilio/sdk/Twilio/Page.php(34): Twilio\\Page->processResponse(Object(Twilio\\Http\\Res ponse))
#1 /twilio/sdk/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalPage.php(16): Twilio\\Page->__construct(Object(Twilio\\Rest\\Api\\V2010) , Object(Twilio\\Http\\Response))
#2 /twilio/sdk/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalList.php(126): Twilio\\Rest\\Api\\V2010\\Accou nt\\AvailablePhoneNumberCountry\\LocalPage->__construct(Object(Twilio\\Rest\\Api\\V2010), Object(Twilio\\Http\\Response), Array)
#3 /twilio/sdk/Twilio/Rest/Ap i/V2010/Account/AvailablePhoneNumberCountry/LocalList.php(59): Twilio\\Rest\\Api\\V2010\\Account\\AvailablePhoneNumberCountry\\LocalList->page(Array, 'Twilio\\\\Value in /var/www/html/sign_up_v1 _dev/vendor/twilio/sdk/Twilio/Page.php on line 54
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.