[OpenSIPS-Users] OpenSIPS 3.1 DB logging INVITEs but not BYEs

Kingsley Tart kingsley at dns99.co.uk
Fri Apr 9 11:41:07 EST 2021


Hi,

I don't know whether you know but MariaDB v10 (that's the version I
happen to be using; I don't know about other versions or specifically
MySQL) has a general log that can be enabled and if on, logs all
queries, thus avoiding the need to use ngrep; eg:

MariaDB [opensips]> SHOW VARIABLES LIKE '%general%';
+------------------+--------------------+
| Variable_name    | Value              |
+------------------+--------------------+
| general_log      | OFF                |
| general_log_file | bt-ipx-proxy-b.log |
+------------------+--------------------+
2 rows in set (0.001 sec)

MariaDB [opensips]> SET @@GLOBAL.general_log=1;
Query OK, 0 rows affected (0.012 sec)

MariaDB [opensips]> SHOW VARIABLES LIKE '%general%';
+------------------+--------------------+
| Variable_name    | Value              |
+------------------+--------------------+
| general_log      | ON                 |
| general_log_file | bt-ipx-proxy-b.log |
+------------------+--------------------+
2 rows in set (0.002 sec)

MariaDB [opensips]> exit
Bye

# cat /var/lib/mysql/bt-ipx-proxy-b.log
/usr/sbin/mysqld, Version: 10.3.27-MariaDB-0+deb10u1 (Debian 10). started with:
Tcp port: 3306  Unix socket: /run/mysqld/mysqld.sock
Time                Id Command  Argument
210409 12:34:59 334515 Query    SHOW VARIABLES LIKE '%general%'
210409 12:36:35 334515 Quit

(ie it logged my querying of the variables the second time now that the
setting was enabled).

Obviously it's not something you'd want to leave enabled for long in
some environments :)

Cheers,
Kingsley.

On Thu, 2021-04-08 at 12:26 -0500, Marcin Groszek wrote:
> At initial invite some information are stored like a start time, this is 
> needed to calculate the duration at the call end.
> 
> I believe if you do: do_accounting("db","cdr") this will write only 1 
> invite entry in acc at the end of the call,
> 
> but if you do: do_accounting("db") this will write your invite and bye 
> as 2 entries in acc table.
> 
> make a call, select * from acc at your db hung up the call and select 
> again you will see when the entries are written.
> 
> You may also use ngrep -port 3306 -dlo to monitor db access by opensips 
> but you have to change localhost to 127.0.0.1 in modparam.
> 
> modparam("acc", "db_url", "mysql://opensips:opensipsrw@127.0.0.1/opensips")





More information about the Users mailing list