Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Feed
openwrt-telephony
Commits
0c7aba8c
Commit
0c7aba8c
authored
Jul 12, 2021
by
Sukru Senli
Browse files
asterisk: remove deprecated call_log method from voice.asterisk ubus object
parent
f4f57b26
Changes
1
Hide whitespace changes
Inline
Side-by-side
net/asterisk/files/iopsys/usr/libexec/rpcd/voice.asterisk
View file @
0c7aba8c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment