本文整理汇总了C++中Appearance::appearanceIdIsSeized方法的典型用法代码示例。如果您正苦于以下问题:C++ Appearance::appearanceIdIsSeized方法的具体用法?C++ Appearance::appearanceIdIsSeized怎么用?C++ Appearance::appearanceIdIsSeized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Appearance
的用法示例。
在下文中一共展示了Appearance::appearanceIdIsSeized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AppearanceTest
//.........这里部分代码省略.........
}
}
}
}
CPPUNIT_ASSERT( !dialogHandle.isNull() );
OsSysLog::add(FAC_RLS, PRI_DEBUG, "we now have an Appearance - test it");
AppearanceGroup* pAppGroup = pAppearanceAgentUnderTest->getAppearanceGroupSet().
findAppearanceGroup(sharedUri);
CPPUNIT_ASSERT( pAppGroup );
Appearance* pApp = pAppGroup->findAppearance(dialogHandle);
CPPUNIT_ASSERT( pApp );
ASSERT_STR_EQUAL( app1uri.data(), pApp->getUri()->data() );
// test adding a new dialog
const char* dialogEventString =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"partial\" entity=\"sip:[email protected]:54140\">\n"
"<dialog id=\"1\" call-id=\"[email protected]\" local-tag=\"264460498\" remote-tag=\"1c10982\" direction=\"recipient\">\n"
"<state>confirmed</state>\n"
"<local>\n"
"<identity>[email protected]:5120</identity>\n"
"<target uri=\"sip:[email protected]:5120\">\n"
"<param pname=\"x-line-id\" pval=\"0\"/>\n"
"<param pname=\"+sip.rendering\" pval=\"yes\"/>\n"
"</target>\n"
"</local>\n"
"<remote>\n"
"<identity>[email protected]</identity>\n"
"</remote>\n"
"</dialog>\n"
"</dialog-info>\n"
;
SipDialogEvent dialogEvent(dialogEventString);
bool bFullContentChanged = false;
bool bPartialContentChanged = pApp->updateState(&dialogEvent, bFullContentChanged);
CPPUNIT_ASSERT(bPartialContentChanged);
CPPUNIT_ASSERT(bFullContentChanged);
pApp->dumpState();
CPPUNIT_ASSERT(pApp->appearanceIsBusy());
CPPUNIT_ASSERT(pApp->appearanceIdIsSeized("0"));
CPPUNIT_ASSERT(!pApp->appearanceIdIsSeized("1"));
// simulate user putting the call on hold
const char* dialogEventString2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"partial\" entity=\"sip:[email protected]:54140\">\n"
"<dialog id=\"1\" call-id=\"[email protected]\" local-tag=\"264460498\" remote-tag=\"1c10982\" direction=\"recipient\">\n"
"<state>confirmed</state>\n"
"<local>\n"
"<identity>[email protected]:5120</identity>\n"
"<target uri=\"sip:[email protected]:5120\">\n"
"<param pname=\"x-line-id\" pval=\"0\"/>\n"
"<param pname=\"+sip.rendering\" pval=\"no\"/>\n"
"</target>\n"
"</local>\n"
"<remote>\n"
"<identity>[email protected]</identity>\n"
"</remote>\n"
"</dialog>\n"
"</dialog-info>\n"
;
SipDialogEvent dialogEvent2(dialogEventString2);
bPartialContentChanged = pApp->updateState(&dialogEvent2, bFullContentChanged);
CPPUNIT_ASSERT(bPartialContentChanged);
CPPUNIT_ASSERT(bFullContentChanged);
pApp->dumpState();
CPPUNIT_ASSERT(!pApp->appearanceIsBusy());
CPPUNIT_ASSERT(pApp->appearanceIdIsSeized("0"));
CPPUNIT_ASSERT(!pApp->appearanceIdIsSeized("1"));
// test MESSAGE debug handling
const char* message =
"MESSAGE sip:[email protected]:54140 SIP/2.0\r\n"
"From: <sip:[email protected]>;tag=17211757-9E4FBD78\r\n"
"To: <sip:~~sa~D~[email protected]:54140>\r\n"
"CSeq: 1 MESSAGE\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"
"Accept: application/dialog-info+xml\r\n"
"Max-Forwards: 70\r\n"
"Expires: 3600\r\n"
"Content-Length: 0\r\n"
"\r\n";
// send the MESSAGE
SipMessage messageRequest( message, strlen( message ) );
CPPUNIT_ASSERT( sendToAppearanceAgentUnderTest( messageRequest ) );
// receive the 200 OK response
SipMessage response;
CPPUNIT_ASSERT( getNextMessageFromAppearanceAgentUnderTest( response, 5 ) );
CPPUNIT_ASSERT( response.isResponse() );
CPPUNIT_ASSERT( response.getResponseStatusCode() == SIP_OK_CODE );
}
示例2: handleNotifyRequest
//.........这里部分代码省略.........
// Ignore calls with no appearanceId - these are considered "exclusive".
// (e.g. MoH calls are private to the set involved)
// These dialogs are not forwarded on to other sets in either partial or full updates.
if ( appearanceId == "" )
{
Os::Logger::instance().log(FAC_SAA, PRI_DEBUG, "AppearanceGroup::handleNotifyRequest skipping call with no appearance info");
delete lContent->removeDialog(pDialog);
continue;
}
if ( dialogId.contains("@@") )
{
// this is one of our identifiers already
uniqueDialogId = dialogId;
}
else
{
// make a guaranteed unique dialog id, by
// prepending to each id value the call-id of the subscription
// from which the dialog event was obtained, with "@@" as a separator
msg->getCallIdField(&uniqueDialogId);
uniqueDialogId.append("@@");
uniqueDialogId.append(dialogId);
pDialog->setDialogId(uniqueDialogId);
}
Os::Logger::instance().log(FAC_SAA, PRI_INFO,
"AppearanceGroup::handleNotifyRequest: "
"%s update from %s: dialogId %s, x-line-id %s, state %s(%s)",
state.data(), contactUri.data(), uniqueDialogId.data(),
appearanceId.data(), dialogState.data(), rendering.data());
}
delete itor;
// Check to see if this appearance (of the Appearance) is available
bool okToProceed = true;
if ( state == "partial" && dialogState == "trying" )
{
UtlHashMapIterator appitor(mAppearances);
UtlString* handle;
while ( okToProceed && (handle = dynamic_cast <UtlString*> (appitor())))
{
Appearance* inst = dynamic_cast <Appearance*> (appitor.value());
okToProceed = !inst->appearanceIdIsSeized(appearanceId);
}
}
bool bSendPartialContent = false;
bool bSendFullContent = false;
// Send the response.
if (okToProceed)
{
response.setOkResponseData(msg, NULL);
}
else
{
Os::Logger::instance().log(FAC_SAA, PRI_DEBUG,
"AppearanceGroup::handleNotifyRequest '%s' appearanceId %s is busy",
entity.data(), appearanceId.data());
response.setInterfaceIpPort(msg->getInterfaceIp(), msg->getInterfacePort());
response.setResponseData(msg, 409, "Conflict");
}
getAppearanceAgent()->getServerUserAgent().send(response);
if (okToProceed)
{
if (lContent)
{
// Send the content to the proper Appearance instance, so it can
// save these dialogs, and set flag to indicate whether they should be sent in partial update
bSendPartialContent = pThisAppearance->updateState(lContent, bSendFullContent);
}
// Publish full and partial updates to the SipPublishContentMgr
publish(bSendFullContent, bSendPartialContent, lContent);
}
// Adjust the expiration of the subscription if the set has the line "seized"
// and return it to the longer default if it does not.
UtlHashMapIterator appitor(mAppearances);
UtlString* handle;
while ( (handle = dynamic_cast <UtlString*> (appitor())))
{
Appearance* inst = dynamic_cast <Appearance*> (appitor.value());
// if set has line seized, use short subscription timer
if ( inst->appearanceIsBusy() )
{
inst->setResubscribeInterval(true);
}
else
{
inst->setResubscribeInterval(false);
}
}
if (lContent)
{
delete lContent;
}
}