[Freeswitch-users] AMR Codec for Audio File Playback
Ron
ron.menez at entropysolution.com
Thu Jun 15 07:49:04 UTC 2017
Hi All,
Is it possible to execute a command playback for an audio file using AMR Codec?
We tried the following configuration in dialplan and gave different errors:
Configuration with “pre-answer”:
<extension name="AMR_Testing">
<condition field="destination_number" expression="^\d{7}$">
<action application="pre_answer"/>
<action application="sleep" data="2000"/>
<action application="playback" data="/usr/local/freeswitch/sounds/aaaaa.wav"/>
</condition>
</extension>
Error Log:
EXECUTE sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 pre_answer()
2017-06-15 15:39:45.285763 [INFO] mod_dptools.c:1355 Sending early media
2017-06-15 15:39:45.285763 [DEBUG] switch_core_media.c:3056 Set Codec sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 AMR/0 0 ms 160 samples 12200 bits 1 channels
2017-06-15 15:39:45.285763 [DEBUG] switch_core_codec.c:111 sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 Original read codec set to AMR:96
2017-06-15 15:39:45.285763 [DEBUG] switch_core_media.c:6927 PROXY AUDIO RTP [sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062] 192.168.1.129:62020->192.168.1.129:62020 codec: 98 ms: 20
2017-06-15 15:39:45.285763 [ERR] switch_core_media.c:7549 AUDIO RTP REPORTS ERROR: [Missing local host]
2017-06-15 15:39:45.285763 [NOTICE] switch_core_media.c:7550 Hangup sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 [CS_EXECUTE] [DESTINATION_OUT_OF_ORDER]
Configuration with “answer”:
<extension name="AMR_Testing">
<condition field="destination_number" expression="^\d{7}$">
<action application="answer"/>
<action application="sleep" data="2000"/>
<action application="playback" data="/usr/local/freeswitch/sounds/aaaaa.wav"/>
</condition>
</extension>
Error Log:
2017-06-15 15:41:49.965732 [NOTICE] mod_dptools.c:1312 Channel [sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062] has been answered
2017-06-15 15:41:49.965732 [DEBUG] switch_channel.c:3772 (sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062) Callstate Change EARLY -> ACTIVE
2017-06-15 15:41:49.965732 [DEBUG] sofia.c:7048 Channel sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 entering state [completed][200]
2017-06-15 15:41:49.965732 [DEBUG] sofia.c:7048 Channel sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 entering state [ready][200]
EXECUTE sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 sleep(2000)
2017-06-15 15:41:49.985728 [DEBUG] switch_rtp.c:7247 Correct audio ip/port confirmed.
EXECUTE sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 playback(/usr/local/freeswitch/sounds/aaaaa.wav)
2017-06-15 15:41:51.985732 [DEBUG] switch_core_file.c:342 File /usr/local/freeswitch/sounds/aaaaa.wav sample rate 44100 doesn't match requested rate 8000
2017-06-15 15:41:51.985732 [WARNING] switch_core_file.c:360 File has 2 channels, muxing to 1 channel will occur.
2017-06-15 15:41:51.985732 [DEBUG] switch_ivr_play_say.c:1498 Codec Activated L16 at 8000hz 1 channels 20ms
2017-06-15 15:41:52.005728 [ERR] mod_amr.c:338 This codec is only usable in passthrough mode!
2017-06-15 15:41:52.005728 [ERR] switch_core_io.c:1434 Codec AMR encoder error!
2017-06-15 15:41:52.005728 [DEBUG] switch_ivr_play_say.c:1942 done playing file /usr/local/freeswitch/sounds/aaaaa.wav
2017-06-15 15:41:52.005728 [NOTICE] switch_core_state_machine.c:385 sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 has executed the last dialplan instruction, hanging up.
2017-06-15 15:41:52.005728 [NOTICE] switch_core_state_machine.c:387 Hangup sofia/internal/09570000001 at 192.168.1.129<mailto:sofia/internal/09570000001 at 192.168.1.129>:5062 [CS_EXECUTE] [NORMAL_CLEARING]
We also tried to use the “fs_encode" and tried AMR codec to encode the wav file but we received the error below:
Opening file aaaaa.wav
Opening file aaaaa.AMR
2017-05-25 16:18:32.078353 [INFO] mod_native_file.c:101 Opening File [aaaaa.AMR] 8000hz
Frame size is 160
2017-05-25 16:18:32.078366 [ERR] mod_amr.c:338 This codec is only usable in passthrough mode!
Codec encoder error
2017-05-25 16:18:32.078372 [WARNING] switch_core_codec.c:920 Codec is not initialized!
We tried using the native file configuration and absolute codec but same errors shown for “pre_answer” and “answer” configuration.
May we request your help if there is another way to run playback for audio files using AMR codec.
Thank you.
Best Regard,
Ron Menez
ron.menez at entropysolution.com<mailto:ron.menez at entropysolution.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170615/2aa60024/attachment-0001.html>
More information about the FreeSWITCH-users
mailing list