[Freeswitch-users] Lua not playing any wav files
Chris Burns
chris at cloudtel.com
Sat Dec 18 11:42:53 MSK 2010
Hmmm no help for you yet huh ... you may have solved it on your own already,
but ...
You want to answer the call there, and not pre-answer. Pre-answer is for
early media, which is for exchanging media before committing to answer the
call. Admittedly you should hear something either way, but you definitely
want to answer the call in your case. If your XML dialplan works as you
said, you should compare the log output between these 2 extensions:
<extension name="testXML">
<condition field="destination_number" expression="^9001$">
<action application="answer"/>
<action application="playback" data="local_stream://moh"/>
</condition>
</extension>
<extension name="testLUA">
<condition field="destination_number" expression="^9002$">
<action application="lua" data="test.lua"/>
</condition>
</extension>
Contents of test.lua:
session:answer();
session:execute("playback","local_stream://moh");
On Wed, Dec 15, 2010 at 1:59 AM, Marc de Corny <marcdecorny at gmail.com>wrote:
> Hi all,
>
> I have run into an issue on something so basic that I must be as simple as
> enabling a feature somewhere.
>
> I have been trying to get lua to play a message from a WAV file. I have
> tried session:execute("playback", main_msg) and
> session:streamFile(ivr_invalid_msg) but neither of them play any music to
> the caller. I tried both to answer and preAnswer the call first but it made
> no difference. However if I put the same file into the XML dialplan and play
> it with the commands below I hear the music fine.
> <action application="set" data="playback_terminators=#"/>
> <action application="playback" data="${401_sound_file_path}"/>
>
> The issue only seems to be from lua when playing any type of wav file and
> those files are definitelly there as can be read by the XML
>
> The error message is below for the execute(playback) command, but nothing
> can be seen for the
> 2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:1827 Application
> playback Requires media! pre_answering channel
> sofia/external/2031701665 at 194.0.147.16:5060 EXECUTE
> sofia/external/2031701665 at 194.0.147.16:5060playback(/usr/local/freeswitch/sounds/svc_sound_files/default_autoattendant.wav)
> But there is no mention of the streamFile command. I have had similar issue
> with the PlayAndGetDigits command.
> Is there something that I need to enable in lua so that is can playback
> messages to the caller.
>
> Many thanks to anyone who can help.
> Marc
>
>
> below is the XML dialplan and lua script as well as the log at the very
> end.
>
> XML DIALPLAN:
> <include>
> <extension name="IVR_FROM_MYSQL">
> <condition field="caller_id_number" expression="Anonymous" break="never">
> <action application="set" data="effective_caller_id_number=0000000000"/>
> </condition>
> <condition field="destination_number" expression="^(404)">
> <action inline="true" application="lua" data="ivr_mysql.lua
> ${destination_number:3}"/>
> <action application="set" data="effective_caller_id_name=${404_tag}"/>
> <action application="bridge" data="${404_dial}"/>
> </condition>
> </extension>
> </include>
>
> The LUA script ivr_mysql.lua is callsed and this is it.
> -- IVR : PLAY IVR WAV FILES
> -- Global Variables:
> local dialstr_prefix = "sofia/gateway/CS2k/"
> local dialstr_main = ""
> local breakoutcode = "184"
> local sound_file_folder = "/usr/local/freeswitch/sounds/svc_sound_files/"
> local ddi = argv[1]
> -- answer the call
> session:preAnswer();
> freeswitch.consoleLog("info", "All Answered\n");
> ivr_invalid_msg = sound_file_folder .. "invalid_msg.wav"
> main_msg = sound_file_folder .. "default_autoattendant.wav"
> -- Play with Execute
> session:execute("playback", main_msg)
> -- Play with StreamFile
> session:streamFile(ivr_invalid_msg);
> dialstr_main = dialstr_main .. dialstr_prefix .. breakoutcode ..
> "02031701665"
> session:setVariable("404_dial",dialstr_main)
> session:setVariable("404_tag","IVR")
>
>
> RELEVANT LOGS :
> Dialplan: sofia/external/2031701665 at 194.0.147.16:5060 Regex (PASS)
> [IVR_FROM_MYS QL] destination_number(4042031956241)
> =~ /^(404)/ break=on-false
> Dialplan: sofia/external/2031701665 at 194.0.147.16:5060 Action
> lua(ivr_mysql.lua $ {destination_number:3}) INLINE
> EXECUTE sofia/external/2031701665 at 194.0.147.16:5060 lua(ivr_mysql.lua
> 2031956241 )
> 2010-12-01 11:56:01.525426 [INFO] switch_cpp.cpp:584 Sending early media
> 2010-12-01 11:56:01.525426 [DEBUG] sofia_glue.c:2972 AUDIO RTP
> [sofia/external/2 031701665 at 194.0.147.16:5060]
> 10.5.2.105 port 29900 -> 194.0.147.164 port 50202 c
> odec: 8 ms: 20
> 2010-12-01 11:56:01.525426 [DEBUG] switch_rtp.c:1418 Starting timer [soft]
> 160 b ytes per 20ms
> 2010-12-01 11:56:01.532280 [DEBUG] sofia_glue.c:3190 Set 2833 dtmf send
> payload to 101
> 2010-12-01 11:56:01.532280 [DEBUG] sofia_glue.c:3195 Set 2833 dtmf receive
> paylo ad to 101
> 2010-12-01 11:56:01.532280 [DEBUG] mod_sofia.c:2172 Ring SDP:
> v=0
> o=FreeSWITCH 1291174661 1291174662 IN IP4 10.5.2.105
> s=FreeSWITCH
> c=IN IP4 10.5.2.105
> t=0 0
> m=audio 29900 RTP/AVP 8 101
> a=rtpmap:8 PCMA/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-16
> a=silenceSupp:off - - - -
> a=ptime:20
> a=sendrecv
> 2010-12-01 11:56:01.532280 [NOTICE] mod_sofia.c:2175 Pre-Answer
> sofia/external/2 031701665 at 194.0.147.16:5060!
> 2010-12-01 11:56:01.532280 [DEBUG] switch_channel.c:2544
> (sofia/external/2031701 665 at 194.0.147.16:5060)
> Callstate Change RINGING -> EARLY
> 2010-12-01 11:56:01.534727 [DEBUG] sofia.c:4576 Channel
> sofia/external/203170166 5 at 194.0.147.16:5060skipping state [early][183]
> 2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:676 Send signal
> sofia/e xternal/2031701665 at 194.0.147.16:5060[BREAK]
> 2010-12-01 11:56:01.534727 [INFO] switch_cpp.cpp:1181 All Answered
> 2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:1827 Application
> playba ck Requires media! pre_answering channel
> sofia/external/2031701665 at 194.0.147.16: 5060
> EXECUTE sofia/external/2031701665 at 194.0.147.16:5060playback(/usr/local/freeswit
> ch/sounds/svc_sound_files/default_autoattendant.wav)
> 2010-12-01 11:56:01.537644 [DEBUG] switch_cpp.cpp:972
> sofia/external/2031701665@ 194.0.147.16:5060destroy/unlink session from object
> Dialplan: sofia/external/2031701665 at 194.0.147.16:5060 Action
> set(effective_calle r_id_name=${404_tag})
> Dialplan: sofia/external/2031701665 at 194.0.147.16:5060 Action
> bridge(${404_dial})
> 2010-12-01 11:56:01.537644 [DEBUG] switch_core_state_machine.c:119
> (sofia/extern al/2031701665 at 194.0.147.16:5060)
> State Change CS_ROUTING -> CS_EXECUTE
> 2010-12-01 11:56:01.537644 [DEBUG] switch_core_session.c:1057 Send signal
> sofia/ external/2031701665 at 194.0.147.16:5060[BREAK]
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101218/4c2e0905/attachment.html
More information about the FreeSWITCH-users
mailing list