UtlBoolean SipDialog::isSameDialog(const UtlString& callId, const UtlString& localTag, const UtlString& remoteTag) const { // Literal/exact match of tags only // i.e. do not allow a null tag to match a set tag UtlBoolean isSameDialog = FALSE; if(callId.compareTo(*this, UtlString::ignoreCase) == 0) { if(localTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0 && remoteTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0) { isSameDialog = TRUE; } else if(remoteTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0 && localTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0) { isSameDialog = TRUE; } } return(isSameDialog); }
UtlBoolean SipDialog::isEarlyDialogFor(const UtlString& callId, const UtlString& localTag, const UtlString& remoteTag) const { UtlBoolean isSameEarlyDialog = FALSE; // If the local tag is NULL the remote tag must match one of the // two given tags, to be an early dialog for the given dialog info if(mLocalTag.isNull()) { if(localTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0 || remoteTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0) { isSameEarlyDialog = TRUE; } } // If the remote tag is NULL the local tag must match one of the // two given tags, to be an early dialog for the given dialog info else if(mRemoteTag.isNull()) { if(localTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0 || remoteTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0) { isSameEarlyDialog = TRUE; } } return(isSameEarlyDialog); }
// Constructor accepting a url resource, type, and cache all flag MpStreamFeeder::MpStreamFeeder(Url resource, int flags) : m_state(UnrealizedState) , m_pFormatDecoder(NULL) , m_pDataSource(NULL) , m_bMarkedPaused(FALSE) , m_pEventHandler(NULL) , m_eventGuard(OsMutex::Q_FIFO) { mFlags = flags ; UtlString scheme ; m_iInstanceId = s_iInstanceCount++ ; #ifdef MP_STREAM_DEBUG /* [ */ osPrintf("MpStreamFeeder(%d): Construction url=%s, flags=0x%08X\n", m_iInstanceId, resource.toString().data(), flags) ; #endif /* MP_STREAM_DEBUG ] */ // Instantiate appropriate data source resource.getUrlType(scheme) ; if ( ( scheme.compareTo("http", UtlString::ignoreCase) == 0) || ( scheme.compareTo("https", UtlString::ignoreCase) == 0) ) { m_pDataSource = new StreamHttpDataSource(resource, flags) ; m_pDataSource->setListener(this) ; } else if (scheme.compareTo("file", UtlString::ignoreCase) == 0) { m_pDataSource = new StreamFileDataSource(resource, flags) ; m_pDataSource->setListener(this) ; } else return ; }
UtlBoolean SipSubscribeServer::handleMessage(OsMsg &eventMessage) { int msgType = eventMessage.getMsgType(); int msgSubType = eventMessage.getMsgSubType(); // Timer fired if(msgType == OsMsg::OS_EVENT && msgSubType == OsEventMsg::NOTIFY) { OsTimer* timer = 0; UtlString* subscribeDialogHandle = NULL; ((OsEventMsg&)eventMessage).getUserData((intptr_t&)subscribeDialogHandle); ((OsEventMsg&)eventMessage).getEventData((intptr_t&)timer); if(subscribeDialogHandle) { // Check if the subscription really expired and send // the final NOTIFY if it did. handleExpiration(subscribeDialogHandle, timer); // Delete the handle; delete subscribeDialogHandle; // do not delete the timer. // handlExpiration deals with that and may reuse the timer } } // SIP message else if(msgType == OsMsg::PHONE_APP && msgSubType == SipMessage::NET_SIP_MESSAGE) { const SipMessage* sipMessage = ((SipMessageEvent&)eventMessage).getMessage(); UtlString method; if(sipMessage) { sipMessage->getCSeqField(NULL, &method); } // SUBSCRIBE requests if(sipMessage && !sipMessage->isResponse() && method.compareTo(SIP_SUBSCRIBE_METHOD) == 0) { handleSubscribe(*sipMessage); } // NOTIFY responses else if(sipMessage && sipMessage->isResponse() && method.compareTo(SIP_NOTIFY_METHOD) == 0) { handleNotifyResponse(*sipMessage); } } return(TRUE); }
void CpSessionTimerProperties::configureRefresher(const UtlString& refresher, UtlBoolean bIsOutboundTransaction) { if (bIsOutboundTransaction) { if (refresher.compareTo(REFRESHER_UAC) == 0) { m_sRefresher = CP_SESSION_REFRESH_LOCAL; } else if (refresher.compareTo(REFRESHER_UAS) == 0) { m_sRefresher = CP_SESSION_REFRESH_REMOTE; } else { // we may choose refresher m_sRefresher = (m_sInitialRefresher != CP_SESSION_REFRESH_AUTO ? m_sInitialRefresher : CP_SESSION_REFRESH_LOCAL); } } else { if (refresher.compareTo(REFRESHER_UAC) == 0) { m_sRefresher = CP_SESSION_REFRESH_REMOTE; } else if (refresher.compareTo(REFRESHER_UAS) == 0) { m_sRefresher = CP_SESSION_REFRESH_LOCAL; } else { // we may choose refresher m_sRefresher = (m_sInitialRefresher != CP_SESSION_REFRESH_AUTO ? m_sInitialRefresher : CP_SESSION_REFRESH_LOCAL); } } }
void convertToXml(UtlString& bufferString, int outputFileDescriptor) { UtlString date; UtlString eventCount; UtlString facility; UtlString priority; UtlString hostname; UtlString taskname; UtlString taskId; UtlString processId; UtlString content; OsSysLog::parseLogString(bufferString.data(), date, eventCount, facility, priority, hostname, taskname, taskId, processId, content); if(facility.compareTo("OUTGOING") == 0) { hostname.append("-"); hostname.append(processId); getMessageData(content, TRUE, date, hostname, eventCount, outputFileDescriptor); } else if(facility.compareTo("INCOMING") == 0) { hostname.append("-"); hostname.append(processId); getMessageData(content, FALSE, date, hostname, eventCount, outputFileDescriptor); } }
UtlBoolean SipPublishServer::handleMessage(OsMsg &eventMessage) { int msgType = eventMessage.getMsgType(); int msgSubType = eventMessage.getMsgSubType(); // SIP message if(msgType == OsMsg::PHONE_APP && msgSubType == SipMessage::NET_SIP_MESSAGE) { const SipMessage* sipMessage = ((SipMessageEvent&)eventMessage).getMessage(); UtlString method; if(sipMessage) { sipMessage->getCSeqField(NULL, &method); } // PUBLISH requests if(sipMessage && !sipMessage->isResponse() && method.compareTo(SIP_PUBLISH_METHOD) == 0) { handlePublish(*sipMessage); } } return(TRUE); }
UtlBoolean Url::getFieldParameter(const char* name, UtlString& value, int index) const { int foundIndex = 0; UtlBoolean found = FALSE; value = ""; if(mpFieldParameters || const_cast<Url*>(this)->parseFieldParameters()) { UtlDListIterator fieldParamIterator(*mpFieldParameters); NameValuePair* fieldParam = NULL; UtlString paramName; while ((fieldParam = (NameValuePair*) fieldParamIterator())) { paramName = *fieldParam; if(paramName.compareTo(name, UtlString::ignoreCase) == 0) { if(index == foundIndex) { found = TRUE; value = fieldParam->getValue(); break; } foundIndex++; } } } return(found); }
UtlBoolean Url::getHeaderParameter(const char* name, UtlString& value, int index) { int foundIndex = 0; UtlBoolean found = FALSE; value = ""; if(mpHeaderOrQueryParameters || parseHeaderOrQueryParameters()) { UtlDListIterator headerParamIterator(*mpHeaderOrQueryParameters); NameValuePair* headerParam = NULL; UtlString paramName; while ((headerParam = (NameValuePair*) headerParamIterator())) { paramName = *headerParam; if(paramName.compareTo(name, UtlString::ignoreCase) == 0) { if(index == foundIndex) { found = TRUE; value = headerParam->getValue(); break; } foundIndex++; } } } return(found); }
void WaitingFor200OkforInvite::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { int seqNum; UtlString seqMethod; if( response.getCSeqField( &seqNum, &seqMethod ) ) { if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 ) { // normally we would not be expecting this 200 OK response to carry // an SDP however we have encountered in the field some endpoints // that repeat the SDP answer they already sent in a previous // reliable provisional response (see XECS-2079 for the details). // Given that, if an SDP answer is found, we will reprocess it // to make sure it gets the same transformations that the initial // one got as per XECS-2089. if( response.hasSdpBody() ) { impl.ProcessMediaAnswer( response, INITIAL_OFFER_ANSWER ); } ChangeState( impl, impl.pWaitingForAckForInvite ); } else { OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected successful response for %s request", impl.name(), impl.GetCurrentState()->name(), seqMethod.data() ); } } }
void Negotiating::FailureResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { int seqNum; UtlString seqMethod; if( response.getCSeqField( &seqNum, &seqMethod ) ) { if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 ) { // session negotiation failed. Deallocate all the tentative // media relays tentatively allocated to handle the media // sessions that just failed. impl.deallocateAndClearAllMediaRelaySessions( true, true, false ); if( !impl.getDialogEstablishedFlag() ) { // this is a final failure response to a dialog-forming INVITE. That // event marks the end of the dialog hence, we do not need to continue // to track it. ChangeState( impl, impl.pMoribund ); } else { // the renegotiation failed but the dialog is still active. Go back to state where // we wait for an incoming INVITE. ChangeState( impl, impl.pWaitingForInvite ); } } else { OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected successful response for %s request", impl.name(), impl.GetCurrentState()->name(), seqMethod.data() ); } } }
void testChar2Utl() { UtlString encoded; char msg[2048]; for (unsigned int test = 0; test < (sizeof(tests)/sizeof(TestData)); test++) { encoded.remove(0); NetBase64Codec::encode(tests[test].inputSize, tests[test].inputData, encoded ); sprintf(msg, "\n test case %d encoding" "\n expected size %d data '%s'" "\n actual size %d data '%s'", test, strlen(tests[test].output), tests[test].output, encoded.length(), encoded.data() ); CPPUNIT_ASSERT_MESSAGE(msg, ( (encoded.length() == strlen(tests[test].output)) && (encoded.compareTo(tests[test].output) == 0) )); } }
void ProcessingPrack::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { int seqNum; UtlString seqMethod; if( response.getCSeqField( &seqNum, &seqMethod ) ) { if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 ) { // normally we would not be expecting this 200 OK response to carry // an SDP in this state however we have encountered in the field some endpoints // that repeat the SDP answer they already sent in a previous // Successful response (see XECS-2079 for the details). // Given that, if an SDP answer is found, we will reprocess it // to make sure it gets the same transformations that the initial // one got as per XECS-2089. if( response.hasSdpBody() ) { impl.ProcessMediaAnswer( response, INITIAL_OFFER_ANSWER ); } } else { OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected Successful Response for %s request", impl.name(), impl.GetCurrentState()->name(), seqMethod.data() ); } // We have received a response - although that does // not cause a state machine state change, we need to reset the tick counter // to show that there is still activity in this dialog. impl.resetTimerTickCounter(); } }
void testMatchUtlLookBehind() { RegEx matchAs("(?<=:)A+"); const char* subject = "xxx:AAyyyyy"; CPPUNIT_ASSERT(matchAs.Search(subject)); CPPUNIT_ASSERT( matchAs.Matches() == 1 ); int start; int length; CPPUNIT_ASSERT( matchAs.Match(0, start, length)); CPPUNIT_ASSERT( start == 4 ); CPPUNIT_ASSERT( length == 2 ); UtlString before; matchAs.BeforeMatchString(&before); CPPUNIT_ASSERT( before.compareTo("xxx:") == 0 ); CPPUNIT_ASSERT(matchAs.SearchAt(subject, 4)); CPPUNIT_ASSERT( matchAs.Matches() == 1 ); CPPUNIT_ASSERT( matchAs.Match(0, start, length)); CPPUNIT_ASSERT( start == 4 ); CPPUNIT_ASSERT( length == 2 ); }
void SipRedirectorGateway::displayForm(const HttpRequestContext& requestContext, const HttpMessage& request, HttpMessage*& response) { Os::Logger::instance().log(FAC_SIP, PRI_DEBUG, "%s::displayForm entered", mLogName.data()); UtlString method; request.getRequestMethod(&method); if (method.compareTo("POST") == 0) { processForm(requestContext, request, response); } else { response = new HttpMessage(); // Send 200 OK reply. response->setResponseFirstHeaderLine(HTTP_PROTOCOL_VERSION, HTTP_OK_CODE, HTTP_OK_TEXT); // Insert the HTML into the response. HttpBody* body = new HttpBody(form, -1, CONTENT_TYPE_TEXT_HTML); response->setBody(body); } }
// Caller must hold mLock. void SipPresenceMonitor::notifyStateChange(UtlString& contact, SipPresenceEvent* presenceEvent) { // Loop through the notifier list UtlHashMapIterator iterator(mStateChangeNotifiers); UtlString* listUri; StateChangeNotifier* notifier; Url contactUrl(contact); while ((listUri = dynamic_cast <UtlString *> (iterator()))) { notifier = dynamic_cast <StateChangeNotifier *> (mStateChangeNotifiers.findValue(listUri)); UtlString id; makeId(id, contact); Tuple* tuple = presenceEvent->getTuple(id); if (tuple) { UtlString status; tuple->getStatus(status); notifier->setStatus(contactUrl, status.compareTo(STATUS_CLOSED) == 0 ? StateChangeNotifier::AWAY : StateChangeNotifier::PRESENT); } else { notifier->setStatus(contactUrl, StateChangeNotifier::AWAY); } } }
void SipXProxyCseObserver::handleOutputMessage( SipMessage& message, const char* address, int port ) { UtlString method; UtlString viaValue; UtlString branchId; UtlString callId; int rspStatus = 0; if (message.isResponse()) { int seq; if (message.getCSeqField(&seq, &method)) { if (0==method.compareTo(SIP_INVITE_METHOD, UtlString::ignoreCase)) { rspStatus = message.getResponseStatusCode(); if (rspStatus >= SIP_2XX_CLASS_CODE) { SipMessageEvent* finalTransResponse = new SipMessageEvent(new SipMessage(message), SipMessageEvent::APPLICATION); this->postMessage(*finalTransResponse); delete finalTransResponse; } } } } }
// Process a MESSAGE request, which is used to trigger debugging actions. void AppearanceAgentTask::handleMessageRequest(const SipMessage& msg) { // Extract the user-part of the request-URI, which should tell us what // to do. UtlString user; msg.getUri(NULL, NULL, NULL, &user); // Construct the response. SipMessage response; if (user.compareTo(dumpStateUri) == 0) { // dumpStateUri is used to request to dump the Appearance Agent state into the log. debugDumpState(msg); response.setOkResponseData(&msg, NULL); } else { response.setInterfaceIpPort(msg.getInterfaceIp(), msg.getInterfacePort()); response.setResponseData(&msg, SIP_NOT_FOUND_CODE, SIP_NOT_FOUND_TEXT); } // Send the response. getAppearanceAgent()->getServerUserAgent().send(response); }
// Remove any dialogs in the terminated state. // This operates only on the parsed dialogs in mXmlDialogs, used to generate // the consolidated state. The RFC 4662 events are not affected, but // presumably the resource is not allowing terminated dialogs to accumulate // in the events it sends. void ResourceInstance::purgeTerminatedDialogs() { OsSysLog::add(FAC_RLS, PRI_DEBUG, "ResourceInstance::purgeTerminatedDialogs mInstanceName = '%s'", mInstanceName.data()); // Iterate through all the <dialog> elements. UtlHashMapIterator itor(mXmlDialogs); UtlContainable* id; while ((id = itor())) { // Get the <state> element content. UtlVoidPtr* p = dynamic_cast <UtlVoidPtr*> (itor.value()); TiXmlElement* dialog_element = static_cast <TiXmlElement*> (p->getValue()); TiXmlNode* state_node = dialog_element->FirstChild("state"); UtlString state; textContentShallow(state, state_node); if (state.compareTo("terminated") == 0) { // This dialog was terminated. Remove it. delete dialog_element; mXmlDialogs.destroy(id); } } // Note that we do not have to publish this change, as the deletion // of these dialogs does not have to be sent to the subscribers // quickly. }
bool EventValidator::findEvent(const char* szEvent, int nMaxLookAhead, int &nActualLookAhead) { bool bFound = false; m_mutLists.acquire(); int nEntries = m_unprocessedEvents.entries(); if (nEntries > 0) { // Figure out the max and actual look ahead capabilities nActualLookAhead = MIN(nEntries, nMaxLookAhead); // Try to find message for (int i=0; i<nActualLookAhead; i++) { UtlString* pString = (UtlString*) m_unprocessedEvents.at(i); assert(pString != NULL); if (pString->compareTo(szEvent) == 0) { m_unprocessedEvents.removeAt(i); m_processedEvents.append(pString); bFound = true; break; } } } else { nActualLookAhead = 0; } m_mutLists.release(); return bFound; }
int main(int argc, char* argv[] ) { UtlString argString; for(int argIndex = 1; argIndex < argc; argIndex++) { argString = argv[argIndex]; NameValueTokenizer::frontBackTrim(&argString, "\t "); if(argString.compareTo("-v") == 0) { printf("Version: %s %s\n", SIPX_VERSION, SIPX_BUILD); return(1); } else { osPrintf("usage: %s [-v] \nwhere:\n -v provides the software version\n", argv[0]); return(1); } } // Create sipXecsService framework ProxyService proxyService(PROXY_SERVICE_NAME, PROXY_CONFIG_PREFIX, SIPX_VERSION); proxyService.run(); return 0; }
void SipRedirectorMPT::displayForm(const HttpRequestContext& requestContext, const HttpMessage& request, HttpMessage*& response) { OsSysLog::add(FAC_SIP, PRI_DEBUG, "%s::displayForm entered", mLogName.data()); UtlString method; request.getRequestMethod(&method); if (method.compareTo("POST") == 0) { processForm(requestContext, request, response); } else { response = new HttpMessage(); // Send 200 OK reply. response->setResponseFirstHeaderLine(HTTP_PROTOCOL_VERSION, HTTP_OK_CODE, HTTP_OK_TEXT); // Construct the HTML. char buffer[FORM_SIZE]; sprintf(buffer, form, "", "Enter SIP URIs separated by newlines."); // Insert the HTML into the response. HttpBody* body = new HttpBody(buffer, -1, CONTENT_TYPE_TEXT_HTML); response->setBody(body); } }
OsStatus PresenceRoutingUserPreferences::parseDocument( TiXmlDocument* pDoc ) { TiXmlNode* presenceRoutingNode; if( (presenceRoutingNode = pDoc->FirstChild("presenceRoutingPrefs")) != NULL && presenceRoutingNode->Type() == TiXmlNode::ELEMENT) { // Find all the <user> elements. for( TiXmlNode* userNode = 0; (userNode = presenceRoutingNode->IterateChildren( "user", userNode )); ) { if (userNode->Type() == TiXmlNode::ELEMENT) { TiXmlNode* pChildNode; if( ( pChildNode = userNode->FirstChild( "userName" ) ) && pChildNode->FirstChild() ) { UtlString* pUsername = new UtlString( pChildNode->FirstChild()->Value() ); if( ( pChildNode = userNode->FirstChild( "vmOnDnd" ) ) && pChildNode->FirstChild() ) { UtlString vmOnDndAsString = pChildNode->FirstChild()->Value(); UtlBool* pbVmOnDnd = new UtlBool( FALSE ); if( vmOnDndAsString.compareTo("true", UtlString::ignoreCase) == 0 ) { pbVmOnDnd->setValue(TRUE); } mUserVmOnDndPreferences.insertKeyAndValue( pUsername, pbVmOnDnd ); OsSysLog::add( FAC_NAT, PRI_DEBUG, "PresenceRoutingUserPreferences::parseDocument added %s %d" ,pUsername->data(), pbVmOnDnd->getValue()); } } } } } }
bool SwAdminRpcMethod::buildOutputFiles(const UtlString& command, UtlString& stdoutfn, UtlString& stderrfn ) { bool result = true; stdoutfn.remove(0); stderrfn.remove(0); if ( command.compareTo(SwAdminVersion_cmd, UtlString::ignoreCase) == 0) { stdoutfn.append(SwAdminVersion_cmd); stderrfn.append(SwAdminVersion_cmd); } else if ( command.compareTo(SwAdminCheckUpdate_cmd, UtlString::ignoreCase) == 0) { stdoutfn.append(SwAdminCheckUpdate_cmd); stderrfn.append(SwAdminCheckUpdate_cmd); } else if ( command.compareTo(SwAdminUpdate_cmd, UtlString::ignoreCase) == 0) { stdoutfn.append(SwAdminUpdate_cmd); stderrfn.append(SwAdminUpdate_cmd); } else if ( command.compareTo(SwAdminRestart_cmd, UtlString::ignoreCase) == 0) { stdoutfn.append(SwAdminRestart_cmd); stderrfn.append(SwAdminRestart_cmd); } else if ( command.compareTo(SwAdminReboot_cmd, UtlString::ignoreCase) == 0) { stdoutfn.append(SwAdminReboot_cmd); stderrfn.append(SwAdminReboot_cmd); } else { return false; } stderrfn.append(SwAdminStdErr_filetype); stdoutfn.append(SwAdminStdOut_filetype); return result; }
void SubscribeWithEventListSupportAcceptedTest() { instantiateAllTestFixtures( "resource-lists1.xml", "subscription1", "credential1", "rlstest.test", TRUE); const char* message = "SUBSCRIBE sip:[email protected]:54140 SIP/2.0\r\n" "From: <sip:[email protected]>;tag=17211757-9E4FBD78\r\n" "To: <sip:[email protected]>\r\n" "CSeq: 1 SUBSCRIBE\r\n" "Call-ID: 51405734-b9be4835-dcd9d196\r\n" "Contact: <sip:[email protected]>\r\n" "Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER\r\n" "Event: dialog\r\n" "User-Agent: UnitTest\r\n" "Accept-Language: en\r\n" "Supported: eventlist\r\n" "Accept: application/dialog-info+xml,application/rlmi+xml,multipart/related\r\n" "Max-Forwards: 70\r\n" "Expires: 3600\r\n" "Content-Length: 0\r\n" "\r\n"; // send the SUBSCRIBE SipMessage request( message, strlen( message ) ); CPPUNIT_ASSERT( sendToRlsServerUnderTest( request ) ); // receive the 401 Unauthorized SipMessage response; CPPUNIT_ASSERT( getNextMessageFromRlsServerUnderTest( response, 5 ) ); CPPUNIT_ASSERT( response.isResponse() ); CPPUNIT_ASSERT( response.getResponseStatusCode() == HTTP_UNAUTHORIZED_CODE ); // craft a new SUBSCRIBE with proper credentials and send it CPPUNIT_ASSERT( addCredentialsToRequest( request, response ) ); CPPUNIT_ASSERT( sendToRlsServerUnderTest( request ) ); // receive the 202 Accepted response CPPUNIT_ASSERT( getNextMessageFromRlsServerUnderTest( response, 5 ) ); CPPUNIT_ASSERT( response.isResponse() ); CPPUNIT_ASSERT( response.getResponseStatusCode() == SIP_ACCEPTED_CODE ); // requisite first NOTIFY request SipMessage notify_request; CPPUNIT_ASSERT( getNextMessageFromRlsServerUnderTest( notify_request, 15 ) ); CPPUNIT_ASSERT( ! notify_request.isResponse() ); UtlString tmp; notify_request.getRequestMethod(&tmp); CPPUNIT_ASSERT( 0 == tmp.compareTo( SIP_NOTIFY_METHOD ) ); CPPUNIT_ASSERT( notify_request.isInRequireField(SIP_EVENTLIST_EXTENSION) ); // no further NOTIFY request /* XECS-2005 CPPUNIT_ASSERT( ! getNextMessageFromRlsServerUnderTest( notify_request, 5 ) ); //*/ }
UtlBoolean SipDialog::isTransactionLocallyInitiated(const UtlString& callId, const UtlString& fromTag, const UtlString& toTag) const { UtlBoolean isLocalDialog = FALSE; if(callId.compareTo(*this, UtlString::ignoreCase) == 0) { if(fromTag.compareTo(mLocalTag, UtlString::ignoreCase) == 0 && (toTag.compareTo(mRemoteTag, UtlString::ignoreCase) == 0 || toTag.isNull() || mRemoteTag.isNull())) { isLocalDialog = TRUE; } } return(isLocalDialog); }
/* ============================ MANIPULATORS ============================== */ UtlBoolean StatusServer::handleMessage( OsMsg& eventMessage ) { syslog(FAC_SIP, PRI_DEBUG, "StatusServer::handleMessage() :: Start processing SIP message") ; int msgType = eventMessage.getMsgType(); int msgSubType = eventMessage.getMsgSubType(); if ( msgType == OsMsg::PHONE_APP && msgSubType == SipMessage::NET_SIP_MESSAGE ) { const SipMessage* message = ((SipMessageEvent&)eventMessage).getMessage(); UtlString callId; if ( message ) { message->getCallIdField(&callId); UtlString method; message->getRequestMethod(&method); if ( !message->isResponse() ) { if ( method.compareTo(SIP_SUBSCRIBE_METHOD) == 0 ) { //send to SubscribeThread sendToSubscribeServerThread(eventMessage); } else { //send to redirect thread //sendToRedirectServer(eventMessage); } } else // response processing { // get the method as we are only interested in 481 NOTIFY responses int cSequenceNum; if ( message->getCSeqField(&cSequenceNum, &method) && method.compareTo(SIP_NOTIFY_METHOD) == 0 ) { //send to SubscribeThread sendToSubscribeServerThread(eventMessage); } } } return(TRUE); } return(FALSE); }
bool SwAdminRpcExecStatus::isQueryValid(const UtlString& query, UtlString& processName) { if (query.compareTo(SwAdminSnapshot_cmd, UtlString::ignoreCase) ==0) { processName = SwAdminSnapshot; return true; } else if (query.compareTo(SwAdminCheckUpdate_cmd, UtlString::ignoreCase) == 0 || query.compareTo(SwAdminUpdate_cmd, UtlString::ignoreCase) == 0 || query.compareTo(SwAdminVersion_cmd, UtlString::ignoreCase) == 0) { processName = SwAdminExec; return true; } return false; }
TaoStatus TaoListenerManager::removeEventListener(TaoMessage& rMsg) { UtlString terminalName; TaoString str(rMsg.getArgList(), TAOMESSAGE_DELIMITER); terminalName = str[0]; if (terminalName.isNull() || 0 == terminalName.compareTo("0.0.0.0")) terminalName = "127.0.0.1"; // OsWriteLock lock(mListenerRWLock); if (mListenerCnt > 0) // check if listener exists. { for (int i = 0; i < mListenerCnt; i++) { if (mpListeners[i] && mpListeners[i]->mName.compareTo(terminalName) == 0) { mpListeners[i]->mRef--; if (mpListeners[i]->mRef <= 0) { osPrintf("*** TaoListenerManager::removeEventListener %s 0x%08x %d\n", terminalName.data(), (int)mpListeners[i], mpListeners[i]->mRef); if (mpListeners[i]->mpListenerPtr) { TaoEventListener* pListener = (TaoEventListener*) mpListeners[i]->mpListenerPtr; delete pListener; } delete mpListeners[i]; mpListeners[i] = 0; mListenerCnt--; // find and delete the TaoTransportAgent TaoObjHandle object; if (TAO_SUCCESS == mpAgents->findValue(terminalName.data(), object)) { if (object) { osPrintf("TaoListenerManager removeEventListener TaoTransportAgent = %d\n", (int)object); TaoTransportAgent *pAgent = (TaoTransportAgent *)object; delete pAgent; } } else osPrintf("TaoListenerManager removeEventListener Failure! did not find socket %s\n", terminalName.data()); if (TAO_SUCCESS == mpAgents->remove(terminalName.data())) { osPrintf(" **** TaoListenerManager removeEventListener socket removed %s ****\n", terminalName.data()); } else osPrintf("TaoListenerManager removeEventListener Failure! did not remove socket %s\n", terminalName.data()); } } } } return TAO_SUCCESS; }
TaoStatus TaoListenerManager::addCallListener(TaoMessage& rMsg) { TaoStatus ret = TAO_SUCCESS; UtlString terminalName; TaoString str(rMsg.getArgList(), TAOMESSAGE_DELIMITER); terminalName = str[0]; if (terminalName.isNull() || 0 == terminalName.compareTo("0.0.0.0")) { if (mListenerCnt <= 0) { terminalName = "127.0.0.1"; osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host, replaced with %s\n", terminalName.data()); } else { osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host %s, listener not added.\n", terminalName.data()); return TAO_FAILURE; } } mpCallMgr->addTaoListener(this); ret = addEventListener(terminalName.data(), TRUE); return ret; }