How Can I Manually Send A BYE Message To A PSTN Gateway?

Keywords: acc_db | acc_radius | acc_syslog

Bad things happen sometimes during development. It's just a fact of life. During my experience I've left billing records open on PSTNii gateway providers, which means they would get a bit upset with me since they could not bill certain calls.

The reason some calls were left open is that BYE messages were not properly record-routed, so the PSTN gateway was never informed that the call ended.

I came up with a technique to manually close billing records by using sipsak to send a BYE message.

This assumes that your have MySQL accounting turned on and have captured the INVITE and BYE message in the MySQL acc table.

In order to manually close a billing record you must first find the INVITE message in the MySQL acc table. When you locate the INVITE message you only need to grab the sip_callid field.

Next create a file on disk with your favorite editor. The contents of the file will be the BYE message and should look like the example below.

NOTE: Make sure you place the sip_callid from the MySQL acc table in to the Call-Seq header in this file.

BYE sip:dummy@11.22.33.44 SIPi/2.0
From: sip:dummay@12.34.56.78;user=phone
To: sip:dummy@12.34.56.78:5060;user=phone
Contact: sip:dummy@12.34.56.78;user=phone
CSeqii: 100 BYE
Call-ID: 9787963-3319555348-76751@100.240.90.99
Max-Forwards: 16
Content-Length: 0

NOTE: Make sure there is an extra blank line following the Content-Length header.

Once you have your BYE message constructed you can use sipsak to send it to the PSTN gateway.

sipsak -f bye.txt -s PSTN-GW-IP-ADDRESS

When you run the command you can ^C to stop it since sipsak will likely re-transmit BYE messages.

Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login