Using Callback URL

    When a member enters and leaves conference, an HTTP POST request is sent to the specified callbackUrl.

    When the user presses the digits that match with the digitsMatch parameter, an HTTP POST request is sent to the callbackUrl. See the callbackUrl Request Parameters table for a list of parameters that are sent to the callback URL.

    Response

    <Response>
    	<Conference callbackUrl="http://foo.com/confevents/" callbackMethod="POST" digitsMatch="#0,99,000">My Room</Conference>
    </Response>
    

    Example Request

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    
    from plivo import plivoxml
    
    response = plivoxml.ResponseElement()
    response.add(
        plivoxml.ConferenceElement(
            'My Room',
            callback_url='http://foo.com/confevents/',
            callback_method='POST',
            digits_match='#0,99,000'))
    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
    
      params = {
        'callbackUrl' => "https://www.foo.com/confevents/",
        'callbackMethod' => "POST",
        'digitsMatch' => "#0,99,000"
      }
    
      conference_name = "My Room"
      response.addConference(conference_name, 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
    
    var plivo = require('plivo');
    
    var response = plivo.Response();
    
    var params = {
        'callbackUrl': "https://www.foo.com/confevents/",
        'callbackMethod': "POST",
        'digitsMatch': "#0,99,000"
    };
    var conference_name = "My Room";
    response.addConference(conference_name, params);
    
    console.log(response.toXML());
    
    /*
    Sample Output
    <Response>
        <Conference callbackUrl="https://www.foo.com/confevents/" callbackMethod="POST" digitsMatch="#0,99,000">My Room</Conference>
    </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
    
    <?php
        require '../vendor/autoload.php';
        use Plivo\XML\Response;
    
        $response = new Response();
    
        $params = array(
            'callbackUrl' => "https://www.foo.com/confevents/",
            'callbackMethod' => "POST",
            'digitsMatch' => "#0,99,000"
        );
    
        $conference_name = "My Room";
        $response->addConference($conference_name, $params);
    
        Header('Content-type: text/xml');
        echo($response->toXML());
    
        /*
        Sample Output
    
        <Response>
            <Conference callbackUrl="https://www.foo.com/confevents/" callbackMethod="POST" digitsMatch="#0,99,000">My Room</Conference>
        </Response>
        */
    ?>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    // Example for conference - using callback url
    package com.plivo.api.xml.samples.conference;
    
    import com.plivo.api.exceptions.PlivoXmlException;
    import com.plivo.api.xml.Conference;
    import com.plivo.api.xml.Response;
    
    
    class UsingCallbackUrl {
        public static void main(String[] args) throws PlivoXmlException {
            Response response = new Response()
                    .children(
                            new Conference("My Room")
                                    .callbackMethod("POST")
                                    .callbackUrl("http://foo.com/confevents/")
                                    .digitsMatch("#0,99,000")
                    );
            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
    
    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();
    			resp.AddConference("My room",
    				 new Dictionary<string, string>()
    			{
    				{"callbackUrl", "http://foo.com/confevents/"},
    				{"callbackMethod", "POST"},
    				{"digitsMatch", "#0,99,000"}
    			});
    			var output = resp.ToString();
    			Console.WriteLine(output);
    
    		}
    	}
    }
    
    
    
    //<Response>
    //  <Conference callbackUrl = "http://foo.com/confevents/" 
    //    callbackMethod="POST" 
    //    digitsMatch="#0,99,000">
    //        My room
    //  </Conference>
    //</Response>
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
    // Example for conference - callback url
    package main
    import "github.com/plivo/plivo-go/xml"
    
    func main() {
    	response := xml.ResponseElement{
    		Contents: []interface{} {
    			new(xml.ConferenceElement).
    			SetCallbackMethod("POST").
    			SetCallbackUrl("http://foo.com/confevents/").
    			SetDigitsMatch("#0,99,000").
    			SetContents("My Room"),
    		},
    	}
    	print(response.String())
    }