Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # HEP Server
- hepserver=127.0.0.1
- heport=9063
- hepid=199
- heptype=100
- localip=$(/sbin/ip -4 -o addr show dev eth0| awk '{split($4,a,"/");print a[1]}')
- syslogport=5514
- script="tail -f -n 0 -q"
- netcat="nc -k -l ${syslogport}"
- command=$script
- if ! [ $(which hepipe) ]; then
- echo "ERROR: Please install HEPipe (https://github.com/sipcapture/hepipe)";
- exit;
- fi
- log="/usr/local/freeswitch/log/freeswitch.log"
- if [[ -f $log ]]; then
- while read line
- do
- json_cdr=$(echo $line | grep /usr/local/freeswitch/log/json_cdr/ | sed 's/^.*\[\(.*\)\].*$/\1/')
- size=${#json_cdr}
- if [[ $size != 0 ]]; then
- logdate=$(echo $line | awk '{print $2, $3}')
- ts=$(date --date="$logdate" +%s)
- tsu=$(date --date="$logdate" +%4N)
- echo $json_cdr
- #echo "${ts};${tsu};${callid};${localip};${syslogport};${localip};${syslogport};${line}" | hepipe -s $hepserver -p $heport -i $hepid -t $heptype
- fi
- done < <($command $log)
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement