Question

How is it possible to create a new subscription using SipSorcery, if your TCP connection died within the expiry timer of your initial subscription? Write now I'm having a expiry timer running, and when it elapse, I'm checking if the connection is established like this:

while (!tcpChannel.IsConnectionEstablished(myRemoteEndpoint))
{
    //... using same from tag, but creating new call id saved as SIPRequest _request...
    System.Threading.Thread.Sleep(1000 * 60);
    tcpChannel.Send(myRemoteEndpoint, Encoding.UTF8.GetBytes(_request.ToString());
}

The idea was to wait 60 seconds, then try to send a new SUBSCRIBE to the server, check if the connection is established, if not run again after 60 senconds, until the connection is established.

But the .IsConnectionEstablished seems a little unreliable to this purpose... Its like the while loop blocking for something. I can see that my SUBSCRIBE request has been sended, but I ain't receiving any response on that request.

Any ideas are appriciated.

Was it helpful?

Solution

You shouldn't need to do the IsConnectionEstablished check. When you call tcpChannel.Send it will take care of establishing a new TCP connection to the required end point if one is not available.

As to why you are not receiving a response to your subsequent SUBSCRIBE requests if you are re-sending the same request repeatedly without updating the required headers such as CSeq, Via branchid, Call-ID & from tag then it's probably getting flagged as a duplicate request.

Also you may want to have a look SIPSorcery.SIP.App.SIPNotifierClient as it is designed to maintain a subscription with a SIP server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top