FreeSWITCH call recording missing header information
I have a dialplan setup that records a bridged call in FreeSWITCH, which sets the 'api_hangup_hook' variable to call a lua script when the call hangs up, and the called lua script moves the recorded .wav file from it's temporary location to a final destination. This works, but recently I noticed that some of my .wav recordings have no header information, which results in many players choking when trying to play it. I eventually figured out that the header information for the .wav file appears to be written *after* the call is hung up, and file move operation in the api_hangup_hook moves the file before the header information has been written. This occurs sporadically. I've found that introducing a 1 second sleep in my lua script fixes this race condition, but that seems a bit of an ugly hack. Curious if anybody else has run into this, and/or can offer me a cleaner solution than my sleep hack. I'm attaching a brief summary of the dialplan and lua script for anyone that wants to see the code.
maybe listen to the RECORD_STOP event instead of the hangup hook? also inotify on OS worked for me well. On Mon, Dec 14, 2020 at 8:14 AM Chad Phillips <chad@apartmentlines.com> wrote:
I have a dialplan setup that records a bridged call in FreeSWITCH, which sets the 'api_hangup_hook' variable to call a lua script when the call hangs up, and the called lua script moves the recorded .wav file from it's temporary location to a final destination.
This works, but recently I noticed that some of my .wav recordings have no header information, which results in many players choking when trying to play it.
I eventually figured out that the header information for the .wav file appears to be written *after* the call is hung up, and file move operation in the api_hangup_hook moves the file before the header information has been written. This occurs sporadically.
I've found that introducing a 1 second sleep in my lua script fixes this race condition, but that seems a bit of an ugly hack.
Curious if anybody else has run into this, and/or can offer me a cleaner solution than my sleep hack.
I'm attaching a brief summary of the dialplan and lua script for anyone that wants to see the code. _________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- About: http://about.me/dujinfang Blog: http://www.dujinfang.com Proj: http://www.freeswitch.org.cn
Another option is to just rely on CDRs, you can have FS post them remotely AND save them to local disk... 1- record 2- end call 3- when local cdr is generated parse it (json/xml) 4- search for the var that has the recording location 5- do stuff.... Cheers, Joel. On Wed, Dec 16, 2020 at 05:24 Seven Du <dujinfang@gmail.com> wrote:
maybe listen to the RECORD_STOP event instead of the hangup hook? also inotify on OS worked for me well.
On Mon, Dec 14, 2020 at 8:14 AM Chad Phillips <chad@apartmentlines.com> wrote:
I have a dialplan setup that records a bridged call in FreeSWITCH, which sets the 'api_hangup_hook' variable to call a lua script when the call hangs up, and the called lua script moves the recorded .wav file from it's temporary location to a final destination.
This works, but recently I noticed that some of my .wav recordings have no header information, which results in many players choking when trying to play it.
I eventually figured out that the header information for the .wav file appears to be written *after* the call is hung up, and file move operation in the api_hangup_hook moves the file before the header information has been written. This occurs sporadically.
I've found that introducing a 1 second sleep in my lua script fixes this race condition, but that seems a bit of an ugly hack.
Curious if anybody else has run into this, and/or can offer me a cleaner solution than my sleep hack.
I'm attaching a brief summary of the dialplan and lua script for anyone that wants to see the code. _________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- About: http://about.me/dujinfang Blog: http://www.dujinfang.com Proj: http://www.freeswitch.org.cn _________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
participants (3)
-
Chad Phillips
-
Joel Serrano
-
Seven Du