大家好,我在 Centos 7 服务器上使用 Asterisk 18 Cooked,当我想播放 wav 文件时,单声道 pcm s16 le 8000 hz 叫做 MyWavFile.wav 我尝试使用应用程序 BackGround 或 MP3Player 以其他方式播放它,我得到了非常相似的响应
-- Executing [112@local:1] Answer("PJSIP/5020-00000000", "") in new stack
-- Executing [112@local:2] BackGround("PJSIP/5020-00000000", "/var/lib/asterisk/moh/MyWavFile.wav") in new stack
[Jul 12 23:26:49] WARNING[8272][C-00000001]: file.c:824 ast_openstream_full: File /var/lib/asterisk/moh/MyWavFile.wav does not exist in any format
[Jul 12 23:26:49] WARNING[8272][C-00000001]: file.c:1303 ast_streamfile: Unable to open /var/lib/asterisk/moh/MyWavFile.wav (format (ulaw)): No such file or directory
[Jul 12 23:26:49] WARNING[8272][C-00000001]: pbx_builtins.c:1256 pbx_builtin_background: ast_streamfile failed on PJSIP/5020-00000000 for /var/lib/asterisk/moh/MyWavFile.wav
-- Executing [112@local:3] Hangup("PJSIP/5020-00000000", "") in new stack
-- Executing [112@local:1] Answer("PJSIP/5020-00000001", "") in new stack
-- Executing [112@local:2] MP3Player("PJSIP/5020-00000001", "/var/lib/asterisk/moh/MyWavFile.wav") in new stack
[Jul 12 23:27:42] WARNING[8288][C-00000002]: app_mp3.c:258 mp3_exec: MP3 stream '/var/lib/asterisk/moh/MyWavFile.wav' is broken or nonexistent
-- Executing [112@local:3] Hangup("PJSIP/5020-00000001", "") in new stack
但是如果我使用与 MOH 相同的文件,它可以播放 MMMM,这应该缺少什么?
谢谢大家的帮助!
答案1
Asterisk 是多格式 PBX。文件可能不是以 .wav 结尾,而是以 .g729 或 .gsm 结尾
可以是多个具有相同名称的文件,并且星号将根据编解码器路径选择一个。
所以这
Executing [112@local:2] BackGround("PJSIP/5020-00000000", "/var/lib/asterisk/moh/MyWavFile.wav") in new stack
不应该起作用。您输入的文件名没有扩展名,如下所示
exten => 112,2,BackGround(/var/lib/asterisk/moh/MyWavFile)
ps 在您的情况下,编解码器是 ulaw 并且它将搜索类似 -> .ulaw ->.sln ->.wav -> .alaw -> .WAV(gsm) -> .gsm 等。