Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 3358a57

Browse files
maylonpedrosodprothero
authored andcommitted
Show usage of VoiceGrant optional parameter incoming_allow (#725)
1 parent 7a69861 commit 3358a57

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

rest/access-tokens/voice-example/voice-example.3.x.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const identity = 'user';
1313
// Create a "grant" which enables a client to use Voice as a given user
1414
const voiceGrant = new VoiceGrant({
1515
outgoingApplicationSid: outgoingApplicationSid,
16+
incomingAllow: true, // Optional: add to allow incoming calls
1617
});
1718

1819
// Create an access token which we will sign and return to the client,

rest/access-tokens/voice-example/voice-example.5.x.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ static void Main(string[] args)
1919
var grant = new VoiceGrant();
2020
grant.OutgoingApplicationSid = outgoingApplicationSid;
2121

22+
// Optional: add to allow incoming calls
23+
grant.IncomingAllow = true;
24+
2225
var grants = new HashSet<IGrant>
2326
{
2427
{ grant }

rest/access-tokens/voice-example/voice-example.5.x.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
$voiceGrant = new VoiceGrant();
2828
$voiceGrant->setOutgoingApplicationSid($outgoingApplicationSid);
2929

30+
// Optional: add to allow incoming calls
31+
$voiceGrant->setIncomingAllow(true);
32+
3033
// Add grant to token
3134
$token->addGrant($voiceGrant);
3235

rest/access-tokens/voice-example/voice-example.5.x.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
grant = Twilio::JWT::AccessToken::VoiceGrant.new
1414
grant.outgoing_application_sid = outgoing_application_sid
1515

16+
# Optional: add to allow incoming calls
17+
grant.incoming_allow = true
18+
1619
# Create an Access Token
1720
token = Twilio::JWT::AccessToken.new(
1821
account_sid,

rest/access-tokens/voice-example/voice-example.6.x.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
token = AccessToken(account_sid, api_key, api_secret, identity=identity)
1515

1616
# Create a Voice grant and add to token
17-
voice_grant = VoiceGrant(outgoing_application_sid=outgoing_application_sid)
17+
voice_grant = VoiceGrant(
18+
outgoing_application_sid=outgoing_application_sid,
19+
incoming_allow=True, # Optional: add to allow incoming calls
20+
)
1821
token.add_grant(voice_grant)
1922

2023
# Return token info as JSON

rest/access-tokens/voice-example/voice-example.7.x.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public static void main(String[] args) {
1616
// Create Voice grant
1717
VoiceGrant grant = new VoiceGrant();
1818
grant.setOutgoingApplicationSid(outgoingApplicationSid);
19+
20+
// Optional: add to allow incoming calls
21+
grant.setIncomingAllow(true);
1922

2023
// Create access token
2124
AccessToken token = new AccessToken.Builder(

0 commit comments

Comments
 (0)