Dialing extensions
This code dials the extension 2410 at the number 15671234567. The Number element describes the phone number and gives it the sendDigits
attribute. To dial the extension a couple of seconds after the number is dialed, we add a few leading w
characters, telling Plivo to wait 0.5 seconds for each w
.
Response
<Response>
<Dial>
<Number sendDigits="wwww2410">15671234567</Number>
</Dial>
</Response>
Example Request
1
2
3
4
5
6
from plivo import plivoxml
response = plivoxml.ResponseElement()
response.add(plivoxml.DialElement().add(
plivoxml.NumberElement('15671234567', send_digits='wwww2410')))
print(response.to_string())
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'rubygems'
require 'plivo'
include Plivo::XML
include Plivo::Exceptions
begin
response = Response.new
dial = response.addDial()
params = {
'sendDigits' => "wwww2410"
}
number = "1111111111"
dial.addNumber(number, params)
xml = PlivoXML.new(response)
puts xml.to_xml
rescue PlivoXMLError => e
puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var plivo = require('plivo');
var response = plivo.Response();
var dial = response.addDial();
var params = {
'sendDigits': "wwww2410"
};
var number = "1111111111";
dial.addNumber(number, params);
console.log(response.toXML());
/*
Sample Output
<Response>
<Dial>
<Number sendDigits="wwww2410">1111111111</Number>
</Dial>
</Response>
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require '../../vendor/autoload.php';
use Plivo\XML\Response;
$response = new Response();
$dial = $response->addDial();
$params = array(
'sendDigits' => "wwww2410",
);
$number = "1111111111";
$dial->addNumber($number, $params);
Header('Content-type: text/xml');
echo($response->toXML());
/*
Sample Output
<Response>
<Dial>
<Number sendDigits="wwww2410">1111111111</Number>
</Dial>
</Response>
*/
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Example for number - dialing extensions
package com.plivo.api.xml.samples.number;
import com.plivo.api.exceptions.PlivoXmlException;
import com.plivo.api.xml.Dial;
import com.plivo.api.xml.Number;
import com.plivo.api.xml.Response;
class DialingExtensions {
public static void main(String[] args) throws PlivoXmlException {
Response response = new Response()
.children(
new Dial()
.children(
new Number("18217654321")
.sendDigits("wwww2410")
)
);
System.out.println(response.toXmlString());
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using Plivo.XML;
namespace Plivo
{
class MainClass
{
public static void Main(string[] args)
{
Plivo.XML.Response resp = new Plivo.XML.Response();
Plivo.XML.Dial dial = new Plivo.XML.Dial(new
Dictionary<string, string>()
{ });
dial.AddNumber("18217654321",
new Dictionary<string, string>()
{
{"sendDigits", "wwww2410"}
});
resp.Add(dial);
var output = resp.ToString();
Console.WriteLine(output);
}
}
}
//<Response>
// <Dial>
// <Number sendDigits = "wwww2410" >
// 18217654321
// </ Number >
// </ Dial >
//</ Response >
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Example for number - dialing extensions
package main
import "github.com/plivo/plivo-go/v7/xml"
func main() {
response := xml.ResponseElement{
Contents: []interface{}{
new(xml.DialElement).
SetContents([]interface{}{
new(xml.NumberElement).
SetSendDigits("wwww2410").
SetContents("18217654321"),
}),
},
}
print(response.String())
}
Rate this page
🥳 Thank you! It means a lot to us!
×
Help Us Improve
Thank you so much for rating the page, we would like to get your input for further improvements!
Subscribe to Updates
Thank you for your feedback!