Somehow this got out of focus, but reviewing agan, I can't see how this is working unless kamailio is started with:
``` modparam("siptrace", "trace_to_database", 1) ```
so every Kamailio worker process get the connection to database initialized at startup. Then tracing to database can be disabled/(re-)enabled during runtime.
With this PR, if trace_to_database=0 at startup, then the global static db_con is NULL for worker processes and the RPC command initializes it only for the RPC process, it cannot do it for all the other Kamailio processes. There, db_con stays NULL, eventually resulting in crashes or not writing to database.