1
如果沒有答覆,我想將呼叫重定向到語音郵件。該代碼是:使用Plivo,如何將未應答的呼叫轉發至語音郵件?
get '/inbound' do
CALLER_ID = 'caller_number'
to = 'dest_number'
r = Response.new()
r.addSpeak('Thanks for calling acme, if someone does not answer within 20 seconds you will be directed to voicemail')
r.addDial({'callerId' => CALLER_ID, 'timeout' => '20'}).addNumber(to)
r.addSpeak("The number you're trying is not reachable at the moment. You are being redirected to the voice mail")
r.addDial('action' => 'http://frozen-lake-7349.herokuapp.com/voicemail', 'method' => 'GET')
content_type 'text/xml'
r.to_xml()
end
這部分的工作,因爲它的確期待語音郵件URL和記錄製作,但如果呼叫被應答,然後,當響應方掛斷,該流程將繼續與呼叫者無論如何,這當然是路由到語音郵件,當然,由於各方已經發言,所以現在是不必要的。
因此,如果在那裏有一個if語句基本上說:如果呼叫應答在掛斷時結束,如果不去語音郵件?我怎樣才能做到這一點?
謝謝!