Пример #1
0
UtlBoolean SipDialogMgr::setNextLocalTransactionInfo(SipMessage& request,
                                                     const char* method,
                                                     const char* dialogHandle)
{
    UtlBoolean requestSet = FALSE;
    UtlString dialogHandleString(dialogHandle ? dialogHandle : "");
    if(dialogHandleString.isNull())
    {
        request.getDialogHandle(dialogHandleString);
    }

    lock();
    SipDialog* dialog = findDialog(dialogHandleString,
                                   FALSE, // If established only want exact match dialogs
                                   TRUE); // If message is from a prior transaction
                                          // when the dialog was in an early state
                                          // allow it to match an established
                                          // dialog
    if(dialog)
    {
        dialog->setRequestData(request, method);
        requestSet = TRUE;

#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog: '%s'",
                      dialogDump.data());
#endif
    }
    else
    {
       OsSysLog::add(FAC_SIP, PRI_ERR, "SipDialogMgr::setNextLocalTransactionInfo dialog not found for handle '%s'",
                     dialogHandle);

       if (OsSysLog::willLog(FAC_SIP, PRI_DEBUG))
       {
          SipDialog* dialog;
          UtlHashBagIterator iterator(mDialogs);
          
          while ((dialog = (SipDialog*) iterator()))
          {
             UtlString callId, localTag, remoteTag;
             dialog->getCallId(callId);
             dialog->getLocalTag(localTag);
             dialog->getRemoteTag(remoteTag);
             OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog call-id = '%s', local tag = '%s', remote tag = '%s'",
                           callId.data(), localTag.data(), remoteTag.data());
          }
       }
    }

    unlock();

    return(requestSet);
}
Пример #2
0
UtlBoolean SipDialogMgr::setNextLocalTransactionInfo(SipMessage& request,
                                                     const char* method,
                                                     const char* dialogHandle)
{
    UtlBoolean requestSet = FALSE;
    UtlString dialogHandleString(dialogHandle ? dialogHandle : "");
    if(dialogHandleString.isNull())
    {
       SipDialog::getDialogHandle(request, dialogHandleString);
    }

    lock();
    SipDialog* dialog = findDialog(dialogHandleString,
                                   FALSE, // If established only want exact match  dialogs 
                                   TRUE); // If message is from a prior transaction
                                          // when the dialog was in an early state
                                          // allow it to match and established 
                                          // dialog
    if(dialog)
    {
        dialog->setRequestData(request, method);
        requestSet = TRUE;

#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        printf("SipDialogMgr::setNextLocalTransactionInfo dialog:\n%s\n",
               dialogDump.data());
#endif

    }
    else
    {
        OsSysLog::add(FAC_SIP,
                      PRI_WARNING, 
                      "SipDialogMgr::setNextLocalTransactionInfo could not find dialog with handle %s",
                      dialogHandle);
    }

    unlock();

    return(requestSet);
}