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

Kingsley Tart kingsley at dns99.co.uk
Thu Apr 8 10:55:39 EST 2021


Hi,

I'm using OpenSIPS 3.1 with logging to DB and using the dialog module.

It is logging INVITE messages, but not BYE and I can't see why. I'm new
to OpenSIPS so this is puzzling me a bit.


This is what I'm setting in the acc module:

loadmodule "acc.so"
modparam("acc", "early_media", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "db_url", "mysql://blah...")


My main route script starts with this:

	script_trace(1, "method $rm");


I'm doing this when an INVITE comes in:

	t_newtran();
	create_dialog("pPB");
	do_accounting("db", "cdr|missed|failed");


I have this, but it made no difference (although "BYE RECEIVED" did
appear in the opensips log):

	if (is_method("BYE")) {
		# do accounting even if the transaction fails
		xlog("BYE RECEIVED");
		do_accounting("db", "cdr|missed|failed");
	}


I have this event route:

event_route[E_DLG_STATE_CHANGED] {
	switch ($param(7)) {
		case 1:
			xlog("** DLG ** INVITE SENT");
			break;
		case 2:
			xlog("** DLG ** PROVISIONAL REPLY");
			break;
		case 3:
			xlog("** DLG ** PROVISIONALLY ANSWERED");
			break;
		case 4:
			xlog("** DLG ** CONFIRMED ANSWERED");
			break;
		case 5:
			xlog("** DLG ** BYE RECEIVED - ENDED");
			break;
	}
}


and I see this in the opensips log when the call ends (I see
"do_accounting" in the trace):

/usr/sbin/opensips[22551]: ** DLG ** BYE RECEIVED - ENDED
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:225][core if] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:220][module validate_dialog] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:230][core if] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:225][module is_method] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:238][core if] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:230][module is_method] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:233][module do_accounting] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:238][route relay] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:431][core if] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:428][module t_relay] -> (method BYE)
/usr/sbin/opensips[22552]: [Script Trace][/etc/opensips/opensips.cfg:431][core exit] -> (method BYE)


But the acc table only ever gets INVITEs logged; here are records for
the last 2 test calls:

MariaDB [opensips]> SELECT id,method,callid,sip_code FROm acc ORDER BY
id DESC LIMIT 4;
+-----+--------+--------------------------------------+----------+
| id  | method | callid                               | sip_code |
+-----+--------+--------------------------------------+----------+
| 234 | INVITE | 18d9cfb9-5add-4824-9d19-b828c10df9f4 | 200      |
| 233 | INVITE | 18d9cfb9-5add-4824-9d19-b828c10df9f4 | 183      |
| 232 | INVITE | a3a3f3b3-3ac0-45de-8cb7-f208b2d420d0 | 200      |
| 231 | INVITE | a3a3f3b3-3ac0-45de-8cb7-f208b2d420d0 | 183      |
+-----+--------+--------------------------------------+----------+


Am I missing something obvious?

Cheers,
Kingsley.




More information about the Users mailing list