如何在C#中实现Twilio Conference HangUpOnStar

时间:2018-09-24 00:54:41

标签: c# twilio twiml conference

在C#中,此Twilio TwiML等效于什么?我对用C#实现hangupOnStar并将调用传递到另一个URL最为感兴趣。

<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Dial hangupOnStar="true">
    <Conference>ConferenceOne</Conference>
</Dial>
<Gather action="http://example.ngrok.io/Conference/Join" numDigits="1">
    <Say>To mute all participants, press one</Say>
    <Say>To leave the conference, press two</Say>
</Gather>
</Response>

1 个答案:

答案 0 :(得分:0)

“ hanguponstar”必须添加到“拨号”示例中:

  

var Dial = new Dial(hangupOnStar:true);

// POST: Conference/Connect
    [HttpPost]
    public ActionResult Connect(string digits)
    {
        var isMuted = digits.Equals("1"); // Listener
        var canControlConferenceOnEnter = digits.Equals("3"); // Moderator

        var response = new VoiceResponse();
        response.Say("You have joined the conference");

        var dial = new Dial(hangupOnStar: true);
        dial.Conference("ConferenceRoom",
            waitUrl: new Uri("http://twimlets.com/holdmusic?Bucket=com.twilio.music.rock"),                
            muted: isMuted,
            startConferenceOnEnter: canControlConferenceOnEnter,
            endConferenceOnExit: canControlConferenceOnEnter);
            response.Append(dial);
        response.Gather();

        return TwiML(response);

    }