Problem with on_record_hook.sh

Hi!

We are trying to use on_record_hook after the recording of video streaming. The file is created correctly into /records directory. But it seems the hook on_record_hook.sh is not executed.

Our script for testing:
Code:
/usr/bin/logger "HOOK WORK CORRECTLY"
touch "/usr/local/FlashphonerWebCallServer/records/PUPPA"
If I shell "sh /opt/on_record_hook.sh", the file PUPPA is created correctly and "HOOK WORK CORRECTLY" is printed into log.

our flashphoner.property are:
Code:
ip                     =80.XXX.XXX.XXX
ip_local               =10.10.XXX.XXX
port_from              =XX000
port_to                =XX000
media_port_from        =XX001
media_port_to          =XX000
waiting_answer         =60
user_agent             =Flashphoner/1.0
balance_header         =balance
cost_header            =cost
video_enabled          =true
domain                 =
outbound_proxy         =
outbound_port          =
log_level              =10
enable_context_logs    =false
rtp_activity_detecting =true,60
sip_msg_listener       =com.flashphoner.sdk.sip.ChangeCallIdListener

call_record_listener   =com.flashphoner.server.client.DefaultCallRecordListener
dtmf                         =rfc2833
auto_login_url         =/usr/local/FlashphonerWebCallServer/conf/account.xml
get_callee_url         =/usr/local/FlashphonerWebCallServer/conf/callee.xml
codecs                   =opus,alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,vp8,h264,flv,mpv
codecs_exclude_sip       =mpeg4-generic,flv,mpv
codecs_exclude_streaming =flv,telephone-event
codecs_exclude_sip_rtmp  =opus,g729,g722,mpeg4-generic,vp8,mpv
on_record_hook_script  =/opt/on_record_hook.sh
client_log_level=INFO
enable_extended_logging=true
keep_extended_logs_max_days=15
rtmp_transponder_stream_name_prefix =rtmp_
-e
#The part below is moved from server.properties...
#Config

ws.port                 =XXXX

wss.port                =XXX3
#File will be located in conf directory
#wss.keystore.file       =XXXX
wss.keystore.password   =XXXXX
wss.cert.password       =XXXXXXX

rtmp.port               =XX35
rtmfp.port                       =XX35

#keep_alive_algorithm may be INTERNAL, NONE, HIGH_LEVEL
keep_alive.algorithm       =HIGH_LEVEL
keep_alive.peer_interval   =2000
keep_alive.server_interval =5000
keep_alive.probes          =10


#Reliability: on, partial, off
video_reliable          =partial
audio_reliable          =partial

audio_frames_per_packet =6
burst_avoidance_count   =100
flush_audio_interval    =80
flush_video_interval    =0
record_streams = true
 

Max

Administrator
Staff member
Hello.
Have you set executon rights to your script:
Code:
chmod +x /opt/on_record_hook.sh
?
 

Max

Administrator
Staff member
How you start recording? Is record file created in WCS_HOME/records directory?
Try to modify your test script like this
Code:
STREAM_NAME=$1
FILE_NAME=$2

echo $STREAM_NAME >> /var/log/stream_record.log
echo $FILE_NAME >> /var/log/stream_record.log
echo ========== >> /var/log/stream_record.log
so it should write stream name and record file name to log file, this test will be more informative
 
We start recording with the with API call, passing the mediaSessionId of stream we need to record.
The stream is saved correctly into WCS_HOME/records.
We are change the test script like you have mentioned.

After recording some test the stream, new file are in /records
Code:
-rw-r--r--  1 root root  65366 Sep 12 09:48 stream-21606040-b660-11e8-880f-b320edd7c9d3-ggpl0tt3lca8g47h2k2ln7jhe6.webm
But no new file log are created.
 

TheRoyalPotato

New Member
Hi Flashphoner, we are having the exact same issue as above. Upon video completion the script that used to be automatically run does not run. If we run it manually it works fine, but flashphoner does not execute it as it should.
Our issue has been happening since the exact same day this forum post was made and none of the above has rectified it.
 

Max

Administrator
Staff member
Hello Kevin.
We can't reproduce the issue with settings from config that you have sent. We set up the latest version 5.1.3600 on test server according to your config, play an RTSP stream, and on_record_hook.sh script placed in default location (WCS_HOME/bin/on_record_hook.sh) was run automatically when a stream was stopped.
Please note the following:
1) Record hook script starts when stream is stopped, not when one part of record is written to disk. Your script should collect all recorded parts by file name.
2) If you use automatic stream capture on server start (as commented in your config), you should stop the stream to finish its recording and to launch record hook script.
 
Top