Waiting Room

This code places the first caller into a waiting room, where the caller will hear music. It is similar to placing a caller on hold, waiting for an agent or operator to help them.

The second XML enables the operator to join the person who was put on hold in the Conference room. The conference starts when the operator enters the room and the hold music will stop. Since enterSound="", therefore the caller will not hear any sound when the agent answers. When the moderator hangs up, the conference will end since the endConferenceOnExit is set to ‘true’.

Response

<Response>
	<Conference waitSound="http://www.foo.com/waitmusic/" enterSound="">Waiting Room</Conference>
</Response>

XML for the operator:

<Response>
	<Conference enterSound="" endConferenceOnExit="true">Waiting Room</Conference>
</Response>

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from plivo import plivoxml

response = plivoxml.ResponseElement()
response.add(
    plivoxml.ConferenceElement(
        'Waiting Room',
        wait_sound='http://www.foo.com/waitmusic/',
        enter_sound=''))
print(response.to_string())

# Now, the XML for the operator
operator_response = plivoxml.ResponseElement()
operator_response.add(
    plivoxml.ConferenceElement(
        'Waiting Room', enter_sound='', end_conference_on_exit=True))
print(operator_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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'rubygems'
require 'plivo'

include Plivo::XML
include Plivo::Exceptions

begin
  response = Response.new

  params = {
    'waitSound' => "https://www.foo.com/waitmusic/",
    'enterSound' => ""
  }

  conference_name = "Waiting Room"
  response.addConference(conference_name, params)

  xml = PlivoXML.new(response)
  puts xml.to_xml
rescue PlivoXMLError => e
  puts 'Exception: ' + e.message
end

begin
  response = Response.new

  params = {
    'endConferenceOnExit' => "true",
    'enterSound' => ""
  }

  conference_name = "Waiting 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var plivo = require('plivo');

var response = plivo.Response();

var params = {
    'waitSound': "https://www.foo.com/waitMusic/"
};
var conference_name = "Waiting Room";
response.addConference(conference_name, params);

console.log(response.toXML());

/*
Sample Output
<Response>
    <Conference waitSound="https://www.foo.com/waitMusic/">Waiting Room</Conference>
</Response>
*/


/* Code to generate XML to be returned from url at waitSound */
var plivo = require('plivo');

var response = plivo.Response();

var params = {
    'enterSound': "",
    'endConferenceOnExit': "true"
};
var conference_name = "Waiting Room";
response.addConference(conference_name, params);

console.log(response.toXML());

/*
Sample Output
<Response>
    <Conference enterSound="" endConferenceOnExit="true">Waiting 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
    require '../vendor/autoload.php';
    use Plivo\XML\Response;

    $response = new Response();

    $params = array(
        'waitSound' => "https://www.foo.com/waitmusic/"
    );

    $conference_name = "Waiting Room";
    $response->addConference($conference_name, $params);

    Header('Content-type: text/xml');
    echo($response->toXML());

    /*
    Sample Output

    <Response>
        <Conference waitSound="https://www.foo.com/waitmusic/">Waiting Room</Conference>
    </Response>
    */

    $response = new Response();

    $params = array(
        'endConferenceOnExit' => "true"
    );

    $conference_name = "Waiting Room";
    $response->addConference($conference_name, $params);

    Header('Content-type: text/xml');
    echo($response->toXML());

    /*
    Sample Output

    <Response>
        <Conference endConferenceOnExit="true">Waiting 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
// Example for conference - waiting room
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 WaitingRoom {
    public static void main(String[] args) throws PlivoXmlException {
        Response response = new Response()
                .children(


                        new Conference("Waiting Room")
                                .endConferenceOnExit(true)
                                .enterSound("")
                                .waitSound("http://www.foo.com/waitmusic/")

                );
        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
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>()
			{
				{"waitSound", "http://www.foo.com/waitmusic/"},
				{"enterSound", ""}
			});
			var output = resp.ToString();
			Console.WriteLine(output);

		}
	}
}



//<Response>
//  <Conference waitSound = "http://www.foo.com/waitmusic/" 
//    enterSound="">
//    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
// Example for conference - waiting room
package main

import "github.com/plivo/plivo-go/xml"


func main() {
	response := xml.ResponseElement{
		Contents: []interface{} {
			





			new(xml.ConferenceElement).
			SetEndConferenceOnExit(true).
			SetEnterSound("").
			SetWaitSound("http://www.foo.com/waitmusic/").
			SetContents("Waiting Room"),

		},
	}
	print(response.String())
}