Closing a SIP session in Asterisk

I occasionally get incomming SIP sessions that remain active on my Asterisk box after they have been cleared down by the SIP Gateway. This happens when there has been a fault on the network and the call has been interupted.

If this happens with a large number of simultaneous calls, the affect is I appear to be DOSing the SIP Gateway with one way traffic!

Is there a way to close specific active SIP sessions that Asterisk believes are active?

Is there a way to monitor SIP sessions to flag when the SIP session is no longer active on the remote Gateway.

Cheers!

I’d like to learn how to determine if a session is indeed active. If the session is associated with a call, soft hangup could end that call. But I’ve seen sessions without an active call. :frowning:

I’ve noticed on a few systems that some SIP sessions stay open. It’s a bit annoying/embarrassing not understanding why this happens when asked.