-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Merge branch '7.0.0-rc' to main (#771)
* chore: release candidate and pre-release setup * chore: create BaseClient in Base folder (#751) * fix: Add Cluster test (#755) * chore: add cluster test * fix: add test files to Rest folder for testing cluster test * fix: remove yoyodyne generated code from Rest folder * docs: updated the year in the license * chore: add rc installation instructions * fix: add handcrafted domain files with deprecated message for shortcuts (#756) * fix: base file name (#757) * chore: removing Integration test suite * chore: sync up with main branch (#758) * Delete tests/Twilio/Unit/TwiML/Voice directory * chore: delete voiceResponseTest.php * [Librarian] Regenerated @ 82775d167bff9b55d1399fe288c2934a02411e8c * Release 7.0.0-rc.1 * fix: support array parameters for Guzzle GETs (#759) * fix: type hint for $capabilities to PhoneNumberCapabilities (#760) * fix: capabilities dataType to PhoneNumberCapabilities * fix: __toString() output bool values * chore: add Deserialization tests for PhoneNumberCapabilities * fix: failing test case * fix: minor change * chore: remove code smells (#762) * chore: remove code smells * fix: ClusterTest * chore: remove code smells * chore: remove code smells * chore: remove code smells * [Librarian] Regenerated @ a72b955e51d75514f3c944c81b9db17278cfad69 * [Librarian] Regenerated @ b8981cc124150c7112387152deb5f97fb9a25d66 * chore: add examples for calling common apis (#763) * chore: add examples for calling common apis * chore: add Voice tests * fix: correct className * fix: correct version (#765) * test: add clientTest * version fix * fix: drop removed APIs (#766) * fix: drop removed APIs * fix: revert to assertRegExp() * fix: correct default values for different data types (#768) * fix: correct indentation and camelCase version (#767) Co-authored-by: Twilio <team_interfaces+github@twilio.com> * fix: test failures for PhpUnit >=10 (#769) * [Librarian] Regenerated @ 6112a581d3189fe96d26eb29eb9adfdbd1c2ada5 * Release 7.0.0-rc.3 * [Librarian] Regenerated @ 17e62aff1baa8b949ed63e888ff63c1da8945fe5 * Release 7.0.0-rc.4 * chore: update upgrade guilde and contribution summary (#764) Co-authored-by: chsingh <chsingh@twilio.com> * chore: remove RC changes from Changes.md and Readme.md * chore: update changes file * chore: remove newly added integration tests * chore: remove .open-generator folders/files --------- Co-authored-by: Isha Bansal <ishabansal2467@gmail.com> Co-authored-by: Rohith Prakash <rohithprakashklm@gmail.com> Co-authored-by: Sam Harrison <sharrison@twilio.com> Co-authored-by: Isha Bansal <55244783+isha689@users.noreply.github.com> Co-authored-by: Twilio <team_interfaces+github@twilio.com>
- Loading branch information
1 parent
08aad5f
commit 39c0ec3
Showing
2,718 changed files
with
140,177 additions
and
174,133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
|
||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
// The phone number, SIP address, Client identifier or SIM SID that received this call. | ||
// Phone numbers are in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). | ||
// SIP addresses are formatted as name@company.com. | ||
// Client identifiers are formatted client:name. | ||
// SIM SIDs are formatted as sim:sid | ||
$to = "+XXXXXXXXXX"; | ||
|
||
// The phone number or client identifier to use as the caller id. | ||
// If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account. | ||
// If the "to" parameter is a phone number, "from" must also be a phone number. | ||
$from = "+XXXXXXXXXX"; | ||
|
||
// Make a phone call | ||
$call = $client->calls->create( | ||
$to, | ||
$from, | ||
["url" => "https://twilio.com"] | ||
); | ||
print("Call made successfully with sid: ".$call->sid."\n\n"); | ||
|
||
// Get some calls | ||
$callsList = $client->calls->read([],null,2); | ||
foreach ($callsList as $call) { | ||
print("Call {$call->sid}: {$call->duration} seconds\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
|
||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
function buyNumber(): ?Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberInstance{ | ||
// Look up some phone numbers | ||
global $client; | ||
|
||
// Specify the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the country | ||
// from which to read phone numbers, eg: "US" | ||
$numbers = $client->availablePhoneNumbers("XX")->local->read(); | ||
|
||
// Buy the first phone number | ||
if(!empty($numbers)){ | ||
$local = $numbers[0]; | ||
return $client->incomingPhoneNumbers->create(["phoneNumber" => $local->phoneNumber]); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
// Get a number | ||
$number = buyNumber(); | ||
print("Twilio purchased phoneNumber: ".$number->phoneNumber."\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
|
||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
// Specify the phone numbers in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212) | ||
// This parameter determines the destination phone number for your SMS message. Format this number with a '+' and a country code | ||
$phoneNumber = "+XXXXXXXXXX"; | ||
|
||
// This must be a Twilio phone number that you own, formatted with a '+' and country code | ||
$twilioPurchasedNumber = "+XXXXXXXXXX"; | ||
|
||
// Send a text message | ||
$message = $client->messages->create( | ||
$phoneNumber, | ||
[ | ||
'from' => $twilioPurchasedNumber, | ||
'body' => "Hey Jenny! Good luck on the bar exam!" | ||
] | ||
); | ||
print("Message sent successfully with sid = " . $message->sid ."\n\n"); | ||
|
||
// Print the last 10 messages | ||
$messageList = $client->messages->read([],10); | ||
foreach ($messageList as $msg) { | ||
print("ID:: ". $msg->sid . " | " . "From:: " . $msg->from . " | " . "TO:: " . $msg->to . " | " . " Status:: " . $msg->status . " | " . " Body:: ". $msg->body ."\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
|
||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
// Get last 10 records | ||
$recordList = $client->usage->records->read([], 10); | ||
foreach ($recordList as $record) { | ||
print_r("Record(accountSid=" . $record->accountSid . ", apiVersion=" . $record->apiVersion . ", asOf=" . $record->asOf . ", category=" . $record->category . ", count=" . $record->count . ", countUnit=" . $record->countUnit . ", description=" . $record->description . ", endDate=" . $record->endDate->format("Y-m-d H:i:s") . ", price=" . $record->price . ", priceUnit=" . $record->priceUnit . ", startDate=" . $record->startDate->format("Y-m-d H:i:s") . ", uri=" . $record->uri . ", usage=" . $record->usage . ", usageUnit=" . $record->usageUnit . "\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
require(__DIR__.'/../vendor/autoload.php'); | ||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
// Create new Signing Key | ||
$signingKey = $client->api->v2010->newSigningKeys->create(); | ||
|
||
// Switch to guzzle client as the default client | ||
$guzzleClient = new Client($signingKey->sid, $signingKey->secret, $sid, null, new \Twilio\Http\GuzzleClient(new \GuzzleHttp\Client)); | ||
|
||
// The phone number you are querying in E.164 or national format. | ||
// If the phone number is provided in national format, please also specify the country in the optional parameter CountryCode. | ||
// Otherwise, CountryCode will default to US. | ||
$number = "+XXXXXXXXXX"; | ||
|
||
// Make REST API requests | ||
$phone_number = $guzzleClient->lookups->v1->phoneNumbers($number) | ||
->fetch([ | ||
"type" => ["carrier"] | ||
]); | ||
|
||
print_r($phone_number->carrier); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
require(__DIR__.'/../src/Twilio/autoload.php'); | ||
|
||
use Twilio\Rest\Client; | ||
|
||
$sid = getenv('TWILIO_ACCOUNT_SID'); | ||
$token = getenv('TWILIO_AUTH_TOKEN'); | ||
$client = new Client($sid, $token); | ||
|
||
// Create Trunk | ||
$trunk = $client->trunking->v1->trunks->create( | ||
[ | ||
"friendlyName" => "shiny trunk", | ||
"secure" => false | ||
] | ||
); | ||
print("\n".$trunk."\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
require(__DIR__ . '/../vendor/autoload.php'); | ||
|
||
use Twilio\TwiML\VoiceResponse; | ||
|
||
// TwiML Say and Play | ||
$say = new \Twilio\TwiML\Voice\Say('Hello World!', [ | ||
'voice' => 'woman' | ||
]); | ||
|
||
$play = new \Twilio\TwiML\Voice\Play("https://api.twilio.com/cowbell.mp3", [ | ||
'loop' => 5 | ||
]); | ||
|
||
$twiml = new VoiceResponse(); | ||
$twiml->append($say); | ||
$twiml->append($play); | ||
|
||
print("TwiML Say and Play: \n{$twiml->asXML()}\n"); | ||
|
||
|
||
// Gather, Redirect | ||
$twimlResponse = new VoiceResponse(); | ||
$gather = $twimlResponse->gather(); | ||
$gather->setNumDigits(10); | ||
$gather->say("Press 1"); | ||
$twimlResponse->redirect("https://example.com"); | ||
print("TwiML Gather and Redirect: \n{$twimlResponse->asXML()}\n"); | ||
|
||
|
||
// Dial | ||
$twimlResponse = new VoiceResponse(); | ||
|
||
// A valid phone number formatted with a '+' and a country code (e.g., +16175551212) | ||
$callerID = '+XXXXXXXX'; | ||
$dial = $twimlResponse->dial('', [ | ||
'callerId' => $callerID, | ||
'action' => 'https:///example.com', | ||
'hangupOnStar' => true, | ||
]); | ||
|
||
$dial->conference("My Room", ["beep" => "true"]); | ||
print("TwiML Dial: \n{$twimlResponse->asXML()}\n"); |
Oops, something went wrong.