我已经设置了一个 IVR 来接听来电,以便他们输入分机号或按 1 键将其放入我们办公室的振铃组。唯一的问题是 Asterisk 不播放我上传的 WAV/MP3/GSM 音频文件。使用默认录音可以,我不确定为什么我的不行。我也知道 IVR 可以工作,因为我可以在它停止响铃后输入分机号。我正在使用 Elastix 作为 Asterisk 的 GUI。
以下是 /var/log/asterisk 中包含的“完整”日志文件的片段:
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:1] Set("DAHDI/1-1", "__FROM_DID=s") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:2] Gosub("DAHDI/1-1", "app-blacklist-check,s,1") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@app-blacklist-check:1] GotoIf("DAHDI/1-1", "0?blacklisted") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@app-blacklist-check:2] Set("DAHDI/1-1", "CALLED_BLACKLIST=1") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@app-blacklist-check:3] Return("DAHDI/1-1", "") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:3] ExecIf("DAHDI/1-1", "1 ?Set(CALLERID(name)=)") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:4] Ringing("DAHDI/1-1", "") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:5] Set("DAHDI/1-1", "__CALLINGPRES_SV=allowed_not_screened") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:6] Set("DAHDI/1-1", "CALLERPRES()=allowed_not_screened") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@from-pstn:7] Goto("DAHDI/1-1", "ivr-3,s,1") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Goto (ivr-3,s,1)
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:1] Set("DAHDI/1-1", "MSG=custom/Untitled24") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:2] Set("DAHDI/1-1", "LOOPCOUNT=0") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:3] Set("DAHDI/1-1", "__DIR-CONTEXT=") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:4] Set("DAHDI/1-1", "_IVR_CONTEXT_ivr-3=") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:5] Set("DAHDI/1-1", "_IVR_CONTEXT=ivr-3") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:6] GotoIf("DAHDI/1-1", "0?begin") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:7] Answer("DAHDI/1-1", "") in new stack
[Dec 30 22:48:12] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:8] Wait("DAHDI/1-1", "1") in new stack
[Dec 30 22:48:14] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:9] Set("DAHDI/1-1", "TIMEOUT(digit)=3") in new stack
[Dec 30 22:48:14] VERBOSE[4296] func_timeout.c: -- Digit timeout set to 3.000
[Dec 30 22:48:14] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:10] Set("DAHDI/1-1", "TIMEOUT(response)=20") in new stack
[Dec 30 22:48:14] VERBOSE[4296] func_timeout.c: -- Response timeout set to 20.000
[Dec 30 22:48:14] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:11] Set("DAHDI/1-1", "__IVR_RETVM=") in new stack
[Dec 30 22:48:14] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:12] ExecIf("DAHDI/1-1", "1?Background(custom/Untitled24)") in new stack
[Dec 30 22:48:14] WARNING[4296] format_wav.c: Not a wav file 49
[Dec 30 22:48:14] WARNING[4296] file.c: Unable to open format wav
[Dec 30 22:48:14] WARNING[4296] file.c: Unable to open custom/Untitled24 (format 0x4 (ulaw)): No such file or directory
[Dec 30 22:48:14] WARNING[4296] pbx.c: ast_streamfile failed on DAHDI/1-1 for custom/Untitled24
[Dec 30 22:48:14] VERBOSE[4296] pbx.c: -- Executing [s@ivr-3:13] WaitExten("DAHDI/1-1", ",") in new stack
[Dec 30 22:48:16] VERBOSE[4297] pbx.c: == Spawn extension (ivr-3, s, 13) exited non-zero on 'DAHDI/3-1'
[Dec 30 22:48:16] VERBOSE[4297] pbx.c: -- Executing [h@ivr-3:1] Hangup("DAHDI/3-1", "") in new stack
[Dec 30 22:48:16] VERBOSE[4297] pbx.c: == Spawn extension (ivr-3, h, 1) exited non-zero on 'DAHDI/3-1'
[Dec 30 22:48:16] VERBOSE[4297] sig_analog.c: -- Hanging up on 'DAHDI/3-1'
[Dec 30 22:48:16] VERBOSE[4297] chan_dahdi.c: -- Hungup 'DAHDI/3-1'
答案1
在您的输出中,format_wav.c 模块出现错误,指出输入不是 wav 文件。请检查您的格式,并确保您以 Asterisk 期望的格式保存它。
作为一种解决方法,您可以使用开源音频工具“sox”来让事情变得更容易一些:
sox /var/lib/asterisk/sounds/custom/Untitled24.wav -r 8000 -c 1 /var/lib/asterisk/sounds/custom/Untitled24.gsm resample -ql
这将创建文件的 GSM 格式并使您的扩展逻辑正常工作。