[Freeswitch-users] session:recordFile(-) always creates empty wav file during outbound IVR call

Anthony Minessale anthony.minessale at gmail.com
Thu Sep 1 06:46:30 MSD 2011


Does the empty file contain silence that corresponds to the duration
of the time it's recording?
Are you producing the audio yourself into the recording and can you
verify with a pcap that there is actually any audio to record?


On Wed, Aug 31, 2011 at 9:21 PM, king2kin <xing2kin at yahoo.com> wrote:
> Anthony,
>
> Thank you for help. I tried outbound IVR call in multiple ways again based on your advice,  session:recordFile(-) still doesn't work normally, still created empty wav file .
>
> Could anyone please give me a hand on FreeSwitch Record? It always fails to record audio file during any outbound IVR call (auto dialer) although it works well during any inbound ivr call.
>
> Session:streamFile(-) works well to play back prompt files, dtmf keypress also works, ... during outbound ivr call.
>
> x.k.
>
> --- On Wed, 8/31/11, Anthony Minessale <anthony.minessale at gmail.com> wrote:
>
>> From: Anthony Minessale <anthony.minessale at gmail.com>
>> Subject: Re: [Freeswitch-users] session:recordFile(-) always creates empty wav file during outbound IVR call
>> To: "FreeSWITCH Users Help" <freeswitch-users at lists.freeswitch.org>
>> Date: Wednesday, August 31, 2011, 12:17 PM
>> try this dial string instead
>>
>> {ignore_early_media=true}sofia/gateway/sip.tpad.com/1726011
>>
>> On Wed, Aug 31, 2011 at 12:52 PM, king2kin <xing2kin at yahoo.com>
>> wrote:
>> > Hi folks,
>> >
>> > With Lua script and/or originate command, I have tried
>> recording a message file during outbound IVR call over and
>> over, session:recordFile(-) inside Lua script does create a
>> wav file during each of my testings but the recorded audio
>> file is always empty.
>> >
>> > However, session:recordFile(-) works well for inbound
>> IVR call.
>> >
>> > I tried the session:recordFile(-) via Lua script in
>> three ways:
>> >
>> > 1. run lua script "test_outcall_ivr.lua" at freeswitch
>> command-line:
>> >
>> > luarun test_outcall_ivr.lua
>> >
>> >
>> > -- [test_outcall_ivr.lua]
>> > {
>> > local sessionx =
>> freeswitch.Session("sofia/gateway/sip.tpad.com/1726011",
>> session)
>> >
>> > -- Set the path separator
>> > pathsep = '/'
>> >
>> > -- Windows users do this instead:
>> > -- pathsep = '\'
>> >
>> > -- Answer the call
>> > -- sessionx:answer()
>> >
>> > --Create a string with path and filename of a sound
>> file
>> > prompt = "ivr" .. pathsep ..
>> "ivr-welcome_to_freeswitch.wav"
>> >
>> > -- Print a log message
>> > freeswitch.consoleLog("INFO","Prompt file is '" ..
>> prompt .. "'\n")
>> >
>> > --Play the prompt
>> > sessionx:streamFile(prompt)
>> >
>> > -- Record record file
>> >
>> sessionx:streamFile("phrase:voicemail_record_message")
>> >
>> > -- Play a ""bong"" tone prior to recording
>> >
>> sessionx:streamFile("tone_stream://v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1000,
>> 0, 640)")
>> >
>> > -- record a message
>> > filename = sessionx:getVariable('sounds_dir') ..
>> pathsep .. "123.wav"
>> > sessionx:recordFile(filename,300,100,10)
>> >
>> > -- play back the recorded msg
>> > sessionx:streamFile(filename)
>> >
>> > -- Hangup
>> > sessionx:hangup()
>> >
>> > }
>> >
>> > 2. I also tried it differently by submitting the
>> following commands at the FreeSwitch command-line
>> interface:
>> >
>> > originate user/1005 &transfer(8887 xml default)
>> >
>> > originate user/1005 &lua('test1.lua')
>> >
>> > originate sofia/gateway/sip.tpad.com/1726011
>> &lua('test1.lua')
>> >
>> >
>> > -- [test1.lua]
>> > {
>> > -- Set the path separator
>> > pathsep = '/'
>> >
>> > -- Windows users do this instead:
>> > -- pathsep = '\'
>> >
>> > --Answer the call
>> > session:answer()
>> >
>> > --Create a string with path and filename of a sound
>> file
>> > prompt = "ivr" .. pathsep ..
>> "ivr-welcome_to_freeswitch.wav"
>> >
>> > -- Print a log message
>> > freeswitch.consoleLog("INFO","Prompt file is '" ..
>> prompt .. "'\n")
>> >
>> > --Play the prompt
>> > session:streamFile(prompt)
>> >
>> > -- Record record file
>> > session:streamFile("phrase:voicemail_record_message")
>> >
>> > -- Play a ""bong"" tone prior to recording
>> >
>> session:streamFile("tone_stream://v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1000,
>> 0, 640)")
>> >
>> > -- record a message
>> > filename = session:getVariable('sounds_dir') ..
>> pathsep .. "123.wav"
>> > session:recordFile(filename,300,100,10)
>> >
>> > -- play back the recorded msg
>> > session:streamFile(filename)
>> >
>> > -- Hangup
>> > session:hangup()
>> > }
>> >
>> > -- [xml dialplan for extension 8887]:
>> > {
>> >        <extension name="Simple Lua Test">
>> >                <condition
>> field="destination_number" expression="^(8887)$">
>> >                        <action
>> application="set" data="record_waste_resources=true"/>
>> >                        <action
>> application="lua" data="test1.lua"/>
>> >                </condition>
>> >        </extension>
>> > }
>> >
>> >
>> ======================================================
>> >
>> > For all the above testing cases, session:recordFile(-)
>> always creates an empty wav file for each of outbound IVR
>> calls, however, if I make an inbound IVR call to run Lua
>> script "test1.lua", session:recordFile(-) always works
>> perfect to generate a normal wav file.
>> >
>> > So, what's wrong with [session:recordFile(-)] during
>> an outbound IVR call?
>> >
>> > x.k.
>> >
>> >
>> > 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
>> >
>>
>>
>>
>> --
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>>
>> 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
>>
>
>
> 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
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list