forked from TwilioDevEd/api-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conference snippet to make call with friendly name
- Loading branch information
Showing
11 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
rest/participant/list-post-example-1/list-post-example-1.3.x.js
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,12 @@ | ||
// Download the Node helper library from twilio.com/docs/node/install | ||
// These consts are your accountSid and authToken from https://www.twilio.com/console | ||
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; | ||
const authToken = 'your_auth_token'; | ||
const client = require('twilio')(accountSid, authToken); | ||
|
||
client.conferences('AgentConf12') | ||
.participants.create({ | ||
to: '+15624421212', | ||
from: '+18180021216' | ||
}) | ||
.then((participant) => console.log(participant.sid)); |
24 changes: 24 additions & 0 deletions
24
rest/participant/list-post-example-1/list-post-example-1.5.x.cs
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,24 @@ | ||
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp | ||
using System; | ||
using Twilio; | ||
using Twilio.Rest.Api.V2010.Account.Conference; | ||
using Twilio.Types; | ||
|
||
class Example | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
// Find your Account Sid and Auth Token at twilio.com/console | ||
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
const string authToken = "your_auth_token"; | ||
TwilioClient.Init(accountSid, authToken); | ||
|
||
const string conferenceFriendlyName = "AgentConf12"; | ||
var from = new PhoneNumber("+18180021216"); | ||
var to = new PhoneNumber("+15624421212"); | ||
var participant = ParticipantResource.Create( | ||
conferenceFriendlyName, from, to); | ||
|
||
Console.WriteLine(participant.CallSid); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
rest/participant/list-post-example-1/list-post-example-1.5.x.php
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,21 @@ | ||
<?php | ||
// Get the PHP helper library from twilio.com/docs/php/install | ||
require_once '/path/to/vendor/autoload.php'; // Loads the library | ||
use Twilio\Rest\Client; | ||
|
||
// Your Account Sid and Auth Token from twilio.com/user/account | ||
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
$token = "your_auth_token"; | ||
$client = new Client($sid, $token); | ||
|
||
// Get an object from its sid. If you do not have a sid, | ||
// check out the list resource examples on this page | ||
$participant = $client | ||
->conferences("AgentConf12") | ||
->participants | ||
->create([ | ||
'from' => '+18180021216', | ||
'to' => '+15624421212' | ||
]); | ||
|
||
echo $participant->callSid; |
18 changes: 18 additions & 0 deletions
18
rest/participant/list-post-example-1/list-post-example-1.5.x.rb
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,18 @@ | ||
require 'rubygems' # not necessary with ruby 1.9 but included for completeness | ||
require 'twilio-ruby' | ||
|
||
# put your own credentials here | ||
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | ||
auth_token = 'your_auth_token' | ||
|
||
# set up a client to talk to the Twilio REST API | ||
@client = Twilio::REST::Client.new(account_sid, auth_token) | ||
|
||
@participant = @client.api.conferences('AgentConf12') | ||
.participants | ||
.create( | ||
from: '+18180021216', | ||
to: '+15624421212' | ||
) | ||
|
||
puts @participant.call_sid |
16 changes: 16 additions & 0 deletions
16
rest/participant/list-post-example-1/list-post-example-1.6.x.py
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,16 @@ | ||
# Download the Python helper library from twilio.com/docs/python/install | ||
from twilio.rest import Client | ||
|
||
# Your Account Sid and Auth Token from twilio.com/user/account | ||
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | ||
auth_token = "your_auth_token" | ||
client = Client(account_sid, auth_token) | ||
|
||
fromNumber = "+18180021216" | ||
toNumber = "+15624421212" | ||
participant = client \ | ||
.conferences("AgentConf12") \ | ||
.participants \ | ||
.create(fromNumber, toNumber) | ||
|
||
print(participant.call_sid) |
23 changes: 23 additions & 0 deletions
23
rest/participant/list-post-example-1/list-post-example-1.7.x.java
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,23 @@ | ||
// Install the Java helper library from twilio.com/docs/java/install | ||
import com.twilio.Twilio; | ||
import com.twilio.rest.api.v2010.account.conference.Participant; | ||
import com.twilio.type.PhoneNumber; | ||
|
||
public class Example { | ||
/// Find your Account Sid and Token at twilio.com/user/account | ||
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | ||
public static final String AUTH_TOKEN = "your_auth_token"; | ||
|
||
public static void main(String[] args) { | ||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN); | ||
|
||
String conferenceFriendlyName = "AgentConf12"; | ||
PhoneNumber from = new PhoneNumber("+18180021216"); | ||
PhoneNumber to = new PhoneNumber("+15624421212"); | ||
Participant participant = Participant | ||
.creator(conferenceFriendlyName, from, to) | ||
.create(); | ||
|
||
System.out.println(participant.getCallSid()); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
rest/participant/list-post-example-1/list-post-example-1.json.curl
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,4 @@ | ||
curl 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conferences/AgentConf12/Participants.json' -X POST \ | ||
--data-urlencode 'To=+15624421212' \ | ||
--data-urlencode 'From=+18180021216' \ | ||
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token' |
4 changes: 4 additions & 0 deletions
4
rest/participant/list-post-example-1/list-post-example-1.xml.curl
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,4 @@ | ||
curl 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conferences/AgentConf12/Participants' -X POST \ | ||
--data-urlencode 'To=+15624421212' \ | ||
--data-urlencode 'From=+18180021216' \ | ||
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token' |
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,4 @@ | ||
{ | ||
"title": "Make Outbound Conference Call", | ||
"type": "server" | ||
} |
12 changes: 12 additions & 0 deletions
12
rest/participant/list-post-example-1/output/list-post-example-1.json
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,12 @@ | ||
{ | ||
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"conference_sid": "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"date_created": "Wed, 18 Aug 2010 20:20:10 +0000", | ||
"date_updated": "Wed, 18 Aug 2010 20:23:06 +0000", | ||
"end_conference_on_exit": true, | ||
"muted": true, | ||
"hold": false, | ||
"start_conference_on_enter": true, | ||
"uri": "2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conferences/CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json" | ||
} |
14 changes: 14 additions & 0 deletions
14
rest/participant/list-post-example-1/output/list-post-example-1.xml
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 @@ | ||
<TwilioResponse> | ||
<Participant> | ||
<CallSid>CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</CallSid> | ||
<ConferenceSid>CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</ConferenceSid> | ||
<AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid> | ||
<Muted>true</Muted> | ||
<Hold>false</Hold> | ||
<EndConferenceOnExit>true</EndConferenceOnExit> | ||
<StartConferenceOnEnter>true</StartConferenceOnEnter> | ||
<DateCreated>Wed, 18 Aug 2010 20:20:10 +0000</DateCreated> | ||
<DateUpdated>Wed, 18 Aug 2010 20:23:23 +0000</DateUpdated> | ||
<Uri>2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conferences/CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Uri> | ||
</Participant> | ||
</TwilioResponse> |