2016-09-26 41 views
1

我试图做5组40到50秒的入站呼叫记录。呼入呼叫发送意外挂断信号

我有以下TwiML这是在响应呼入电话设置:

<Response> 
    <Say>Recording $n</Say> 
    <Record action="/twilio/answer/$n" finishOnKey="123456789#*" maxLength="50" playBeep="true" timeout="5" trim="trim-silence" /> 
</Response> 

其中$ n是数字1 - 5

一旦超时或按下按钮后信息将被发送到烧瓶中的以下视图:

@app.route('/twilio/answer/<int:question_id>', methods=['POST']) 
def answer(question_id): 
    """Receives the question and ensures it is the correct length.""" 
    length = int(request.values.get("RecordingDuration", 0)) 
    if length >= MIN_LENGTH: 
     url = request.values.get("RecordingUrl", None) 
     save_url(url) 
     response = redirect_to_question(question_id + 1) 
     return str(response) 
    else: 
     # Replay question 
     response = twiml.Response() 
     message = """The recording must be at least %s seconds long.""" % MIN_LENGTH 
     return redirect_to_question(question_id, say=message) 

调用按预期工作的时间的一半。另一半,来电者似乎发出“挂断”。

POST/twilio/answer/ 

Request 
URL 
https://example.com/twilio/answer/1 

Parameters 
CALLED +441234567890 
DIGITS hangup 

我绝对不会挂断。

当录音时间为31秒时,总是发送挂断信号。 如果第一个记录/视图是成功的,所有其他记录/视图也是如此。

我已经与我的手机(Android)以及Skype一起体验了这一点。

我用的烧瓶gunicorn运行:

gunicorn voice:app -b 127.0.0.1:8000 --timeout 120 --graceful-timeout  120 --workers 3 --worker-class gevent --log-file - --log-level debug 

我使用nginx的反向代理:

server { 
    listen 80; 
    listen 443 ssl; 
    server_name example.com; 

ssl_certificate somewhere/fullchain.pem; 
ssl_certificate_key somewhere/privkey.pem; 
ssl_protocols  TLSv1 TLSv1.1 TLSv1.2; 
ssl_ciphers   HIGH:!aNULL:!MD5; 

access_log /var/log/nginx/access.log; 
error_log /var/log/nginx/error.log; 

location/{ 
    proxy_pass   http://127.0.0.1:8000; 
    proxy_redirect  http://127.0.0.1:8000 https://example.com; 

    proxy_set_header Host     $host; 
    proxy_set_header X-Real-IP   $remote_addr; 
    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Proto $scheme; 
    proxy_read_timeout 120s; 
} 
} 

在我看来,这是在Twilio结束的问题。

有:

  1. 任何方式解决这一问题?
  2. 一种忽略挂断信号并继续的方法?
+1

你期待什么发生?无论如何,一旦录制结束,使用TwiML将会结束通话。预期的结果是什么? – philnash

+0

已在上面添加。我保存网址并转到下一个录音,或者我重放问题。 – Keri

回答

1

事实证明,电话号码是由运营商提供的,如果在30秒内没有音频就挂断电话号码。

问题通过使用不同的提供者来解决。等待Twilio支持来告诉我如何找到没有此功能的号码。