我正在从事我的第一个Twilio项目。
目标:
仅使用电话(对于代理商而没有任何类型的UI),我想将此流程执行:
:- 客户呼叫和(选择菜单之后)开始了会议。
- Agent1加入会议并与客户聊天以获取一些基本信息(Agent1由Twilio调用;这是一个出站呼叫)。
- agent1使加入Agent2的某些东西。
- 进行了三方会议(客户,代理1和代理2)。
问题:
提醒我,我没有使用任何UI,而AFAIK,DTMF无法参加会议。因此,为了获得会议的输入,我正在尝试使用 hanguponstar ,因为我在此处阅读了多个答案(如此)。
但是,它仅适用于初始呼叫者(默认情况下似乎是主持人),而不适用于Agent1。我希望Agent1调整会议,以便能够加入会议的代理2(可能是另一个出站呼叫)。
问题
是否可以将Agent1设置为主持人?如何?
预先感谢您的回答!
最后,我找到了一个解决方案!我在下面分享。我希望这对某人有帮助……这不是直觉,但它起作用。我遵循以下步骤:
- 创建会议并加入客户(set startConfereneenterer 和 endConferenceOnexit to false )。
- 创建一个呼叫并将其连接到URL。在该webhook中,创建一个twiml以将代理1加入会议,允许 hanguponstar 以后加入Agent2(在另一个webhook中),并设置 endConferenceOnexit false ,避免挂断客户的电话。
- 在单击"星星"(*)之后创建另一个重新加入代理1的Webhook,然后让Agent2加入会议。
我正在使用带有烧瓶框架的Python。这是代码:
@app.route('/start_conference.html', methods=['GET', 'POST'])
def start_conference():
agent1 = '+XXXXXXXXXXX' # Agent1's phone number
agent2 = '+XXXXXXXXXXX' # Agent2's phone number
confName = 'YourConferenceName'
resp = VoiceResponse()
dial = Dial()
# Create a conference and join Customer
dial.conference(
confName,
start_conference_on_enter=False,
end_conference_on_exit=False,
max_participants = 3 # Limits participants to 3
)
# Call to Agent1 and setup a webhook for this call with a TwiML
to join to the conference as Moderator
client.calls.create(
from_=twilioPhoneNumber,
to=agent1,
url=ROOT_URL+'agent1_to_conference.html' # ROOT_URL is the url where app is being executed
)
resp.append(dial)
return str(resp)
@app.route('/agent1_to_conference.html', methods=['GET', 'POST'])
def agent1_to_conference():
resp = VoiceResponse()
# Join Agent1 to the conference, allowing hangupOnStar
functionality to join Agent2 later
dial = Dial(
action='join_agent2.html',
method='POST',
hangup_on_star=True,
)
dial.conference(
confName,
start_conference_on_enter=True,
end_conference_on_exit=False # False, to avoid hanging up to Customer
)
resp.append(dial)
return str(resp)
@app.route('/join_agent2.html', methods=['GET', 'POST'])
def join_agent2():
resp = VoiceResponse()
dial = Dial()
# Re-join Agent1 (after clicking *)
dial.conference(
confName,
start_conference_on_enter=True,
end_conference_on_exit=True
)
resp.append(dial)
# Join Agent2
client.conferences(confName).participants.create(
from_=twilioPhoneNumber,
to=agent2
)
return str(resp)