Send Digits

    In this example, the digits 1234 are sent on the live call.

    Response

    <Response>
        <DTMF>1234</DTMF>
    </Response>
    

    Example Request

    1
    2
    3
    4
    5
    
    from plivo import plivoxml
    
    response = plivoxml.ResponseElement()
    response.add(plivoxml.DTMFElement('1234'))
    print(response.to_string())
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    require 'rubygems'
    require 'plivo'
    
    include Plivo::XML
    include Plivo::Exceptions
    
    begin
      response = Response.new
    
      dtmf = "12345"
      response.addDTMF(dtmf)
    
      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
    
    var plivo = require('plivo');
    
    var response = plivo.Response();
    
    var dtmf = "12345";
    response.addDTMF(dtmf);
    
    console.log(response.toXML());
    
    /*
    Sample Output
    <Response>
        <DTMF>12345</DTMF>
    </Response>
    */
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    <?php
        require '../vendor/autoload.php';
        use Plivo\XML\Response;
    
        $response = new Response();
    
        $dtmf = "12345";
        $response->addDTMF($dtmf);
    
        Header('Content-type: text/xml');
        echo($response->toXML());
    
        /*
        Sample Output
    
        <Response>
            <DTMF>12345</DTMF>
        </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 xml - send digits
    package com.plivo.api.xml.samples.xml;
    
    import com.plivo.api.exceptions.PlivoXmlException;
    import com.plivo.api.xml.Dtmf;
    import com.plivo.api.xml.Response;
    import com.plivo.api.xml.Speak;
    
    
    class SendDigits {
        public static void main(String[] args) throws PlivoXmlException {
            Response response = new Response()
                    .children(
    
    
                            new Speak("Sending Digits"),
    
    
                            new Dtmf("12345")
    
                    );
            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
    
    using System;
    using System.Collections.Generic;
    using Plivo.XML;
    
    namespace Plivo
    {
       class MainClas
       {
           public static void Main(string[] args)
           {
               Plivo.XML.Response resp = new Plivo.XML.Response();
               resp.AddDTMF("12345", 
                 new Dictionary<string, string>() { });
    			var output = resp.ToString();
               Console.WriteLine(output);
    
           }
       }
    }
    
    
    
    //<Response>
    //  <DTMF>12345</DTMF>
    //</Response>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    // Example for xml - dtmf
    package main
    
    import "github.com/plivo/plivo-go/xml"
    
    func main() {
    	response := xml.ResponseElement{
    		Contents: []interface{}{
    
    			new(xml.SpeakElement).
    				SetContents("Sending Digits"),
    
    			new(xml.DTMFElement).
    				SetContents("12345"),
    		},
    	}
    	print(response.String())
    }