allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
34
vendor/twilio/sdk/example/call.php
vendored
Normal file
34
vendor/twilio/sdk/example/call.php
vendored
Normal file
@@ -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");
|
||||
}
|
||||
29
vendor/twilio/sdk/example/incomingPhoneNumber.php
vendored
Normal file
29
vendor/twilio/sdk/example/incomingPhoneNumber.php
vendored
Normal file
@@ -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");
|
||||
31
vendor/twilio/sdk/example/message.php
vendored
Normal file
31
vendor/twilio/sdk/example/message.php
vendored
Normal file
@@ -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");
|
||||
}
|
||||
54
vendor/twilio/sdk/example/messaging_bulk.php
vendored
Normal file
54
vendor/twilio/sdk/example/messaging_bulk.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
require(__DIR__.'/../src/Twilio/autoload.php');
|
||||
|
||||
use Twilio\Rest\Client;
|
||||
use Twilio\Rest\PreviewMessaging\V1\MessageModels;
|
||||
|
||||
$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
|
||||
$phoneNumber1 = "+XXXXXXXXXX";
|
||||
$phoneNumber2 = "+XXXXXXXXXX";
|
||||
|
||||
// Create message object for the recipients
|
||||
$message1 = MessageModels::createMessagingV1Message(
|
||||
[
|
||||
'to' => $phoneNumber1,
|
||||
]
|
||||
);
|
||||
$message2 = MessageModels::createMessagingV1Message(
|
||||
[
|
||||
'to' => $phoneNumber2,
|
||||
]
|
||||
);
|
||||
|
||||
// Create list of the message objects
|
||||
$messages = [$message1, $message2];
|
||||
|
||||
// This must be a Twilio phone number that you own, formatted with a '+' and country code
|
||||
$twilioPurchasedNumber = "+XXXXXXXXXX";
|
||||
// Specify the message to be sent - JSON string supported
|
||||
$messageBody = "Hello from twilio-php!";
|
||||
|
||||
// Create Message Request object
|
||||
$createMessagesRequest = MessageModels::createCreateMessagesRequest(
|
||||
[
|
||||
'messages' => $messages,
|
||||
'from' => $twilioPurchasedNumber,
|
||||
'body' => $messageBody,
|
||||
]
|
||||
);
|
||||
|
||||
// Send a Bulk Message
|
||||
$message = $client->previewMessaging->v1->messages->create($createMessagesRequest);
|
||||
|
||||
// Print how many messages were successful
|
||||
print($message->successCount . " messages sent successfully!" . "\n\n");
|
||||
|
||||
// Print the message details
|
||||
foreach ($message->messageReceipts as $msg) {
|
||||
print("ID:: " . $msg["sid"] . " | " . "TO:: " . $msg["to"] . "\n");
|
||||
}
|
||||
20
vendor/twilio/sdk/example/orgs_api_example.php
vendored
Normal file
20
vendor/twilio/sdk/example/orgs_api_example.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require(__DIR__.'/../src/Twilio/autoload.php');
|
||||
|
||||
use Twilio\Rest\Client;
|
||||
use Twilio\CredentialProvider\OrgsCredentialProviderBuilder;
|
||||
|
||||
$clientId = getenv('ORGS_CLIENT_ID');
|
||||
$clientSecret = getenv('ORGS_CLIENT_SECRET');
|
||||
$orgSid = getenv('ORG_SID');
|
||||
|
||||
$orgsCredentialProvider = (new OrgsCredentialProviderBuilder())->setClientId($clientId)->setClientSecret($clientSecret)->build();
|
||||
|
||||
$client = new Client();
|
||||
$client->setCredentialProvider($orgsCredentialProvider);
|
||||
|
||||
//list users
|
||||
$users = $client->previewIam->organization($orgSid)->users->read();
|
||||
foreach ($users as $user) {
|
||||
printf("User SID: %s\n", $user->id);
|
||||
}
|
||||
22
vendor/twilio/sdk/example/public_oauth_example.php
vendored
Normal file
22
vendor/twilio/sdk/example/public_oauth_example.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require(__DIR__.'/../src/Twilio/autoload.php');
|
||||
|
||||
use Twilio\Rest\Client;
|
||||
use Twilio\CredentialProvider\ClientCredentialProviderBuilder;
|
||||
|
||||
$accountSid = getenv('TWILIO_ACCOUNT_SID');
|
||||
$token = getenv('TWILIO_AUTH_TOKEN');
|
||||
|
||||
$clientId = getenv('OAUTH_CLIENT_ID');
|
||||
$clientSecret = getenv('OAUTH_CLIENT_SECRET');
|
||||
|
||||
$clientCredentialProvider = (new ClientCredentialProviderBuilder())->setClientId($clientId)->setClientSecret($clientSecret)->build();
|
||||
|
||||
$client = new Client();
|
||||
$client->setCredentialProvider($clientCredentialProvider);
|
||||
$client->setAccountSid($accountSid);
|
||||
|
||||
$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");
|
||||
}
|
||||
14
vendor/twilio/sdk/example/record.php
vendored
Normal file
14
vendor/twilio/sdk/example/record.php
vendored
Normal file
@@ -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");
|
||||
}
|
||||
27
vendor/twilio/sdk/example/signingKey.php
vendored
Normal file
27
vendor/twilio/sdk/example/signingKey.php
vendored
Normal file
@@ -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);
|
||||
17
vendor/twilio/sdk/example/trunk.php
vendored
Normal file
17
vendor/twilio/sdk/example/trunk.php
vendored
Normal file
@@ -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");
|
||||
43
vendor/twilio/sdk/example/twiML.php
vendored
Normal file
43
vendor/twilio/sdk/example/twiML.php
vendored
Normal file
@@ -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");
|
||||
Reference in New Issue
Block a user