/// <summary> /// Receives the SIP response /// </summary> /// <param name="transaction">The transaction.</param> /// <param name="response">The response.</param> public override void ReceivedResponse(Transaction transaction, Message response) { ProxyBranch branch = GetBranch(transaction); if (branch == null) { Debug.Assert(false, "Invalid transaction received " + transaction); return; } if (response.Is1XX() && branch.CancelRequest != null) { Transaction cancel = Transaction.CreateClient(Stack, this, branch.CancelRequest, transaction.Transport, transaction.Remote); branch.CancelRequest = null; } else { if (response.IsFinal()) { branch.Response = response; Stack.ReceivedResponse(this, response); //SendResponseIfPossible(); } else { response.Headers["Via"].RemoveAt(0); if (response.Headers["Via"].Count <= 0) { response.Headers.Remove("Via"); } SendResponse(response); Stack.ReceivedResponse(this, response); } } }
/// <summary> /// Triggered on receipt of any responses. Updates state of transaction. /// </summary> /// <param name="response">The SIP response message.</param> public override void ReceivedResponse(Message response) { if (response.Is1XX()) { if (State == "trying") { State = "proceeding"; App.ReceivedResponse(this, response); } else if (State == "proceeding") { App.ReceivedResponse(this, response); } } else if (response.IsFinal()) { if (State == "trying" || State == "proceeding") { State = "completed"; App.ReceivedResponse(this, response); if (!Transport.Reliable) { StartTimer("K", Timer.K()); } else { Timeout("K", 0); } } } }