我想让听众在电话会议期间按*键要求取消静音,主持人可以从控制台取消他/她的静音。
我有一个控制器,具有以下内容:
def conference_connect
@room_name = flash[:room_name]
@room_id = flash[:event_id]
case params['Digits']
when "1" # listener
@muted = "true"
when "3" # moderator
@moderator = "true"
end
response = Twilio::TwiML::VoiceResponse.new
response.say(voice: 'alice', language: 'en-US', message: 'You are in, press * at anytime to ask a question')
dial = Twilio::TwiML::Dial.new(hangupOnStar: true)
dial.conference(@room_name,
wait_url: "http://twimlets.com/holdmusic?xxxxxxx&",
muted: @muted || "false",
start_conference_on_enter: @moderator || "false",
end_conference_on_exit: @moderator || "false",
)
gather = Twilio::TwiML::Gather.new(action: '/redirectIntoConference?name= ' + @room_name, digits: 1)
response.append(dial)
end
我有以下错误:
No template found for TwilioController#conference_connect, rendering head :no_content
我想向主持人发送消息(或更新一些参数)以通知他听众有问题要问。
Twilio开发者传道者在这里。
你有几个问题在这里。首先,您的错误是因为您没有返回您在控制器操作中构建的TwiML,而Rails正在寻找模板。
在行动结束时,render
会这样:
response.append(dial)
render xml: response.to_xml
end
至于要求在*
上发言,你就在那里。首先,<Gather>
不会帮助你,所以摆脱这条线:
gather = Twilio::TwiML::Gather.new(action: '/redirectIntoConference?name= ' + @room_name, digits: 1)
相反,你在hangupOnStar
中将<Dial>
设置为true,这将使用户与会议断开连接(听起来很糟糕,但这就是你想要的)。您只需要设置用户挂断后会发生什么。
在这种情况下,您希望向主持人发出请求,然后让他们重新加入会议。你使用action
parameter上的<Dial>
执行此操作,该hangupOnStar
指向呼叫者离开会议时将请求的URL。
在此操作中,您需要以某种方式提醒您的主持人(我不确定您的计划方式),然后返回TwiML以进入会议的呼叫者。不要忘记使用action
和def conference_connect
@room_name = flash[:room_name]
@room_id = flash[:event_id]
case params['Digits']
when "1" # listener
@muted = "true"
when "3" # moderator
@moderator = "true"
end
response = Twilio::TwiML::VoiceResponse.new
response.say(voice: 'alice', language: 'en-US', message: 'You are in, press * at anytime to ask a question')
dial = Twilio::TwiML::Dial.new(hangupOnStar: true, action: '/redirectIntoConference?name= ' + @room_name)
dial.conference(@room_name,
wait_url: "http://twimlets.com/holdmusic?xxxxxxx&",
muted: @muted || "false",
start_conference_on_enter: @moderator || "false",
end_conference_on_exit: @moderator || "false",
)
response.append(dial)
render xml: response.to_xml
end
以相同的方式设置会议。
最终你的行动应该看起来像这样:
qazxswpoi
如果这有帮助,请告诉我。