Commit 0c7aba8c authored by Sukru Senli's avatar Sukru Senli
Browse files

asterisk: remove deprecated call_log method from voice.asterisk ubus object

parent f4f57b26
......@@ -5,8 +5,7 @@
case "$1" in
list)
echo '{ "status" : {}, "lines" : {}, "codecs" : {}, "call_log" : {}, "supported_countries" : {} }'
echo '{ "status" : {}, "lines" : {}, "codecs" : {}, "supported_countries" : {} }'
;;
call)
case "$2" in
......@@ -78,46 +77,6 @@ case "$1" in
codecs)
cat /lib/voice/codecs.json 2>/dev/null
;;
call_log)
json_init
json_add_array "call_log"
[ -f /var/log/asterisk/cdr-csv/Master.csv ] || {
json_dump
return
}
while read -r line
do
line="$(echo $line | tr -d '\"')"
uniqueid="$(echo $line | awk -F',' '{print $(NF-1)}')"
echo $uniqueid | grep "[A-Z,a-z]" && continue
from="$(echo $line | cut -d',' -f2)"
to="$(echo $line | cut -d',' -f3)"
# "from" will be empty for call log of internal call (beween extension numbers)
[ -z "$from" ] && [ -z "$to" ] && continue
account="$(echo $line | cut -d',' -f4)"
actok=0
uci show $VOICE_UCI_CONFIG | grep sip_service_provider | grep -wq "$account" && actok=1
[ "$account" == "call_line" ] && actok=1
[ $actok -eq 0 ] && continue
timestart="$(echo $line | awk -F',' '{print $(NF-8)}')"
timend="$(echo $line | awk -F',' '{print $(NF-6)}')"
startdate=$(date -u -d "$timestart" +"%s")
enddate=$(date -u -d "$timend" +"%s")
uci show $VOICE_UCI_CONFIG | grep user | grep -wq "$from" && direction="OUTGOING" || direction="INCOMING"
json_add_object ""
json_add_string uniqueid "$uniqueid"
json_add_string time "$timestart"
json_add_int duration $((enddate - startdate))
json_add_string disposition "$(echo $line | awk -F',' '{print $(NF-3)}')"
json_add_string direction "$direction"
json_add_string from "$from"
json_add_string to "$to"
json_select ..
done < /var/log/asterisk/cdr-csv/Master.csv
json_dump
;;
supported_countries)
vcf="/tmp/voice.supported_countries"
supportedCountries > $vcf
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment