[Freeswitch-users] Simple LuaScript to Record Session Failing

Abaci B abaci64 at gmail.com
Mon Feb 1 18:57:34 MSK 2016


did you try to answer the new_session before starting the record?

On Mon, Feb 1, 2016 at 10:38 AM, Leonardo Lima Ribeiro <
llribeiro90 at gmail.com> wrote:

> Thanks Chad and Oz.
>
> I tried two things:
>
> 1) Oz suggestion:
>
> local new_session = freeswitch.Session("[origination_caller_id_name='
> 7136694967',origination_caller_id_number='7136694967
> ']sofia/gateway/4_NEXTIVA/3157244022", session);
> new_session:setVariable(“RECORD_STEREO”,”false”)
> new_session:sleep("5000")
> new_session:streamFile("voicemail/vm-goodbye.wav")
> new_session:sleep("10000")
> new_session:hangup()
>
> Did not work…
>
> 2) Chad suggestion:
>
> local new_session = freeswitch.Session("[origination_caller_id_name='
> 7136694967',origination_caller_id_number='7136694967
> ']sofia/gateway/4_NEXTIVA/3157244022", session);
>
> uuid = new_session:get_uuid()
> api = freeswitch.API()
> reply = api:executeString("uuid_record " .. uuid .. " start
> /usr/local/freeswitch/recordings/myrecording.wav")
>
> new_session:sleep("5000")
> new_session:streamFile("voicemail/vm-goodbye.wav")
> new_session:sleep("10000")
> new_session:hangup()
>
> Did not work too…
>
> Both cases I have 5 seconds of silence (first 5000 pause) and then when I
> play the Good Bye wav file it starts to record normally. So I have 5
> seconds of silence, good bye sound and 10 seconds of recording.
>
> Chad, I can’t use session:recordFile because it’s a synchronous command
> that blocks my script.. I need to do a lot of actions like pauses, stream
> files etc., while the call is still going on…
>
> Maybe should I open a ticket for FreeSWITCH support? (I even don’t know if
> it exists hehe, maybe a github issue?)
>
> Thank you,
>
>
> On Jan 30, 2016, at 12:36 AM, Chad Phillips <chad at apartmentlines.com>
> wrote:
>
> have you tried the session method specifically for recording files?
>
>
> https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-session:recordFile
>
> or if that doesn't work, maybe this:
>
> local new_session = freeswitch.Session("someoriginatestring", session);
> uuid = new_session:get_uuid()
> api = freeswitch.API()
> reply = api:executeString("uuid_record " .. uuid .. " start " .. filepath)
>
> On Fri, Jan 29, 2016 at 1:31 PM, Oz Mortimer <omortimer at gmail.com> wrote:
>
>> since this is a single left call try setting record_stereo to false -
>> https://wiki.freeswitch.org/wiki/Variable_RECORD_STEREO
>> I'm probably wrong, but worth a shot!
>>
>> On 29 Jan 2016, at 19:53, Leonardo Ribeiro <llribeiro90 at gmail.com> wrote:
>>
>> Hello Guys,
>>
>> Any idea?
>> I could not evolve this yet...
>>
>> Thank you,
>>
>> 2016-01-28 18:52 GMT-02:00 Leonardo Lima Ribeiro <llribeiro90 at gmail.com>:
>>
>>> Hello all,
>>>
>>> I’m trying to record an IVR using my gateway to do the outbound call in
>>> my luascript:
>>>
>>> local new_session =
>>> freeswitch.Session("[origination_caller_id_name=‘987654321',origination_caller_id_number=‘987654321']sofia/gateway/MY_GATEWAY/
>>> 3157244022", session);
>>>
>>> new_session:execute("record_session","/usr/local/freeswitch/recordings/myrecording.wav")
>>> new_session:sleep("10000")
>>> new_session:hangup()
>>>
>>> So in the above script I just call to the Bank Of America as an example
>>> and try to record the first 10 seconds of the call in the recordings path.
>>>
>>> The problem is that I have an empty recording file.. Why?
>>>
>>> The funny thing is: if I add this command after the record_session
>>> command:
>>> new_session:streamFile("voicemail/vm-goodbye.wav”);
>>>
>>> And then this is the entire new script:
>>> local new_session =
>>> freeswitch.Session("[origination_caller_id_name=‘987654321',origination_caller_id_number=‘987654321']sofia/gateway/MY_GATEWAY/
>>> 3157244022", session);
>>>
>>> new_session:execute("record_session","/usr/local/freeswitch/recordings/myrecording.wav”)
>>> new_session:streamFile("voicemail/vm-goodbye.wav”);
>>> new_session:sleep("10000")
>>> new_session:hangup()
>>>
>>> I can hear the Good Bye sound from my script and then hear the Bank of
>>> America IVR.
>>>
>>> I just don’t understand why the record works if I play a sound in our
>>> side and the record does not work if I don’t play any sound.
>>>
>>> Do you know what’s happening? How can I solve this?
>>>
>>> Thank you!
>>>
>>>
>>
>>
>> --
>> Leonardo Lima Ribeiro
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://confluence.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> 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/20160201/0615edfc/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list