That's why the recommended way above for negative responses was to use failure_route, not onreply_route like for 200ok.Hi,
On Wed, Jan 25, 2017 at 9:26 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
To some extent you may be able to do it in configuration file by replacing the acc default behaviour with sqlops. The records are written by mysql when 200ok is received (which can be caught via an onreply_route) or a final negative response is handled (which can be caught via a failure_route). There you can use acc_db_request() to write the record to database and then sqlops to retrieve the ID. Just an idea by now, but it seems to be doable ...
Be careful with own-built accounting. We did this on a system once, and you really have to make sure you account the correct reply. For instance if the call is forked by kamailio, you might get a 486 from one device and later a 200 OK from the other one. If you only take the first reply, you might end up with wrong call state.
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com