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

Commit cfacf27

Browse files
Merge pull request #869 from TwilioDevEd/number-url-example
Add <Number url> TwiML example.
2 parents cfae578 + b90fd9a commit cfacf27

File tree

8 files changed

+80
-0
lines changed

8 files changed

+80
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"title": "Running TwiML before parties are connected",
3+
"type": "server"
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2+
3+
const response = new VoiceResponse();
4+
const dial = response.dial();
5+
dial.number({
6+
url: 'http://example.com/agent_screen_call'
7+
}, '415-123-4567');
8+
9+
console.log(response.toString());
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using Twilio.TwiML;
3+
using Twilio.TwiML.Voice;
4+
5+
6+
class Example
7+
{
8+
static void Main()
9+
{
10+
var response = new VoiceResponse();
11+
var dial = new Dial();
12+
dial.Number("415-123-4567", url: new Uri("http://example.com/agent_screen_call"));
13+
response.Append(dial);
14+
15+
Console.WriteLine(response.ToString());
16+
}
17+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
require_once './vendor/autoload.php';
3+
use Twilio\TwiML\VoiceResponse;
4+
5+
$response = new VoiceResponse();
6+
$dial = $response->dial('');
7+
$dial->number('415-123-4567', ['url' => 'http://example.com/agent_screen_call']);
8+
9+
echo $response;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'twilio-ruby'
2+
3+
response = Twilio::TwiML::VoiceResponse.new
4+
response.dial do |dial|
5+
dial.number('415-123-4567', url: 'http://example.com/agent_screen_call')
6+
end
7+
8+
puts response
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from twilio.twiml.voice_response import Dial, Number, VoiceResponse
2+
3+
response = VoiceResponse()
4+
dial = Dial()
5+
dial.number('415-123-4567', url='http://example.com/agent_screen_call')
6+
response.append(dial)
7+
8+
print(response)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import com.twilio.twiml.voice.Dial;
2+
import com.twilio.twiml.voice.Number;
3+
import com.twilio.twiml.VoiceResponse;
4+
import com.twilio.twiml.TwiMLException;
5+
6+
7+
public class Example {
8+
public static void main(String[] args) {
9+
Number number = new Number.Builder("415-123-4567").url("http://example.com/agent_screen_call").build();
10+
Dial dial = new Dial.Builder().number(number).build();
11+
VoiceResponse response = new VoiceResponse.Builder().dial(dial).build();
12+
13+
try {
14+
System.out.println(response.toXml());
15+
} catch (TwiMLException e) {
16+
e.printStackTrace();
17+
}
18+
}
19+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Response>
3+
<Dial>
4+
<Number url="http://example.com/agent_screen_call">415-123-4567</Number>
5+
</Dial>
6+
</Response>

0 commit comments

Comments
 (0)