public SIPResponse GetResponse(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPResponseStatusCodesEnum responseCode, string reasonPhrase)
{
try
{
if (localSIPEndPoint == null)
{
localSIPEndPoint = GetDefaultSIPEndPoint();
}
SIPResponse response = new SIPResponse(responseCode, reasonPhrase, localSIPEndPoint);
SIPSchemesEnum sipScheme = (localSIPEndPoint.Protocol == SIPProtocolsEnum.tls) ? SIPSchemesEnum.sips : SIPSchemesEnum.sip;
SIPFromHeader from = new SIPFromHeader(null, new SIPURI(sipScheme, localSIPEndPoint), null);
SIPToHeader to = new SIPToHeader(null, new SIPURI(sipScheme, localSIPEndPoint), null);
int cSeq = 1;
string callId = CallProperties.CreateNewCallId();
response.Header = new SIPHeader(from, to, cSeq, callId);
response.Header.CSeqMethod = SIPMethodsEnum.NONE;
response.Header.Vias.PushViaHeader(new SIPViaHeader(new SIPEndPoint(localSIPEndPoint.Protocol, remoteEndPoint.GetIPEndPoint()), CallProperties.CreateBranchId()));
response.Header.MaxForwards = Int32.MinValue;
response.Header.Allow = ALLOWED_SIP_METHODS;
return response;
}
catch (Exception excp)
{
logger.Error("Exception SIPTransport GetResponse. " + excp.Message);
throw;
}
}