Пример #1
0
UtlBoolean SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    UtlBoolean matchesTransaction = FALSE;
    UtlString handle;
    SipDialog::getDialogHandle(message, handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    Url fromField;
    Url toField;
    message.getFromUrl(fromField);
    message.getToUrl(toField);
    message.getCallIdField(callId);
    fromField.getFieldParameter("tag", fromTag);
    toField.getFieldParameter("tag", toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if(dialog && 
       dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag) &&
       dialog->isNextRemoteCseq(message))
    {
        matchesTransaction = TRUE;
    }

    unlock();
    
    return(matchesTransaction);
}
Пример #2
0
enum SipDialogMgr::transactionSequence
    SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    enum transactionSequence ordering;
    UtlString handle;
    message.getDialogHandle(handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    SipDialog::parseHandle(handle, callId, fromTag, toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if (dialog && 
        dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag))
    {
       int messageCSeq;
       message.getCSeqField(&messageCSeq, NULL);
       int lastRemoteCSeq = dialog->getLastRemoteCseq();
       ordering =
          messageCSeq < lastRemoteCSeq ? OUT_OF_ORDER :
          /** If this message was an exact duplicate of a previous message
           *  (with the same CSeq and branch parameter), it would have been
           *  absorbed earlier in processing.  So we know the branch parameter
           *  is different without having to remember the previous value.
           */
          messageCSeq == lastRemoteCSeq ? LOOPED :
          IN_ORDER;
    }
    else
    {
       ordering = NO_DIALOG;
    }

    unlock();
    
    return ordering;
}