【发布时间】:2021-02-15 00:44:47
【问题描述】:
我想让我的 Twilio/Flask 应用暂停来电者,同时我运行更多代码来联系该人以将其连接。
我的代码的相关部分:
@app.route('/ivr', methods=['POST'])
def welcome():
response = VoiceResponse()
with response.gather(
num_digits=1, action=url_for('router'), method="POST"
) as g:
g.say('if this is an emergency press 1, otherwise press 2')
return twiml(response)
@app.route('/ivr/router', methods=['POST'])
def status_router():
selected_option = request.form['Digits']
if selected_option == '1':
return redirect('/ivr/queue')
elif selected option == '2':
return redirect('/ivr/voicemail')
@app.route('/ivr/queue', methods=['POST', 'GET'])
def queue_connect():
response = VoiceResponse()
response.say("we are connecting you to our team")
response.enqueue('otg')
return twiml(response)
@app.route('/ivr/call_circle', methods=['POST'])
def call_circle():
callCircle(on_call=True)
return
这个想法是在我运行callCircle() 联系某人时将呼叫者发送到/ivr/queue。照原样,在返回queue_connect() TWiML 后,我不知道如何运行任何东西。我可以将callCircle() 作为/ivr/queue 的一部分运行,但是在其余代码运行之前,TWiML 不会运行,这违背了将它们放在首位的目的。
【问题讨论】:
标签: python flask twilio twilio-programmable-voice