Published on iptel.org (http://www.iptel.org)

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

By lakmal
Created 2006-10-31 11:36

Bad things happen sometimes during development. It's just a fact of life. During my experience I've left billing records open on PSTNi [1]i [2] 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 [3]/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
CSeqi [4]i [5]: 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.


Source URL:
http://www.iptel.org/faq/how_can_i_manually_send_a_bye_message_to_a_pstn_gateway_0
Home |  Recent changes |  Search |  Glossary |  Sitemap |  Login