Hello,
i was working on a similar problem. I followed the acc-dialog ->
(r)syslog approach.
In rsyslog I piped the message to a script, which appends the message
as a xml-record to a file in "/var/log/kamailio-call.log“.
(This script might be useful for you to adapt to your needs.)
module(load="omprog“)
local6.* action(type="omprog" binary="/etc/rsyslog-cdr-script.sh")
and my script looks like
#! /bin/ash
Log=/var/log/kamailio-call.log
read fromstdin;
while read fromstdin; do
echo $fromstdin | sed -e "s/^[^;]* \(.*=\)/\1/" -e
"s/\(time=[0-9]*\)\.[0-9]*/\1/g" -e "s/\([^=;]*\)=\([^;]*\(;[^
][^=]*=[^;]*\)*\); / <\1>\2<\/\1>; /g" -e "s/
\([^=;]*\)=\([^;]*\(;[^
][^=]*=[^;]*\)*\)$/ <\1>\2<\/\1>/" | awk 'BEGIN {FS=";";
printf
"<call>"} { i = 1; while(i <
NF){if(index($i,"time>")>0) { time_value
= $i; gsub("<[^>]*>","",time_value);
sub(">[^<]*",
strftime(">%Y-%m-%dT%H:%M:%S", time_value), $i); } printf $i; i =
i+1;} } END {print "</call>"}' >> $Log
done
Here a little explanation that might be helpful to understand the
commands:
The sed-command
*) removes the front syslog-stuff
*) trunks all the post dot digit from any entry that names ends with
„time" and
*) converts it to xml-syntax (one extra for the last entry)
The awk command converts the (trunked) timestamps into a
"human-readable“ format and adds the enclosing „call“ syntax.
(If you exactly know what your syslog entry syntax is, you might
simplify the script statements a lot … )
I hope this helps a little.
Regards
Jan-Hendrik
Am 07.04.2019 um 12:42 schrieb Henning Westerholt
<hw(a)skalatan.de
<mailto:hw@skalatan.de>>:
Hello,
some starting points:
- use dlg_manage() or set a dialog flag in the cfg to start dialog
tracking
- setup the dialog event routes (section 11 in README) and put your
logging logic there
Best regards,
Henning
Am 06.04.19 um 11:29 schrieb Yu Boot:
How to make something on dialog event? Just
can't figure it out after
reading module docs :(
06.04.2019 2:09, David Villasmil пишет:
You can always export the cdr table
periodically.
Take a look at siremis. And when the trigger fires every 5 minutes to
create the cdrs, just export them.
Also, as it’s been said, you can use the dialog and when the call
ends gather all the info and just print it out. You can direct it to
rsyslog to save it anywhere you want.
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Henning Westerholt -
https://skalatan.de/blog/
Kamailio services -
https://skalatan.de/services
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org <mailto:sr-users@lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users