IsFinal() public method

Determines whether this instance is final (response code >= 200).
public IsFinal ( ) : bool
return bool
示例#1
0
        /// <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);
                }
            }
        }
示例#2
0
 /// <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);
             }
         }
     }
 }
 /// <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);
             }
         }
     }
 }
示例#4
0
 /// <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);
         }
     }
 }