diff --git a/icwmp/Makefile b/icwmp/Makefile index ca876d764..a1fd0476b 100755 --- a/icwmp/Makefile +++ b/icwmp/Makefile @@ -12,7 +12,7 @@ PKG_VERSION:=4.0-2018-02-26 PKG_FIXUP:=autoreconf PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=5585bed07962f4c05e37efd7e90df09af1434fed +PKG_SOURCE_VERSION:=46a002e95f3330da471f7a975a114fe0961c409b PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) diff --git a/voice-client/files/usr/libexec/rpcd/voice.asterisk b/voice-client/files/usr/libexec/rpcd/voice.asterisk index e31cb65eb..989d2ef11 100755 --- a/voice-client/files/usr/libexec/rpcd/voice.asterisk +++ b/voice-client/files/usr/libexec/rpcd/voice.asterisk @@ -4,7 +4,7 @@ case "$1" in list) - echo '{ "status" : {}, "lines" : {}, "codecs" : {} }' + echo '{ "status" : {}, "lines" : {}, "codecs" : {}, "call_log" : {} }' ;; call) @@ -87,7 +87,7 @@ case "$1" in ;; call_log) - [ -e /var/run/asterisk/asterisk.ctl ] || { + [ -f /var/log/asterisk/cdr-csv/Master.csv ] || { echo "{}" return } @@ -96,39 +96,36 @@ case "$1" in json_add_array "call_log" 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)" + time="$(echo $line | cut -d',' -f12)" + timelen="$(echo $time | wc -c)" + [ $timelen -lt 14 ] && continue + uci show voice_client | grep user | grep -wq "$from" && direction="OUTGOING" || direction="INCOMING" json_add_object "" - json_add_string uniqueid "$(echo $line | cut -d',' -f19)" - json_add_string time "$(echo $line | cut -d',' -f16)" + json_add_string uniqueid "$uniqueid" + json_add_string time "$time" json_add_int duration 15 - json_add_string disposition "$(echo $line | cut -d',' -f16)" - json_add_string direction "$(echo $line | cut -d',' -f16)" - json_add_string from "$(echo $line | cut -d',' -f16)" - json_add_string to "$(echo $line | cut -d',' -f16)" + 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 + done < /var/log/asterisk/cdr-csv/Master.csv json_dump ;; esac ;; esac - "uniqueid": "1518532478.0", - "time": "2018-02-13 15:34:38", - "duration": 15, - "disposition": "ANSWERED", - "direction": "OUTGOING", - "from": "u0187001718", - "to": "0046706899045" - -"","u0187001718","09","sip0","""u0187001718"" ","BRCM/1/0","SIP/sip0-00000000","Dial","SIP/09@sip0,,gT","2018-02-26 09:51:31",,"2018-02-26 09:51:32",0,0,"NO ANSWER","DOCUMENTATION","15196350" -"","u0187001718","09","sip0","""u0187001718"" ","BRCM/1/0","","Wait","5","2018-02-26 09:51:32",,"2018-02-26 09:51:37",4,0,"NO ANSWER","DOCUMENTATION","1519635091.0","" -"","u0187001718","076","sip0","""u0187001718"" ","BRCM/1/1","SIP/sip0-00000001","Dial","SIP/076@sip0,,gT","2018-02-26 09:52:46",,"2018-02-26 09:52:47",0,0,"NO ANSWER","DOCUMENTATION","151963" -"","u0187001718","076","sip0","""u0187001718"" ","BRCM/1/1","","Congestion","","2018-02-26 09:52:47",,"2018-02-26 09:52:52",5,0,"FAILED","DOCUMENTATION","1519635166.4","" -"","u0187001718","0706899045","sip0","""u0187001718"" ","BRCM/1/2","SIP/sip0-00000002","Dial","SIP/0706899045@sip0,,gT","2018-02-26 09:53:02","2018-02-26 09:53:11","2018-02-26 09:53:15",12,3" -"","0706899045","u0187001718","call_line",""""" <0706899045>","SIP/sip0-00000003","BRCM/0/3","Dial","BRCM\/4,,tF(hangup,h,2)","2018-02-26 09:55:11",,"2018-02-26 09:55:18",7,0,"NO ANSWER","DOCUMENTATION"," -"","u0187001718","0706899045","sip0","""u0187001718"" ","BRCM/1/4","SIP/sip0-00000004","Dial","SIP/0706899045@sip0,,gT","2018-02-26 09:55:59",,"2018-02-26 09:56:07",7,0,"BUSY","DOCUMENTATION" -"","u0187001718","0706899045","sip0","""u0187001718"" ","BRCM/1/4","","Read","DIGIT,Busy,1,in,30","2018-02-26 09:56:07",,"2018-02-26 09:56:10",2,0,"BUSY","DOCUMENTATION","1519635359.14","" -"","u0187001718","0706899045","sip0","""u0187001718"" ","BRCM/1/5","SIP/sip0-00000005","Dial","SIP/0706899045@sip0,,gT","2018-02-26 09:57:50",,"2018-02-26 09:57:59",8,0,"BUSY","DOCUMENTATION" -"","u0187001718","0706899045","sip0","""u0187001718"" ","BRCM/1/5","","Read","DIGIT,Busy,1,in,30","2018-02-26 09:57:59",,"2018-02-26 09:58:01",1,0,"BUSY","DOCUMENTATION","1519635470.18","" - +# "uniqueid": "1518532478.0", +# "time": "2018-02-13 15:34:38", +# "duration": 15, +# "disposition": "ANSWERED", +# "direction": "OUTGOING", +# "from": "u0187001718", +# "to": "0046706899045"