Moderated Conference

A caller will be able to join the conference room “My Room” and will hear music, but the conference will not start until the moderator joins the conference.

Next, the moderator has set endConferenceOnExit to true, so when the moderator hangs up, the conference will end. and each participant will also exit the conference.

Response

<Response>
	<Conference startConferenceOnEnter="false" waitSound="http://www.foo.com/waitmusic/">My Room</Conference>
</Response>

XML for the moderator:

<Response>
	<Conference startConferenceOnEnter="true" endConferenceOnExit="true">My Room</Conference>
</Response>

Example Request

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

response = plivoxml.ResponseElement()
response.add(
    plivoxml.ConferenceElement(
        'My Room',
        start_conference_on_enter=False,
        wait_sound='http://www.foo.com/waitmusic/'))

print(response.to_string())

# Next, XML for moderator with endConferenceOnExit set to true

moderator_response = plivoxml.ResponseElement()
moderator_response.add(
    plivoxml.ConferenceElement(
        'My Room', start_conference_on_enter=True, end_conference_on_exit=
        True))

print(moderator_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 = {
    'startConferenceOnEnter' => "false",
    'waitSound' => "https://www.foo.com/waitmusic/"
  }

  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

begin
  response = Response.new

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

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

var response = plivo.Response();

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

console.log(response.toXML());

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


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

var response = plivo.Response();

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

console.log(response.toXML());

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

    $response = new Response();

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

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

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

    /*
    Sample Output

    <Response>
        <Conference startConferenceOnEnter="false" waitSound="https://www.foo.com/waitmusic/">My Room</Conference>
    </Response>
    */
?>

<?php
    /*Code to generate XML to be returned from url at waitSound*/

    require '../vendor/autoload.php';
    use Plivo\XML\Response;

    $response = new Response();

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

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

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

    /*
    Sample Output

    <Response>
        <Conference startConferenceOnEnter="true" endConferenceOnExit="true">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
27
// Example for conference - moderated conference
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;
import com.plivo.api.xml.Speak;


class ModeratedConference {
    public static void main(String[] args) throws PlivoXmlException {
        Response response = new Response()
                .children(


                        new Speak("You will now be placed into a demo conference.This is brought\n to you by Plivo.To know more visit us at plivo.com"),


                        new Conference("demo")
                                .endConferenceOnExit(true)
                                .startConferenceOnEnter(false)
                                .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
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>()
			{
				{"startConferenceOnEnter", "true"},
				{"endConferenceOnExit", "true"},
				{"waitSound", "http://www.foo.com/waitmusic/"}
			});
			var output = resp.ToString();
			Console.WriteLine(output);

		}
	}
}



//<Response>
//    <Conference startConferenceOnEnter = "true" 
//     endConferenceOnExit="true" 
//     waitSound="http://www.foo.com/waitmusic/">
//         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
27
28
29
30
31
// Example for conference - moderated conference
package main

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


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


			new(xml.SpeakElement).
			SetContents("You will now be placed into a demo conference.This is brought\n to you by Plivo.To know more visit us at plivo.com"),

			





			new(xml.ConferenceElement).
			SetEndConferenceOnExit(true).
			SetStartConferenceOnEnter(false).
			SetWaitSound("http://www.foo.com/waitmusic/").
			SetContents("demo   "),

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