本文整理汇总了C++中AmSession::addHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ AmSession::addHandler方法的具体用法?C++ AmSession::addHandler怎么用?C++ AmSession::addHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmSession
的用法示例。
在下文中一共展示了AmSession::addHandler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onInvite
AmSession* AnnouncementFactory::onInvite(const AmSipRequest& req,
AmArg& session_params)
{
UACAuthCred* cred = NULL;
if (session_params.getType() == AmArg::AObject) {
ArgObject* cred_obj = session_params.asObject();
if (cred_obj)
cred = dynamic_cast<UACAuthCred*>(cred_obj);
}
AmSession* s = new AnnouncementDialog(getAnnounceFile(req), cred);
if (NULL == cred) {
WARN("discarding unknown session parameters.\n");
} else {
AmSessionEventHandlerFactory* uac_auth_f =
AmPlugIn::instance()->getFactory4Seh("uac_auth");
if (uac_auth_f != NULL) {
DBG("UAC Auth enabled for new announcement session.\n");
AmSessionEventHandler* h = uac_auth_f->getHandler(s);
if (h != NULL )
s->addHandler(h);
} else {
ERROR("uac_auth interface not accessible. "
"Load uac_auth for authenticated dialout.\n");
}
}
return s;
}
示例2: onInvite
// outgoing calls
AmSession* WebConferenceFactory::onInvite(const AmSipRequest& req,
AmArg& session_params)
{
UACAuthCred* cred = NULL;
if (session_params.getType() == AmArg::AObject) {
ArgObject* cred_obj = session_params.asObject();
if (cred_obj)
cred = dynamic_cast<UACAuthCred*>(cred_obj);
}
AmSession* s = new WebConferenceDialog(prompts, getInstance(), cred);
AmSessionEventHandlerFactory* uac_auth_f =
AmPlugIn::instance()->getFactory4Seh("uac_auth");
if (uac_auth_f != NULL) {
DBG("UAC Auth enabled for new announcement session.\n");
AmSessionEventHandler* h = uac_auth_f->getHandler(s);
if (h != NULL )
s->addHandler(h);
} else {
ERROR("uac_auth interface not accessible. Load uac_auth for authenticated dialout.\n");
}
s->setUri(getAccessUri(req.user));
return s;
}
示例3: onInvite
AmSession* EchoFactory::onInvite(const AmSipRequest& req)
{
AmSession* s = new EchoDialog();
if (NULL != session_timer_f) {
AmSessionEventHandler* h = session_timer_f->getHandler(s);
if(h->configure(conf)){
ERROR("Could not configure the session timer: disabling session timers.\n");
delete h;
} else {
s->addHandler(h);
}
}
return s;
}
示例4: ERROR
AmSession* Click2DialFactory::onInvite(const AmSipRequest& req, AmArg& session_params)
{
UACAuthCred* cred = NULL;
string callee_uri, a_realm, a_user, a_pwd;
if(session_params.size() != 4) {
ERROR("Need 4 parameters, got %lu\n",
(long unsigned int)session_params.size());
return NULL;
}
if(session_params.get(0).getType() == AmArg::CStr) {
a_realm = string(session_params.get(0).asCStr());
}
else {
ERROR("All arguments have to be CStr\n");
return NULL;
}
if(session_params.get(1).getType() == AmArg::CStr) {
a_user = string(session_params.get(1).asCStr());
}
else {
ERROR("All arguments have to be CStr\n");
return NULL;
}
if (session_params.get(2).getType() == AmArg::CStr) {
a_pwd = string(session_params.get(2).asCStr());
}
else {
ERROR("All arguments have to be CStr\n");
return NULL;
}
cred = new UACAuthCred(a_realm, a_user, a_pwd);
if(cred == NULL) {
ERROR("Failed to create authentication handle\n");
return NULL;
}
if (session_params.get(3).getType() == AmArg::CStr) {
callee_uri = string(session_params.get(3).asCStr());
}
else {
ERROR("All arguments have to be CStr\n");
return NULL;
}
AmSession* s = new C2DCallerDialog(req, getAnnounceFile(req), callee_uri, cred);
if(s == NULL) {
ERROR("Failed to create a click2dial dialog");
return NULL;
}
AmSessionEventHandlerFactory* uac_auth_f =
AmPlugIn::instance()->getFactory4Seh("uac_auth");
if(uac_auth_f != NULL) {
DBG("UAC Auth enabled for new announcement session.\n");
AmSessionEventHandler *h = uac_auth_f->getHandler(s);
if (h != NULL) {
s->addHandler(h);
}
else {
ERROR("Failed to get authentication event handler");
delete s;
return NULL;
}
}
else {
ERROR("uac_auth interface not accessible. "
"Load uac_auth for authenticated dialout.\n");
return NULL;
}
return s;
}