OPTIONS Ping Support

Place for developers to chat about the code

OPTIONS Ping Support

Postby SachaD » Sun Oct 03, 2010 12:07 am

It appears that SS does not currently handle OPTIONS Ping (OPTIONS requests out of an already established dialogue ). Such OPTIONS requests are frequently used by unauthenticated SIP Trunks / Gateways as a mean to verify peer is still reachable.

Looking at the code (GotRequest in SIPAppServerCore.cs), I believe support for OPTIONS Ping could be implemented with the following minor change:


SIPAppServerCore.cs

Line 48 (Insert):

using SIPSorcery.Net;


Line 239 (Insert):

else if (sipRequest.Method == SIPMethodsEnum.OPTIONS)
{
// Send back the remote SDP.
FireProxyLogEvent(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "OPTIONS request for ANONYMOUS.", fromUser));
SIPNonInviteTransaction optionsTransaction = m_sipTransport.CreateNonInviteTransaction(sipRequest, remoteEndPoint, localSIPEndPoint, m_outboundProxy);
SIPResponse okResponse = SIPTransport.GetResponse(sipRequest, SIPResponseStatusCodesEnum.Ok, null);
okResponse.Body = String.Empty;
okResponse.Header.ContentLength = okResponse.Body.Length;
okResponse.Header.ContentType = SDP.SDP_MIME_CONTENTTYPE;
optionsTransaction.SendFinalResponse(okResponse);
}

Does this make sense?
Thanks for your consideration.

Regards,
Sacha
SachaD
 
Posts: 7
Joined: Thu Sep 30, 2010 4:59 am

Re: OPTIONS Ping Support

Postby Aaron » Sun Oct 03, 2010 10:12 am

OPTIONS requests wil be repsonded to with a 405 Method Not Allowed response, which happens in the same spot on line 239 in SIPAppServerCore.cs. All the SIP servers I've come across that use OPTIONS requests as a keep-alive mechanism don't care what the response code is as long as they get one and in that case the 405 response will work fine.
User avatar
Aaron
Site Admin
 
Posts: 4055
Joined: Thu Jul 12, 2007 12:13 am


Return to Developer Chat



Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB® Forum Software © phpBB Group
Theme created by StylerBB.net