2016-09-26 65 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支持來告訴我如何找到沒有此功能的號碼。