Hmmm no help for you yet huh ... you may have solved it on your own already, but ...<br><br>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:<br>
<br><extension name="testXML"><br> <condition field="destination_number" expression="^9001$"><br> <action application="answer"/><br> <action application="playback" data="local_stream://moh"/><br>
</condition><br></extension><br><br><extension name="testLUA"><br>
<condition field="destination_number" expression="^9002$"><br>
<action application="lua" data="test.lua"/><br>
</condition><br>
</extension><br><br>Contents of test.lua:<br>session:answer();<br>session:execute("playback","local_stream://moh");<br><br><br><div class="gmail_quote">On Wed, Dec 15, 2010 at 1:59 AM, Marc de Corny <span dir="ltr"><<a href="mailto:marcdecorny@gmail.com">marcdecorny@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br> <br>I have run into an issue on something so basic that I must be as simple as enabling a feature somewhere.<br>
<br>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. <br>
<action application="set" data="playback_terminators=#"/><br><action application="playback" data="${401_sound_file_path}"/><br> <br>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<br>
<br>The error message is below for the execute(playback) command, but nothing can be seen for the <br>2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:1827 Application playback Requires media! pre_answering channel <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> EXECUTE <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> playback(/usr/local/freeswitch/sounds/svc_sound_files/default_autoattendant.wav)<br>
But there is no mention of the streamFile command. I have had similar issue with the PlayAndGetDigits command.<br>Is there something that I need to enable in lua so that is can playback messages to the caller.<br> <br>Many thanks to anyone who can help.<br>
Marc<br> <br> <br>below is the XML dialplan and lua script as well as the log at the very end.<br> <br>XML DIALPLAN:<br><include><br><extension name="IVR_FROM_MYSQL"><br><condition field="caller_id_number" expression="Anonymous" break="never"><br>
<action application="set" data="effective_caller_id_number=0000000000"/><br></condition><br><condition field="destination_number" expression="^(404)"><br><action inline="true" application="lua" data="ivr_mysql.lua ${destination_number:3}"/><br>
<action application="set" data="effective_caller_id_name=${404_tag}"/><br><action application="bridge" data="${404_dial}"/><br></condition><br></extension><br>
</include><br> <br>The LUA script ivr_mysql.lua is callsed and this is it.<br>-- IVR : PLAY IVR WAV FILES <br>-- Global Variables:<br>local dialstr_prefix = "sofia/gateway/CS2k/"<br>local dialstr_main = ""<br>
local breakoutcode = "184"<br>local sound_file_folder = "/usr/local/freeswitch/sounds/svc_sound_files/"<br>local ddi = argv[1]<br>-- answer the call<br>session:preAnswer();<br>freeswitch.consoleLog("info", "All Answered\n"); <br>
ivr_invalid_msg = sound_file_folder .. "invalid_msg.wav"<br>main_msg = sound_file_folder .. "default_autoattendant.wav"<br>-- Play with Execute<br>session:execute("playback", main_msg)<br>-- Play with StreamFile<br>
session:streamFile(ivr_invalid_msg);<br>dialstr_main = dialstr_main .. dialstr_prefix .. breakoutcode .. "02031701665"<br>session:setVariable("404_dial",dialstr_main)<br>session:setVariable("404_tag","IVR")<br>
<br> <br>RELEVANT LOGS :<br>Dialplan: <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> Regex (PASS) [IVR_FROM_MYS QL] destination_number(4042031956241) =~ /^(404)/ break=on-false<br>
Dialplan: <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> Action lua(ivr_mysql.lua $ {destination_number:3}) INLINE<br>
EXECUTE <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> lua(ivr_mysql.lua 2031956241 )<br>
2010-12-01 11:56:01.525426 [INFO] switch_cpp.cpp:584 Sending early media<br>2010-12-01 11:56:01.525426 [DEBUG] sofia_glue.c:2972 AUDIO RTP [sofia/external/2 <a href="mailto:031701665@194.0.147.16:5060" target="_blank">031701665@194.0.147.16:5060</a>] 10.5.2.105 port 29900 -> 194.0.147.164 port 50202 c odec: 8 ms: 20<br>
2010-12-01 11:56:01.525426 [DEBUG] switch_rtp.c:1418 Starting timer [soft] 160 b ytes per 20ms<br>2010-12-01 11:56:01.532280 [DEBUG] sofia_glue.c:3190 Set 2833 dtmf send payload to 101<br>
2010-12-01 11:56:01.532280 [DEBUG] sofia_glue.c:3195 Set 2833 dtmf receive paylo ad to 101<br>2010-12-01 11:56:01.532280 [DEBUG] mod_sofia.c:2172 Ring SDP:<br>v=0<br>o=FreeSWITCH 1291174661 1291174662 IN IP4 10.5.2.105<br>
s=FreeSWITCH<br>c=IN IP4 10.5.2.105<br>t=0 0<br>m=audio 29900 RTP/AVP 8 101<br>a=rtpmap:8 PCMA/8000<br>a=rtpmap:101 telephone-event/8000<br>a=fmtp:101 0-16<br>a=silenceSupp:off - - - -<br>a=ptime:20<br>a=sendrecv<br>2010-12-01 11:56:01.532280 [NOTICE] mod_sofia.c:2175 Pre-Answer sofia/external/2 <a href="mailto:031701665@194.0.147.16:5060" target="_blank">031701665@194.0.147.16:5060</a>!<br>
2010-12-01 11:56:01.532280 [DEBUG] switch_channel.c:2544 (sofia/external/2031701 <a href="mailto:665@194.0.147.16:5060" target="_blank">665@194.0.147.16:5060</a>) Callstate Change RINGING -> EARLY<br>
2010-12-01 11:56:01.534727 [DEBUG] sofia.c:4576 Channel sofia/external/203170166 <a href="mailto:5@194.0.147.16:5060" target="_blank">5@194.0.147.16:5060</a> skipping state [early][183]<br>
2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:676 Send signal sofia/e <a href="mailto:xternal/2031701665@194.0.147.16:5060" target="_blank">xternal/2031701665@194.0.147.16:5060</a> [BREAK]<br>
2010-12-01 11:56:01.534727 [INFO] switch_cpp.cpp:1181 All Answered<br>
2010-12-01 11:56:01.534727 [DEBUG] switch_core_session.c:1827 Application playba ck Requires media! pre_answering channel <a href="mailto:sofia/external/2031701665@194.0.147.16" target="_blank">sofia/external/2031701665@194.0.147.16</a>: 5060<br>
EXECUTE <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> playback(/usr/local/freeswit ch/sounds/svc_sound_files/default_autoattendant.wav)<br>
2010-12-01 11:56:01.537644 [DEBUG] switch_cpp.cpp:972 sofia/external/2031701665@ <a href="http://194.0.147.16:5060" target="_blank">194.0.147.16:5060</a> destroy/unlink session from object<br>Dialplan: <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> Action set(effective_calle r_id_name=${404_tag})<br>
Dialplan: <a href="mailto:sofia/external/2031701665@194.0.147.16:5060" target="_blank">sofia/external/2031701665@194.0.147.16:5060</a> Action bridge(${404_dial}) <br>2010-12-01 11:56:01.537644 [DEBUG] switch_core_state_machine.c:119 (sofia/extern <a href="mailto:al/2031701665@194.0.147.16:5060" target="_blank">al/2031701665@194.0.147.16:5060</a>) State Change CS_ROUTING -> CS_EXECUTE<br>
2010-12-01 11:56:01.537644 [DEBUG] switch_core_session.c:1057 Send signal sofia/ <a href="mailto:external/2031701665@194.0.147.16:5060" target="_blank">external/2031701665@194.0.147.16:5060</a> [BREAK]
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>