AMD - 這是一個內建 Asterisk 的功能,可用來偵測接電話的對方是語音或人聲。
[amd-test] exten => 9970,1,Noop(-- AMD Testing Start --) same => n,Background(beep) same => n,AMD() same => n,Noop(Detected: AMDSTATUS is ${AMDSTATUS}) same => n,Goto(Status-${AMDSTATUS}) same => n(Status-HUMAN),Noop(When AMDSTATUS is <HUMAN>)
same => n,WaitForSilence(2500)
same => n,Playback(message-when-machine) same => n,Hangup same => n(Status-MACHINE),Noop(When AMDSTATUS is <MACHINE>)
same => n,Hangup same => n(Status-NOTSURE),Noop(When AMDSTATUS is <NOTSURE>)
same => n,Hangup same => n(Status-HANGUP),Noop(When AMDSTATUS is <HANGUP>)
same => n,Hangup
; ; Answering Machine Detection Configuration ; [general] initial_silence = 2500 ; Maximum silence duration before the greeting. ; If exceeded then MACHINE. greeting = 1500 ; Maximum length of a greeting. If exceeded then MACHINE. after_greeting_silence = 800 ; Silence after detecting a greeting. ; If exceeded then HUMAN total_analysis_time = 5000 ; Maximum time allowed for the algorithm to decide ; on a HUMAN or MACHINE min_word_length = 100 ; Minimum duration of Voice to considered as a word between_words_silence = 50 ; Minimum duration of silence after a word to consider ; the audio what follows as a new word maximum_number_of_words = 3 ; Maximum number of words in the greeting. ; If exceeded then MACHINE silence_threshold = 256 ;silence threshold is how loud silence is.
Tips:
[amd-without-conf] exten => 7002,1,Answer() exten => 7002,n,AMD(2500,1500,300,5000,120,50,4,384) exten => 7002,n,GotoIf($["${AMDSTATUS}" = "MACHINE"]?machine:human) exten => 7002,n(machine),Verbose(3, We found an answring machine) exten => 7002,n,Set(AMP=${CALLERID(num)}) exten => 7002,n,Set(date=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}) exten => 7002,n,NoOp(Here is the dialplan you want to run) exten => 7002,n(human),Verbose(3, We've got a human on the line!) exten => 7002,n,NoOp(Here is the dialplan you want to run)