2013-01-24 36 views
0

我正在努力使系統自動撥出延遲租金的租戶號碼並讀取他們欠多少的租戶號碼。當撥號被應答或當撥號時發送「忙音」時,一切工作正常。不幸的是,當電話響起足夠長的時間以使答錄機(或語音郵件)自己接聽時,撥號計劃上下文和分機根本不會啓動。當答錄機或語音郵件回答時,爲了讓撥號計劃開始,我需要做些什麼?我在兩部手機上測試了這一點,兩者都做同樣的事情。答錄機撥號時Asterisk撥號方案未運行

這是開始調用的代碼。該腳本,並會撥打我的電話:

fputs($socket, "Action: Login\r\n"); 
fputs($socket, "UserName: $username\r\n"); 
fputs($socket, "Secret: $secret\r\n\r\n"); 
fputs($socket, "Command: sip show peers\r\n\r\n"); 

fputs($socket, "Action: Originate\r\n"); 
fputs($socket, "Channel: $number_out\r\n"); 
fputs($socket, "Context: $context\r\n"); 
fputs($socket, "Exten: $exten\r\n"); 
fputs($socket, "Priority: 1\r\n"); 
fputs($socket, "Timeout: 20000\r\n"); 
fputs($socket, "Variable: NAME=$name\r\n"); 
fputs($socket, "Variable: LOCATION=$location\r\n"); 
fputs($socket, "Variable: AMOUNT=$amount\r\n"); 
fputs($socket, "Variable: TENSE=$tense\r\n"); 
fputs($socket, "Variable: CALLDIR={$cd['calls_out_dir']}\r\n"); 
fputs($socket, "Variable: CALLFILE=$callFile\r\n"); 
fputs($socket, "Variable: ICOID=${cd['ico_id']}\r\n"); 
fputs($socket, "Variable: LIVEORDEVEL=html-devel\r\n"); 
fputs($socket, "Variable: TIMESTAMP=$timestamp\r\n"); 
fputs($socket, "Callerid: \"$cid_name\" <$cid_num>\r\n"); 


fputs($socket, "Action: Logoff\r\n\r\n"); 

這裏是撥號計劃的相關部分:

[out-tenant-collections] 
exten => s,1,Wait(1) 
exten => s,2,AMD() 
exten => s,3,Monitor(gsm,"${CALLDIR}${CALLFILE}",m) 

exten => s,n,NOOP(AMDSTATUS = ${AMDSTATUS} DIALSTATUS = ${DIALSTATUS}) 

exten => s,n,GotoIf($[${AMDSTATUS}=HUMAN]?humn:mach) 


exten => s,n(mach),agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},0,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) 

exten => s,n,Wait(10) 



exten => s,n(humn),agi(googletts.agi,"You ${TENSE} at ${LOCATION}. Your rent is overdue by ${AMOUNT}., If you already made a payment in full, press 1. If you already mailed payment or intend to pay within two days, press 2., If you feel$ 

exten => s,n,NOOP(ICOID: ${ICOID}) 

; the wait exten command will let you interupt the above googletts agi app and go to the extension dialed in (1,2,3 or 4) if a digit is dialed that is not recognized it will go to the i extension 

exten => s,n,WaitExten() 



; they entered something other than 1,2,3 or 4 

exten => i,1,agi(googletts.agi,"Sorry I did not catch that.",en,,1.1) 

exten => i,n,Goto(s,4) 



;; They hit 1, register that they said they paid their full amount 

exten => 1,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},1,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) 

exten => 1,2,agi(googletts.agi,"Thank you, we will double check our records, if the payment has been recorded you will not recieve any more calls.",en,,1.1) 

exten => s,n,Hangup 


;; They hit 2, register that they said they mailed a payment 

exten => 2,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},2,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) 

exten => 2,2,agi(googletts.agi,"Thank you, we will await your payment.",en,,1.1) 

exten => s,n,Hangup 


;; They hit 3, register that they said it was an error to get this call 

exten => 3,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},3,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) 

exten => 3,2,agi(googletts.agi,"Please explain why you feel you have recieved this message in error, after the beep.",en,,1.1) 

exten => 3,3,Wait(1) 

exten => 3,4,Playback(beep) 

exten => 3,5,Wait(30) 

exten => 3,n,Hangup 


;; They hit 4, they want the message repeated 

exten => 4,1,Goto(s,4) 


;; The waitexten command timed out with no response 

exten => t,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},0,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) 

exten => t,2,Hangup 
+0

您需要檢查詳細/調試輸出。根據你的撥號規則一切正常,只要有其他的agi腳本。 – arheops

回答

1

原來,當應答機或語音郵件拿起特殊擴展名時,您需要處理。我在撥號計劃中添加了以下行。需要注意的重要一點是擴展名:「失敗」這是應答機啓動時執行的默認擴展名。

;; if the answering machine picks up when no user answers or sends a busy tone 
exten => failed,1,Goto(s,mach) 
0

請發表您使用生成傳出調用的代碼。在我看來,您並不是將撥出呼叫的「您的一方」作爲撥號命令的一部分發送到此環境中。

+0

感謝您的回覆,我按照您的要求編輯了我的帖子。同樣,當電話應答機啓動時,我的電話將響鈴,但不會啓動撥號計劃分機。如果我接聽電話,則撥號計劃按預期工作。 could「fputs($ socket,」Timeout:20000 \ r \ n「);」是罪魁禍首?現在我再次看到這可能是問題,你怎麼看? – Keeleon

+0

您可以發佈您發送的$ number_out,$ context和$ exten的值嗎?這將幫助我爲你解決這個問題。 – MichelV69

+0

謝謝你的時間Michel,但我自己解決了它,看到我的答案。 – Keeleon