Esempio n. 1
0
int MyCCFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;
  
  InitialAnnouncement = cfg.getParameter("initial_announcement", "/tmp/hello.wav");
  IncorrectPIN        = cfg.getParameter("incorrect_pin", "/tmp/incorrect_pin.wav");
  OutOfCredit         = cfg.getParameter("out_of_credit", "/tmp/out_of_credit.wav");
  Dialing             = cfg.getParameter("dialing", "/tmp/dialing.wav");
  DialFailed          = cfg.getParameter("dial_failed", "/tmp/dial_failed.wav");
  EnterNumber         = cfg.getParameter("enter_number", "/tmp/enter_number.wav"); 
  ConnectSuffix       = cfg.getParameter("connect_suffix", "@127.0.0.1"); 

  user_timer_fact = AmPlugIn::instance()->getFactory4Di("user_timer");
  if(!user_timer_fact){
    ERROR("could not load user_timer from session_timer plug-in\n");
    return -1;
  }
  cc_acc_fact = AmPlugIn::instance()->getFactory4Di("cc_acc");
  if(!cc_acc_fact){
    ERROR("could not load cc_acc accounting, please provide a module\n");
    return -1;
  }

  return 0;
}
Esempio n. 2
0
int AnnRecorderFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  AnnouncePath = cfg.getParameter("announce_path",ANNOUNCE_PATH);
  if( !AnnouncePath.empty() 
      && AnnouncePath[AnnouncePath.length()-1] != '/' )
    AnnouncePath += "/";
  DefaultAnnounce = cfg.getParameter("default_announce");

  SimpleMode = (cfg.getParameter("simple_mode") == "yes");

  AM_PROMPT_START;
  AM_PROMPT_ADD(WELCOME, ANNREC_ANNOUNCE_PATH WELCOME".wav");
  AM_PROMPT_ADD(YOUR_PROMPT, ANNREC_ANNOUNCE_PATH YOUR_PROMPT".wav");
  AM_PROMPT_ADD(TO_RECORD, ANNREC_ANNOUNCE_PATH TO_RECORD".wav");
  AM_PROMPT_ADD(CONFIRM, ANNREC_ANNOUNCE_PATH CONFIRM".wav");
  AM_PROMPT_ADD(GREETING_SET, ANNREC_ANNOUNCE_PATH GREETING_SET".wav");
  AM_PROMPT_ADD(BYE, ANNREC_ANNOUNCE_PATH BYE".wav");
  AM_PROMPT_ADD(BEEP, ANNREC_ANNOUNCE_PATH BEEP".wav");
  AM_PROMPT_END(prompts, cfg, MOD_NAME);

  message_storage_fact = AmPlugIn::instance()->getFactory4Di("msg_storage");
  if(!message_storage_fact) {
    ERROR("sorry, could not get msg_storage, please load a suitable plug-in\n");
    return -1;
  }

  return 0;
}
Esempio n. 3
0
int MsgStorage::onLoad() {

  msg_dir = MSG_DIR;
  
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
    DBG("no configuration could be loaded, assuming defaults.\n");
  } else {
      msg_dir = cfg.getParameter("storage_dir",MSG_DIR);
      DBG("storage_dir set to '%s'.\n", msg_dir.c_str());
  }

  string path = msg_dir;
  int status = mkdir(path.c_str(), 
		     S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  if (status && (errno != EEXIST)) {
    ERROR("creating storage path '%s': %s\n", 
	  path.c_str(),strerror(errno));
    return -1;
  }

  path = msg_dir + "/_test_dir_";
  status = mkdir(path.c_str(), 
		     S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  if (status && (errno != EEXIST)) {
    ERROR("Write permission check failed. Could not create '%s': %s\n", 
	  path.c_str(),strerror(errno));
    return -1;
  }
  rmdir(path.c_str());

  DBG("MsgStorage loaded.\n");
  return 0;
}
Esempio n. 4
0
int AnnouncementFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  AnnouncePath = cfg.getParameter("announce_path",ANNOUNCE_PATH);
  if( !AnnouncePath.empty() 
      && AnnouncePath[AnnouncePath.length()-1] != '/' )
    AnnouncePath += "/";

  AnnounceFile = cfg.getParameter("default_announce",ANNOUNCE_FILE);

  string announce_file = AnnouncePath + AnnounceFile;
  if(!file_exists(announce_file)){
    ERROR("default file for announcement module does not exist ('%s').\n",
	  announce_file.c_str());
    return -1;
  }

  return 0;
}
int AnswerMachineFactory::onLoad()
{
    AmConfigReader cfg;
    if(cfg.loadFile(add2path(AmConfig::ModConfigPath,1, MOD_NAME ".conf")))
	return -1;

    // get application specific global parameters
    configureModule(cfg);

    AnnouncePath    = cfg.getParameter("announce_path",ANNOUNCE_PATH);
    DefaultAnnounce = cfg.getParameter("default_announce",DEFAULT_ANNOUNCE);
    MaxRecordTime   = cfg.getParameterInt("max_record_time",DEFAULT_RECORD_TIME);
    RecFileExt      = cfg.getParameter("rec_file_ext",DEFAULT_AUDIO_EXT);

    if(loadEmailTemplates(cfg.getParameter("email_template_path",DEFAULT_MAIL_TMPL_PATH))){
	ERROR("while loading email templates\n");
	return -1;
    }

    AcceptDelay = DEFAULT_ACCEPT_DELAY;

    UserTimer = AmPlugIn::instance()->getFactory4Di("user_timer");
    if(!UserTimer){
	
	ERROR("could not load user_timer from session_timer plug-in\n");
	return -1;
    }

    return 0;
}
Esempio n. 6
0
int MWI::onLoad()
{
  AmDynInvokeFactory* ms_fact = 
    AmPlugIn::instance()->getFactory4Di("msg_storage");

  if(!ms_fact || !(MessageStorage = ms_fact->getInstance())) {
    ERROR("could not load msg_storage. Load a msg_storage implementation module.\n");
    return -1;
  };

  // register the publish method as event sink for msg_storage events
  AmArg es_args,ret;
  es_args.push(this);
  es_args.push("publish");
  MessageStorage->invoke("events_subscribe",es_args,ret);
  
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + "mwi.conf")) {
    ERROR("can not load configuration file\n");
    return -1;
  };
  
  presence_server = cfg.getParameter("presence_server");
  if (presence_server.length())
    DBG("set presence server '%s'\n", presence_server.c_str());
  else {
    ERROR("parameter 'presence_server' did not found in the configuration file\n");
    return -1;
  }                
  
  DBG("MWI module loaded.\n");
  return 0;
};
Esempio n. 7
0
int AmZRTP::init() {
  AmConfigReader cfg;
  string cfgname=add2path(AmConfig::ModConfigPath, 1,  "zrtp.conf");
  if(cfg.loadFile(cfgname)) {
    ERROR("No %s config file present.\n", 
	  cfgname.c_str());
    return -1;
  }
  cache_path = cfg.getParameter("cache_path");
  string zid = cfg.getParameter("zid");
  if (zid.length() != sizeof(zrtp_zid_t)) {
    ERROR("ZID of this instance MUST be set for ZRTP.\n");
    ERROR("ZID needs to be %u characters long.\n", 
	  sizeof(zrtp_zid_t));
    return -1;
  }
  for (int i=0;i<12;i++)
    zrtp_instance_zid[i]=zid[i];

  DBG("initializing ZRTP library with ZID '%s', cache path '%s'.\n",
      zid.c_str(), cache_path.c_str());
  if ( zrtp_status_ok != zrtp_init(&zrtp_global, "zrtp_sems") ) {
    ERROR("Some error during zrtp initialization\n");
    return -1;
  }
  zrtp_add_entropy(&zrtp_global, NULL, 0);
  DBG("ZRTP initialized ok.\n");

  return 0;
}
int BrpcCtrlInterfaceFactory::onLoad()
{
  AmConfigReader cfg;
  unsigned int ct_to, rx_to, tx_to;

  if (cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
    WARN("failed to read/parse config file `%s' - assuming defaults\n",
      (AmConfig::ModConfigPath + string(MOD_NAME ".conf")).c_str());
    semsUri = string(LISTEN_ADDR_DEFAULT);
    serUri = string(SER_ADDR_DEFAULT);
  } else {
    semsUri = cfg.getParameter(LISTEN_ADDR_PARAM, LISTEN_ADDR_DEFAULT);
    serUri = cfg.getParameter(SER_ADDR_PARAM, SER_ADDR_DEFAULT);

    if (str2i(cfg.getParameter(CT_TIMEOUT_PARAM, int2str(CT_TIMEOUT)), 
        ct_to)) {
      ERROR("failed to read `%s' param from config file.\n", CT_TIMEOUT_PARAM);
      return -1;
    } else {
      ct_timeout = ct_to * 1000;
    }
    if (str2i(cfg.getParameter(RX_TIMEOUT_PARAM, int2str(RX_TIMEOUT)), 
        rx_to)) {
      ERROR("failed to read `%s' param from config file.\n", RX_TIMEOUT_PARAM);
      return -1;
    } else {
      rx_timeout = rx_to * 1000;
    }
    if (str2i(cfg.getParameter(TX_TIMEOUT_PARAM, int2str(TX_TIMEOUT)), 
        tx_to)) {
      ERROR("failed to read `%s' param from config file.\n", TX_TIMEOUT_PARAM);
      return -1;
    } else {
      tx_timeout = tx_to * 1000;
    }


    if (str2i(cfg.getParameter(RX_WORKERS_PARAM, int2str(RX_WORKERS)), 
        rx_workers)) {
      ERROR("failed to read `%s' param from config file.\n", RX_WORKERS_PARAM);
      return -1;
    }
    if (str2i(cfg.getParameter(TX_WORKERS_PARAM, int2str(TX_WORKERS)), 
        tx_workers)) {
      ERROR("failed to read `%s' param from config file.\n", TX_WORKERS_PARAM);
      return -1;
    }
  }
  INFO(LISTEN_ADDR_PARAM ": %s.\n", semsUri.c_str());
  INFO(SER_ADDR_PARAM ": %s.\n", serUri.c_str());
  INFO(CT_TIMEOUT_PARAM ": %uus.\n", (unsigned)ct_timeout);
  INFO(RX_TIMEOUT_PARAM ": %uus.\n", (unsigned)rx_timeout);
  INFO(TX_TIMEOUT_PARAM ": %uus.\n", (unsigned)tx_timeout);
  INFO(RX_WORKERS_PARAM ": %u.\n", rx_workers);
  INFO(TX_WORKERS_PARAM ": %u.\n", tx_workers);

  return 0;
}
int RegistrationAgentFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  // stay backwards compatible
  RegInfo ri; 
  ri.domain = cfg.getParameter("domain","");
  ri.user = cfg.getParameter("user","");
  ri.display_name = cfg.getParameter("display_name","");
  ri.auth_user = cfg.getParameter("auth_user","");
  ri.passwd = cfg.getParameter("pwd","");

  if (!ri.domain.length() || 
      !ri.user.length() || 
      !ri.display_name.length() || 
      !ri.auth_user.length() || 
      !ri.passwd.length()) {
    ERROR("Account for registration not correctly configured.\n");
    ERROR("RegistrationAgent will not register any accounts.\n");
    return 0;
  }

  DBG("Adding registration #%d (%s %s %s %s)\n", 0, 
      ri.domain.c_str(), ri.user.c_str(), ri.display_name.c_str(), ri.auth_user.c_str());

  dialer.add_reg(ri);

  unsigned int ri_index = 1;
  while (ri_index < 100) {
    RegInfo ri; 
    ri.domain = cfg.getParameter("domain"+int2str(ri_index),"");
    ri.user = cfg.getParameter("user"+int2str(ri_index),"");
    ri.display_name = cfg.getParameter("display_name"+int2str(ri_index),"");
    ri.auth_user = cfg.getParameter("auth_user"+int2str(ri_index),"");
    ri.passwd = cfg.getParameter("pwd"+int2str(ri_index),"");
      
    if (!ri.domain.length() || 
	!ri.user.length() || 
	!ri.display_name.length() || 
	!ri.auth_user.length() || 
	!ri.passwd.length())
      break;
	
    DBG("Adding registration #%d (%s %s %s %s)\n", ri_index, 
	ri.domain.c_str(), ri.user.c_str(), ri.display_name.c_str(), ri.auth_user.c_str());
    dialer.add_reg(ri);
    ri_index++;
  }

  dialer.start();

  return 0;
}
int SipCtrlInterfaceFactory::onLoad()
{
    
    bind_addr = AmConfig::LocalSIPIP;
    bind_port = AmConfig::LocalSIPPort;
  
    INFO("SIP bind_addr: `%s'.\n", bind_addr.c_str());
    INFO("SIP bind_port: `%i'.\n", bind_port);

    if (!AmConfig::OutboundProxy.empty()) {
	sip_uri parsed_uri;
	if (parse_uri(&parsed_uri, (char *)AmConfig::OutboundProxy.c_str(),
		      AmConfig::OutboundProxy.length()) < 0) {
	    ERROR("invalid outbound_proxy specified\n");
	    return -1;
	}
	SipCtrlInterfaceFactory::outbound_host = c2stlstr(parsed_uri.host);
	if (parsed_uri.port) {
	    SipCtrlInterfaceFactory::outbound_port = parsed_uri.port;
	}
    }

    AmConfigReader cfg;
    string cfgfile = AmConfig::ModConfigPath + string(MOD_NAME ".conf");
    if (file_exists(cfgfile) && !cfg.loadFile(cfgfile)) {
	if (cfg.hasParameter("accept_fr_without_totag")) {
	    accept_fr_without_totag = 
		cfg.getParameter("accept_fr_without_totag") == "yes";
	}
	DBG("sipctrl: accept_fr_without_totag = %s\n", 
	    accept_fr_without_totag?"yes":"no");

	if (cfg.hasParameter("log_raw_messages")) {
	    string msglog = cfg.getParameter("log_raw_messages");
	    if (msglog == "no") log_raw_messages = -1;
	    else if (msglog == "error") log_raw_messages = 0;
	    else if (msglog == "warn")  log_raw_messages = 1;
	    else if (msglog == "info")  log_raw_messages = 2;
	    else if (msglog == "debug") log_raw_messages = 3;
	}
	DBG("sipctrl: log_raw_messages level = %d\n", 
	    log_raw_messages);

	if (cfg.hasParameter("log_parsed_messages")) {
	    log_parsed_messages = cfg.getParameter("log_parsed_messages")=="yes";
	}
	DBG("sipctrl: log_parsed_messages = %s\n", 
	    log_parsed_messages?"yes":"no");

    } else {
	DBG("assuming SIP default settings.\n");
    }

    return 0;
    
}
Esempio n. 11
0
int DIDialFactory::onLoad(){
  
  AmConfigReader cfg;
  if(!cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf")) {

    unsigned int i_pin = 0;
    while (i_pin<100) { // only for safety..
      string dialout_pin = cfg.getParameter("dialout_pin"+int2str(i_pin));
      if (!dialout_pin.length()) 
	break;
      size_t pos = dialout_pin.find_first_of(';');
      if (pos == string::npos)
	break;
      string pin = dialout_pin.substr(0, pos);
      
      size_t pos2 = dialout_pin.find_first_of(';', pos+1);
      if ((pos == string::npos)||(pos2 == string::npos))
	break;
      string userpart = dialout_pin.substr(pos+1, pos2-pos-1);
      pos = pos2;

      pos2 = dialout_pin.find_first_of(';', pos+1);
      if ((pos == string::npos)||(pos2 == string::npos))
	break;
      string user = dialout_pin.substr(pos+1, pos2-pos-1);
      pos = pos2;

      pos2 = dialout_pin.find_first_of(';', pos+1);
      if ((pos == string::npos)||(pos2 == string::npos))
	break;
      string domain = dialout_pin.substr(pos+1, pos2-pos-1);
      pos = pos2;

      pos2 = dialout_pin.find_first_of(';', pos+1);
      if ((pos == string::npos)||(pos2 == string::npos))
	break;
      string pwd = dialout_pin.substr(pos+1, pos2-pos-1);
      pos = pos2;

      dialout_pins[pin] = DIDialoutInfo(userpart, domain, user, pwd);
      DBG("DIDial: added PIN '%s' userpart '%s' domain '%s' user '%s' pwd '<not shown>'\n", 
	  pin.c_str(), userpart.c_str(), domain.c_str(), user.c_str());
      i_pin++;		
    } 
  } else {
    DBG("no configuration for di_dial found. No dialout pins will be set.\n");
  }
  
  DBG("DIDial loaded.\n");
  return 0;
}
Esempio n. 12
0
int XMLRPC2DI::load() {
  if (configured)    // load only once
    return 0;
  configured = true;

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  ServerRetryAfter = cfg.getParameterInt("server_retry_after", 10);
  DBG("retrying failed server after %u seconds\n", ServerRetryAfter);

  string run_server = cfg.getParameter("run_server","yes");
  if (run_server != "yes") {
    DBG("XMLRPC server will not be started.\n");
    return 0;
  }

  string conf_xmlrpc_port = cfg.getParameter("xmlrpc_port",XMLRPC_PORT);
  if (conf_xmlrpc_port.empty()) {
    ERROR("configuration: xmlrpc_port must be defined!\n");
    return -1;
  } 
  
  if (str2i(conf_xmlrpc_port, XMLRPCPort)) {
    ERROR("configuration: unable to decode xmlrpc_port value '%s'!\n", 
	  conf_xmlrpc_port.c_str());
    return -1;
  }

  bool export_di = false;
  string direct_export = cfg.getParameter("direct_export","");
  if (direct_export.length()) {
    DBG("direct_export interfaces: %s\n", direct_export.c_str());
  } else {
    DBG("No direct_export interfaces.\n");
  }

  string export_di_s = cfg.getParameter("export_di","yes");
  if (export_di_s == "yes") {
    export_di = true;
  } 
  
  DBG("XMLRPC Server: %snabling builtin method 'di'.\n", export_di?"E":"Not e");


  server = new XMLRPC2DIServer(XMLRPCPort, export_di, direct_export);

  server->start();
  return 0;
}
int RegistrationAgentFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  int i = 0;
  string idx_str;
  do {
    RegInfo ri;
    ri.domain = cfg.getParameter(CFG_PARAM_DOMAIN+idx_str,"");
    ri.user = cfg.getParameter(CFG_PARAM_USER+idx_str,"");
    ri.display_name = cfg.getParameter(CFG_PARAM_DISPLAY+idx_str,"");
    ri.auth_user = cfg.getParameter(CFG_PARAM_AUTH+idx_str,"");
    ri.passwd = cfg.getParameter(CFG_PARAM_PASS+idx_str,"");
    ri.proxy = cfg.getParameter(CFG_PARAM_PROXY+idx_str,"");

    if (!ri.domain.length() || !ri.user.length()) {
      // not including the passwd: might be IP based registration
      // not including the display name: allow user to skip it
      DBG("no mandatory config parameters '" CFG_PARAM_DOMAIN "' and '"
        CFG_PARAM_USER "' provided for entry #%d; configuration halted.\n", i);
      break;
    }

    if (!ri.auth_user.length()) // easier to config
      ri.auth_user = ri.user;

    dialer.add_reg(ri);
    DBG("Adding registration account #%d (%s %s %s %s %s)\n", i, 
        ri.domain.c_str(), ri.user.c_str(), ri.display_name.c_str(), 
        ri.auth_user.c_str(), ri.proxy.c_str());

    i ++;
    idx_str = int2str(i);
  } while (i < MAX_ACCOUNTS);

  if (i <= 0) {
    ERROR("no complete account provided: '" MOD_NAME "' module remains "
        "inactive, which might not be what you want!\n");
  } else {
    dialer.start();
  }

  return 0;
}
Esempio n. 14
0
int MyConfigurableAppFactory::onLoad()
{
    AmConfigReader cfg;
    if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
	return -1;

    AnnouncementFile = cfg.getParameter("announcement_file","/tmp/default.wav");

    if(!file_exists(AnnouncementFile)){
	ERROR("announcement file for configurableApp module does not exist ('%s').\n",
	      AnnouncementFile.c_str());
	return -1;
    }

    return 0;
}
int BrpcCtrlInterfaceFactory::onLoad()
{
    AmConfigReader cfg;

    if (cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
        WARN("failed to read/parse config file `%s' - assuming defaults\n",
             (AmConfig::ModConfigPath + string(MOD_NAME ".conf")).c_str());
        semsUri = string(LISTEN_ADDR_DEFAULT);
        serUri = string(SER_ADDR_DEFAULT);
    } else {
        semsUri = cfg.getParameter(LISTEN_ADDR_PARAM, LISTEN_ADDR_DEFAULT);
        serUri = cfg.getParameter(SER_ADDR_PARAM, SER_ADDR_DEFAULT);
    }
    INFO(LISTEN_ADDR_PARAM ": %s.\n", semsUri.c_str());
    INFO(SER_ADDR_PARAM ": %s.\n", serUri.c_str());

    return 0;
}
Esempio n. 16
0
int CallTimerFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
    DBG("using default timer of %d seconds\n", DEFAULT_CALL_TIMER);
    DefaultCallTimer = DEFAULT_CALL_TIMER;
  } else {
    DefaultCallTimer  = cfg.getParameterInt("default_call_time", DEFAULT_CALL_TIMER);
    UseAppParam = (cfg.getParameter("use_app_param") == "yes");
  }

  user_timer_fact = AmPlugIn::instance()->getFactory4Di("user_timer");
  if(!user_timer_fact) {
    ERROR("could not load user_timer from session_timer plug-in\n");
    return -1;
  }

  return 0;
}
int PinAuthConferenceFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(APP_NAME)+ ".conf"))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  // get prompts
  AM_PROMPT_START;
  AM_PROMPT_ADD(FIRST_PARTICIPANT, ANNOUNCE_PATH "first_paricipant.wav");
  AM_PROMPT_ADD(JOIN_SOUND,        ANNOUNCE_PATH "beep.wav");
  AM_PROMPT_ADD(DROP_SOUND,        ANNOUNCE_PATH "beep.wav");
  AM_PROMPT_ADD(ENTER_PIN,         ANNOUNCE_PATH "enter_pin.wav");
  AM_PROMPT_ADD(WRONG_PIN,         ANNOUNCE_PATH "wrong_pin.wav");
  AM_PROMPT_ADD(ENTERING_CONFERENCE, ANNOUNCE_PATH "entering_conference.wav");
  AM_PROMPT_END(prompts, cfg, APP_NAME);

  DigitsDir = cfg.getParameter("digits_dir");
  if (DigitsDir.length() && DigitsDir[DigitsDir.length()-1]!='/')
    DigitsDir+='/';

  if (!DigitsDir.length()) {
    WARN("No digits_dir specified in configuration.\n");
  }
  for (int i=0;i<10;i++) 
    prompts.setPrompt(int2str(i), DigitsDir+int2str(i)+".wav", APP_NAME);

  string playout_type = cfg.getParameter("playout_type");
  if (playout_type == "simple") {
    m_PlayoutType = SIMPLE_PLAYOUT;
    DBG("Using simple (fifo) buffer as playout technique.\n");
  } else 	if (playout_type == "adaptive_jb") {
    m_PlayoutType = JB_PLAYOUT;
    DBG("Using adaptive jitter buffer as playout technique.\n");
  } else {
    DBG("Using adaptive playout buffer as playout technique.\n");
  }

  return 0;
}
Esempio n. 18
0
void DSMFactory::preloadModules(const AmArg& args, AmArg& ret) {
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
      ret.push(500);
      ret.push("loading config file " +AmConfig::ModConfigPath + string(MOD_NAME ".conf"));
      return ;
  }
  string err;

  string ModPath = cfg.getParameter("mod_path");

  int res = preloadModules(cfg, err, ModPath);
  if (res<0) {
    ret.push(500);
    ret.push(err);
  } else {
    ret.push(200);
    ret.push("modules preloaded");
  }
}
Esempio n. 19
0
int UACAuthFactory::onLoad()
{
  string secret;
  AmConfigReader conf;
  string cfg_file_path = AmConfig::ModConfigPath + "uac_auth.conf";
  if(conf.loadFile(cfg_file_path)){
    WARN("Could not open '%s', assuming that default values are fine\n",
	 cfg_file_path.c_str());
    secret = AmSession::getNewId(); // ?? TODO: is this cryptoproof?
  } else {
    secret = conf.getParameter("server_secret");
    if (secret.size()<5) {
      ERROR("server_secret in '%s' too short!\n", cfg_file_path.c_str());
      return -1;
    }
  }

  UACAuth::setServerSecret(secret);
  return 0;
}
Esempio n. 20
0
int JsonRPCServerModule::load() {
  
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + 
		  string(MOD_NAME ".conf"))) {
    INFO("no '%s' configuration file present. using default values\n",
	 (AmConfig::ModConfigPath + string(MOD_NAME ".conf")).c_str());
  } else {
    port = cfg.getParameterInt("jsonrpc_port", DEFAULT_JSONRPC_SERVER_PORT);
    threads = cfg.getParameterInt("server_threads", DEFAULT_JSONRPC_SERVER_THREADS);
  }

  DBG("using server port %d\n", port);
  DBG("using %d server threads\n", threads);

  DBG("starting server loop thread\n");
  server_loop = new JsonRPCServerLoop();
  server_loop->start();
  
  return 0;
}
Esempio n. 21
0
int AnnounceAuthFactory::onLoad()
{
    AmConfigReader cfg;
    if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
	return -1;

    // get application specific global parameters
    configureModule(cfg);

    AnnouncePath = cfg.getParameter("announce_path",ANNOUNCE_PATH);
    if( !AnnouncePath.empty() 
	&& AnnouncePath[AnnouncePath.length()-1] != '/' )
	AnnouncePath += "/";

    AnnounceFile = cfg.getParameter("default_announce",ANNOUNCE_FILE);

    string announce_file = AnnouncePath + AnnounceFile;
    if(!file_exists(announce_file)){
	ERROR("default file for ann_b2b module does not exist ('%s').\n",
	      announce_file.c_str());
	return -1;
    }


	auth_realm = cfg.getParameter("auth_realm", "");
	auth_user  = cfg.getParameter("auth_user",  "");
	auth_pwd   = cfg.getParameter("auth_pwd", "");

    uac_auth_f = AmPlugIn::instance()->getFactory4Seh("uac_auth");
    DBG("uac_auth_f == 0x%.16lX\n",(unsigned long)uac_auth_f);

	dialer.set_dial(cfg.getParameter("dial_ruri","default ruri"),
					cfg.getParameter("dial_from","default from"),
					cfg.getParameter("dial_fromuri","default fromuri"),
					cfg.getParameter("dial_to","default to"));

	dialer.start();

    return 0;
}
Esempio n. 22
0
int XMLRPC2DI::onLoad() {

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  string conf_xmlrpc_port = cfg.getParameter("xmlrpc_port",XMLRPC_PORT);
  if (conf_xmlrpc_port.empty()) {
    ERROR("configuration: xmlrpc_port must be defined!\n");
    return -1;
  } 
  
  if (str2i(conf_xmlrpc_port, XMLRPCPort)) {
    ERROR("configuration: unable to decode xmlrpc_port value '%s'!\n", 
	  conf_xmlrpc_port.c_str());
    return -1;
  }

  bool export_di = false;
  string direct_export = cfg.getParameter("direct_export","");
  if (direct_export.length()) {
    DBG("direct_export interfaces: %s\n", direct_export.c_str());
  } else {
    DBG("No direct_export interfaces.\n");
  }

  string export_di_s = cfg.getParameter("export_di","yes");
  if (export_di_s == "yes") {
    export_di = true;
  } 
  
  DBG("XMLRPC Server: %snabling builtin method 'di'.\n", export_di?"E":"Not e");


  server = new XMLRPC2DIServer(XMLRPCPort, export_di, direct_export);

  server->start();
  return 0;
}
Esempio n. 23
0
void DSMFactory::loadDSM(const AmArg& args, AmArg& ret) {
  string dsm_name  = args.get(0).asCStr();

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
      ret.push(500);
      ret.push("loading config file " +AmConfig::ModConfigPath + string(MOD_NAME ".conf"));
      return;
  }

  string DiagPath = cfg.getParameter("diag_path");
  if (DiagPath.length() && DiagPath[DiagPath.length()-1] != '/')
    DiagPath += '/';

  string ModPath = cfg.getParameter("mod_path");

  string dsm_file_name = DiagPath+dsm_name+".dsm";
  string res = "OK";

  ScriptConfigs_mut.lock();
  try {
    if (MainScriptConfig.diags->hasDiagram(dsm_name)) {
      ret.push(400);
      ret.push("DSM named '" + dsm_name + "' already loaded (use reloadDSMs to reload all)");
    } else {
      if (!MainScriptConfig.diags->loadFile(dsm_file_name, dsm_name, ModPath, DebugDSM)) {
	ret.push(500);
	ret.push("error loading "+dsm_name+" from "+ dsm_file_name);
      } else {
	ret.push(200);
	ret.push("loaded "+dsm_name+" from "+ dsm_file_name);
      }
    }
  } catch(...) {
    ScriptConfigs_mut.unlock();
    throw;
  }
  ScriptConfigs_mut.unlock();
}
Esempio n. 24
0
int ServiceLineFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  AnnounceFile = cfg.getParameter("prompt",ANNOUNCE_FILE);
  DBG("Prompt = %s\n",AnnounceFile.c_str());

  string announce_file = AnnounceFile;
  if(!file_exists(announce_file)){
    ERROR("prompt file for serviceline module does not exist ('%s').\n",
	  announce_file.c_str());
    return -1;
  }

  DBG("ServiceLine Connect DTMF Key Mapping:\n");
  for (unsigned int i=0;i<10;i++) {
    callee_numbers[i] = cfg.getParameter("callee_number"+int2str(i));
    DBG("Key %u -> Extension __%s__\n", 
	i, callee_numbers[i].empty()?
	"none":callee_numbers[i].c_str());
  }
  
  GWDomain= cfg.getParameter("gw_domain", "");;
  GWUser= cfg.getParameter("gw_user", "");;
  GWDisplayname= cfg.getParameter("gw_displayname", "");;
  
  GWAuthuser= cfg.getParameter("gw_authuser", "");
  GWAuthrealm=cfg.getParameter("gw_authrealm", ""); // actually unused
  GWAuthpwd=cfg.getParameter("gw_authpwd", "");

  return 0;
}
Esempio n. 25
0
void DSMFactory::reloadDSMs(const AmArg& args, AmArg& ret) {
  DSMStateDiagramCollection* new_diags = new DSMStateDiagramCollection();

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
      ret.push(500);
      ret.push("loading config file " +AmConfig::ModConfigPath + string(MOD_NAME ".conf"));
      return ;
  }

  string DiagPath = cfg.getParameter("diag_path");
  if (DiagPath.length() && DiagPath[DiagPath.length()-1] != '/')
    DiagPath += '/';

  string ModPath = cfg.getParameter("mod_path");

  string LoadDiags = cfg.getParameter("load_diags");
  vector<string> diags_names = explode(LoadDiags, ",");
  for (vector<string>::iterator it=
	 diags_names.begin(); it != diags_names.end(); it++) {
    if (!new_diags->loadFile(DiagPath+*it+".dsm", *it, DiagPath, ModPath,
			     DebugDSM, CheckDSM)) {
      ERROR("loading %s from %s\n", 
	    it->c_str(), (DiagPath+*it+".dsm").c_str());
      ret.push(500);
      ret.push("loading " +*it+ " from "+ DiagPath+*it+".dsm");
      return;
    }
  }
  ScriptConfigs_mut.lock();
  old_diags.insert(MainScriptConfig.diags);
  MainScriptConfig.diags = new_diags; 
  ScriptConfigs_mut.unlock();

  ret.push(200);
  ret.push("DSMs reloaded");
}
Esempio n. 26
0
int SWPrepaidSIPFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;

  string acc_plugin = cfg.getParameter("acc_plugin", ACC_PLUGIN);

  user_timer_fact = AmPlugIn::instance()->getFactory4Di("user_timer");
  if(!user_timer_fact) {
    ERROR("could not load user_timer from session_timer plug-in\n");
    return -1;
  }

  DBG("using acc plugin '%s'\n", acc_plugin.c_str());
  cc_acc_fact = AmPlugIn::instance()->getFactory4Di(acc_plugin);
  if(!cc_acc_fact) {
    ERROR("could not load accounting plugin '%s', please provide a valid module name\n",
      acc_plugin.c_str());
    return -1;
  }

  return 0;
}
Esempio n. 27
0
int CallBackFactory::onLoad()
{
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME)+ ".conf"))
    return -1;

  // get application specific global parameters
  configureModule(cfg);

  // get prompts
  AM_PROMPT_START;
  AM_PROMPT_ADD(WELCOME_PROMPT,  WELCOME_PROMPT ".wav");
  AM_PROMPT_END(prompts, cfg, MOD_NAME);

  string DigitsDir = cfg.getParameter("digits_dir");
  if (DigitsDir.length() && DigitsDir[DigitsDir.length()-1]!='/')
    DigitsDir+='/';

  if (!DigitsDir.length()) {
    ERROR("No digits_dir specified in configuration.\n");
  }
  for (int i=0;i<10;i++) 
    prompts.setPrompt(int2str(i), DigitsDir+int2str(i)+".wav", MOD_NAME);

  string playout_type = cfg.getParameter("playout_type");
  if (playout_type == "simple") {
    m_PlayoutType = SIMPLE_PLAYOUT;
    DBG("Using simple (fifo) buffer as playout technique.\n");
  } else 	if (playout_type == "adaptive_jb") {
    m_PlayoutType = JB_PLAYOUT;
    DBG("Using adaptive jitter buffer as playout technique.\n");
  } else {
    DBG("Using adaptive playout buffer as playout technique.\n");
  }
  
  string accept_caller_re_str = cfg.getParameter(ACCEPT_CALLER_RE);
  if (!accept_caller_re_str.length()) {
    ERROR("no '" ACCEPT_CALLER_RE "' set.\n");
    return -1;
  } else {
    if (regcomp(&accept_caller_re, accept_caller_re_str.c_str(), 
		 REG_EXTENDED|REG_NOSUB)) {
      ERROR("unable to compile caller RE '%s'.\n",
	    accept_caller_re_str.c_str());
      return -1;
    }
  }

  gw_user = cfg.getParameter("gw_user");
  if (!gw_user.length()) {
    ERROR("need gw_user configured!\n");
    return -1;
  }

  gw_domain = cfg.getParameter("gw_domain");
  if (!gw_domain.length()) {
    ERROR("need gw_domain configured!\n");
    return -1;
  }

  auth_user = cfg.getParameter("auth_user");
  if (!auth_user.length())
    auth_user = gw_user; // default to user

  auth_pwd = cfg.getParameter("auth_pwd");
  if (!auth_pwd.length()) {
    ERROR("need auth_pwd configured!\n");
    return -1;
  }

  cb_wait = cfg.getParameterInt("cb_wait", 5);
  DBG("cb_wait set to %d\n", cb_wait);

  DBG("starting callback thread. (%ld)\n", (long)this);
  start();

  return 0;
}
Esempio n. 28
0
int DSMFactory::onLoad()
{
  if (loaded)
    return 0;
  loaded = true;

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;
 
  // get application specific global parameters
  configureModule(cfg);

  DebugDSM = cfg.getParameter("debug_raw_dsm") == "yes";
 
  if (!loadPrompts(cfg))
    return -1;

  if (!loadPromptSets(cfg))
    return -1;

  if (!loadDiags(cfg, MainScriptConfig.diags))
    return -1;

  vector<string> registered_apps;
  if (!registerApps(cfg, MainScriptConfig.diags, registered_apps))
    return -1;

  InboundStartDiag = cfg.getParameter("inbound_start_diag");
  if (InboundStartDiag.empty()) {
    INFO("no 'inbound_start_diag' set in config. "
	 "inbound calls with application 'dsm' disabled.\n");
  }

  OutboundStartDiag = cfg.getParameter("outbound_start_diag");
  if (OutboundStartDiag.empty()) {
    INFO("no 'outbound_start_diag' set in config. "
	 "outbound calls with application 'dsm' disabled.\n");
  }

  if (!InboundStartDiag.empty())
    AmPlugIn::instance()->registerFactory4App("dsm",this);

  MainScriptConfig.config_vars.insert(cfg.begin(), cfg.end());

//   for (std::map<string,string>::const_iterator it = 
// 	 cfg.begin(); it != cfg.end(); it++) 
//     MainScriptConfig.config_vars[it->first] = it->second;

  MainScriptConfig.RunInviteEvent = cfg.getParameter("run_invite_event")=="yes";

  MainScriptConfig.SetParamVariables = cfg.getParameter("set_param_variables")=="yes";

#ifdef USE_MONITORING
  string monitoring_full_callgraph = cfg.getParameter("monitoring_full_stategraph");
  MonitoringFullCallgraph = monitoring_full_callgraph == "yes";
  DBG("%sogging full call graph (states) to monitoring.\n",
      MonitoringFullCallgraph?"L":"Not l");

  string monitoring_full_transitions = cfg.getParameter("monitoring_full_transitions");
  MonitoringFullTransitions = monitoring_full_transitions == "yes";
  DBG("%sogging full call graph (transitions) to monitoring.\n",
      MonitoringFullTransitions?"L":"Not l");

  string cfg_usecaller = cfg.getParameter("monitor_select_use_caller");
  if (cfg_usecaller.empty() || cfg_usecaller=="from") 
    MonSelectCaller = MonSelect_FROM;
  else if (cfg_usecaller=="no") 
    MonSelectCaller = MonSelect_NONE;
  else if (cfg_usecaller=="pai") 
    MonSelectCaller = MonSelect_PAI;
  else {
    ERROR("monitor_select_use_caller value '%s' not understood\n",
	  cfg_usecaller.c_str());
  }

  string cfg_usecallee = cfg.getParameter("monitor_select_use_callee");
  if (cfg_usecallee.empty() || cfg_usecallee=="ruri") 
    MonSelectCallee = MonSelect_RURI;
  else if (cfg_usecallee=="no") 
    MonSelectCallee = MonSelect_NONE;
  else if (cfg_usecallee=="from") 
    MonSelectCallee = MonSelect_FROM;
  else {
    ERROR("monitor_select_use_callee value '%s' not understood\n",
	  cfg_usecallee.c_str());
  }
#endif

  string conf_d_dir = cfg.getParameter("conf_dir");
  if (!conf_d_dir.empty()) {
    if (conf_d_dir[conf_d_dir.length()-1] != '/')
      conf_d_dir += '/';

    DBG("processing configurations in '%s'...\n", conf_d_dir.c_str());
    int err=0;
    struct dirent* entry;
    DIR* dir = opendir(conf_d_dir.c_str());
    
    if(!dir){
      ERROR("config loader (%s): %s\n", 
	    conf_d_dir.c_str(), strerror(errno));
      return -1;
    }
    while( ((entry = readdir(dir)) != NULL) && (err == 0) ){
      string conf_name = string(entry->d_name);
      
      if(conf_name.find(".conf",conf_name.length()-5) == string::npos ){
	continue;
      }
          
      string conf_file_name = conf_d_dir + conf_name;

      DBG("loading %s ...\n",conf_file_name.c_str());
      if (!loadConfig(conf_file_name, conf_name, false, NULL)) 
	return -1;

    }
    closedir(dir);
  }
  return 0;
}
Esempio n. 29
0
int DSMFactory::onLoad()
{
  if (loaded)
    return 0;
  loaded = true;

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf")))
    return -1;
 
  // get application specific global parameters
  configureModule(cfg);
  
  vector<string> prompts_files = 
    explode(cfg.getParameter("load_prompts"), ",");
  for (vector<string>::iterator it=
	 prompts_files.begin(); it != prompts_files.end(); it++) {
    DBG("loading prompts from '%s'\n", it->c_str());
    std::ifstream ifs(it->c_str());
    string s;
    while (ifs.good() && !ifs.eof()) {
      getline(ifs, s);
      if (s.length() && s.find_first_not_of(" \t")!= string::npos &&
	  s[s.find_first_not_of(" \t")] != '#') {
        vector<string> p=explode(s, "=");
	if (p.size()==2) {
	  prompts.setPrompt(p[0], p[1], MOD_NAME);
	  DBG("added prompt '%s' as '%s'\n", 
	      p[0].c_str(), p[1].c_str());
	}
      }
    }
  }

  string prompt_sets_path = cfg.getParameter("prompts_sets_path");

  vector<string> prompt_sets_names = 
    explode(cfg.getParameter("load_prompts_sets"), ",");
  for (vector<string>::iterator it=
	 prompt_sets_names.begin(); it != prompt_sets_names.end(); it++) {
    string fname = prompt_sets_path.empty() ? "": prompt_sets_path + "/";
    fname += *it;
    DBG("loading prompts for '%s' (file '%s')\n", it->c_str(), fname.c_str());
    std::ifstream ifs(fname.c_str());
    string s;
    if (!ifs.good()) {
      WARN("prompts set file '%s' could not be read\n", fname.c_str());
    }
    AmPromptCollection* pc = new AmPromptCollection();
    while (ifs.good() && !ifs.eof()) {
      getline(ifs, s);
      if (s.length() && s.find_first_not_of(" \t")!= string::npos &&
	  s[s.find_first_not_of(" \t")] != '#') {
        vector<string> p=explode(s, "=");
	if (p.size()==2) {
	  pc->setPrompt(p[0], p[1], MOD_NAME);
	  DBG("set '%s' added prompt '%s' as '%s'\n", 
	      it->c_str(), p[0].c_str(), p[1].c_str());
	}
      }
    }
    prompt_sets[*it] = pc;
  }

  string DiagPath = cfg.getParameter("diag_path");
  if (DiagPath.length() && DiagPath[DiagPath.length()-1] != '/')
    DiagPath += '/';

  string ModPath = cfg.getParameter("mod_path");

  string preload_mods = cfg.getParameter("preload_mods");
  vector<string> preload_names = explode(preload_mods, ",");
  if (preload_names.size()) {
    DSMChartReader reader;
    for (vector<string>::iterator it=
	   preload_names.begin(); it != preload_names.end(); it++) {
      DBG("preloading '%s'...\n", it->c_str());
      if (!reader.importModule("import("+*it+")", ModPath)) {
	ERROR("importing module '%s' for preload\n", it->c_str());
	return -1;
      }
      DSMModule* last_loaded = reader.mods.back();
      if (last_loaded) {
 	if (last_loaded->preload()) {
 	  DBG("Error while preloading '%s'\n", it->c_str());
 	  return -1;
 	}
      }
    }
  }
  // TODO: pass preloaded mods to chart reader

  string LoadDiags = cfg.getParameter("load_diags");
  vector<string> diags_names = explode(LoadDiags, ",");
  for (vector<string>::iterator it=
	 diags_names.begin(); it != diags_names.end(); it++) {
    if (!diags.loadFile(DiagPath+*it+".dsm", *it, ModPath)) {
      ERROR("loading %s from %s\n", 
	    it->c_str(), (DiagPath+*it+".dsm").c_str());
      return -1;
    }
  }

  InboundStartDiag = cfg.getParameter("inbound_start_diag");
  if (InboundStartDiag.empty()) {
    INFO("no 'inbound_start_diag' set in config. inbound calls disabled.\n");
  }
  OutboundStartDiag = cfg.getParameter("outbound_start_diag");
  if (OutboundStartDiag.empty()) {
    INFO("no 'outbound_start_diag' set in config. outbound calls disabled.\n");
  }

  for (std::map<string,string>::const_iterator it = 
	 cfg.begin(); it != cfg.end(); it++)
    config[it->first] = it->second;

  RunInviteEvent = cfg.getParameter("run_invite_event")=="yes";

  return 0;
}
Esempio n. 30
0
bool DSMFactory::loadConfig(const string& conf_file_name, const string& conf_name, 
			    bool live_reload, DSMStateDiagramCollection* m_diags) {

  string script_name = conf_name.substr(0, conf_name.length()-5); // - .conf
  DBG("loading %s from %s ...\n", script_name.c_str(), conf_file_name.c_str());
  AmConfigReader cfg;
  if(cfg.loadFile(conf_file_name))
    return false;

  DSMScriptConfig script_config;
  script_config.RunInviteEvent = 
    cfg.getParameter("run_invite_event")=="yes";

  script_config.SetParamVariables = 
    cfg.getParameter("set_param_variables")=="yes";

  script_config.config_vars.insert(cfg.begin(), cfg.end());

  if (live_reload) {
    INFO("live DSM config reload does NOT reload prompts and prompt sets!\n");
    INFO("(see http://tracker.iptel.org/browse/SEMS-68)\n");
  } else {
    if (!loadPrompts(cfg))
      return false;

    if (!loadPromptSets(cfg))
      return false;
  }

  DSMStateDiagramCollection* used_diags;
  if (m_diags != NULL)
    used_diags = m_diags;     // got this from caller (main diags)
  else {
    // create a new set of diags 
    used_diags = script_config.diags = new DSMStateDiagramCollection();
  }

  if (!loadDiags(cfg, used_diags))
    return false;

  vector<string> registered_apps;
  if (!registerApps(cfg, used_diags, registered_apps))
    return false;

  ScriptConfigs_mut.lock();
  try {
    // set ScriptConfig to this for all registered apps' names
    for (vector<string>::iterator reg_app_it=
	   registered_apps.begin(); reg_app_it != registered_apps.end(); reg_app_it++) {
      string& app_name = *reg_app_it;
      // dispose of the old one, if it exists
      map<string, DSMScriptConfig>::iterator it=ScriptConfigs.find(app_name);
      if (it != ScriptConfigs.end()) {
	// may be in use by active call - don't delete but save to 
	// old_diags for garbage collection (destructor)
	if (it->second.diags != NULL)
	  old_diags.insert(it->second.diags);   
      }
      
      // overwrite with new config
      ScriptConfigs[app_name] = script_config;
    }
  } catch(...) {
    ScriptConfigs_mut.unlock();
    throw;
  }
  ScriptConfigs_mut.unlock();

  return true;
}