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; }
// 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; }
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; }
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; }