Esempio n. 1
0
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;
}
AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req, const string& app_name,
				       AmArg& session_params)
{
  UACAuthCred* cred = AmUACAuth::unpackCredentials(session_params);

  AmSession* s = new DtmfTesterDialog(getAnnounceFile(req), cred); 
  
  if (NULL == cred) {
    WARN("discarding unknown session parameters.\n");
  } else {
    AmUACAuth::enable(s);
  }

  return s;
}
Esempio n. 3
0
AmSession* AnnouncementFactory::onInvite(const AmSipRequest& req)
{
  return new AnnouncementDialog(getAnnounceFile(req), NULL);
}
Esempio n. 4
0
AmSession* Click2DialFactory::onInvite(const AmSipRequest& req)
{
  return new C2DCallerDialog(req, getAnnounceFile(req), NULL, NULL);
}
Esempio n. 5
0
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;
}
AmSession* DtmfTesterFactory::onInvite(const AmSipRequest& req, const string& app_name,
				       const map<string,string>& app_params)
{
  return new DtmfTesterDialog(getAnnounceFile(req), NULL);
}