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); }
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); }
UtlBoolean SipRefreshManager::stopRefresh(const char* dialogHandle) { UtlBoolean stateFound = FALSE; lock(); // Find the refresh state UtlString dialogHandleString(dialogHandle); RefreshDialogState* state = getAnyDialog(dialogHandleString); // Remove the state so we can release the lock if(state) { mRefreshes.removeReference(state); } unlock(); // If a matching state exists if(state) { // If the subscription or registration has not expired // or there is a pending request long now = OsDateTime::getSecsSinceEpoch(); if(state->mExpiration > now || state->mRequestState == REFRESH_REQUEST_PENDING) { if(state->mpLastRequest) { // Reset the request with a zero expiration setForResend(*state, TRUE); // expire now // Don't really need to set this stuff as we are // going to delete the state anyway state->mRequestState = REFRESH_REQUEST_PENDING; state->mPendingStartTime = now; state->mExpirationPeriodSeconds = 0; mpUserAgent->send(*(state->mpLastRequest)); // Invoke the refresh state call back to indicate // the refresh has been expired UtlBoolean stateKeyIsEarlyDialog = SipDialog::isEarlyDialog(*state); (state->mpStateCallback)(state->mRequestState, stateKeyIsEarlyDialog ? state->data() : NULL, stateKeyIsEarlyDialog ? NULL : state->data(), state->mpApplicationData, -1, // responseCode NULL, // responseText, 0, // zero means expires now NULL); // response } // No prior request for some reason else { OsSysLog::add(FAC_SIP, PRI_ERR, "SipRefreshManager::stopRefresh state with NULL mpLastRequest"); } } // Stop and delete the refresh timer state->mpRefreshTimer->stop(); deleteTimerAndEvent(state->mpRefreshTimer); // Get rid of the dialog mpDialogMgr->deleteDialog(*state); // Fire and forget delete state; state = NULL; stateFound = TRUE; } return(stateFound); }