private void UACInviteTransaction_TransactionFinalResponseReceived(SIPEndPoint localSIPEndPoint, SIPEndPoint remoteEndPoint, SIPTransaction sipTransaction, SIPResponse sipResponse)
{
try
{
// BranchId for 2xx responses needs to be a new one, non-2xx final responses use same one as original request.
if (sipResponse.StatusCode >= 200 && sipResponse.StatusCode < 299)
{
if (_sendOkAckManually == false)
{
Send2xxAckRequest(null, null);
}
}
else
{
// ACK for non 2xx response is part of the INVITE transaction and gets routed to the same endpoint as the INVITE.
var ackRequest = GetInTransactionACKRequest(sipResponse, m_transactionRequest.URI);
base.SendRequest(ackRequest);
}
UACInviteTransactionFinalResponseReceived?.Invoke(localSIPEndPoint, remoteEndPoint, sipTransaction, sipResponse);
if (CDR != null)
{
SIPEndPoint localEP = SIPEndPoint.TryParse(sipResponse.Header.ProxyReceivedOn) ?? localSIPEndPoint;
SIPEndPoint remoteEP = SIPEndPoint.TryParse(sipResponse.Header.ProxyReceivedFrom) ?? remoteEndPoint;
CDR.Answered(sipResponse.StatusCode, sipResponse.Status, sipResponse.ReasonPhrase, localEP, remoteEP);
}
}
catch (Exception excp)
{
logger.LogError($"Exception UACInviteTransaction_TransactionFinalResponseReceived. {excp.Message}");
}
}