Пример #1
0
void SipImpliedSubscriptions::readConfig( OsConfigDb& configDb )
{
  OsConfigDb impliedSubscriptionConfig;
  OsStatus   found;
  UtlString   key;
  UtlString   name;
  UtlString   recognizer;

  configuredUserAgents.reset();

  // extract the database of implied message waiting subscriptions
  configDb.getSubHash( ConfigPrefix
                      ,impliedSubscriptionConfig
                      );
  for ( key = "", found = impliedSubscriptionConfig.getNext( key
                                                            ,name
                                                            ,recognizer
                                                            );
        found == OS_SUCCESS;
        key = name, found = impliedSubscriptionConfig.getNext( key
                                                              ,name
                                                              ,recognizer
                                                              )
       )
    {
      OsSysLog::add( FAC_SIP, PRI_INFO
                    ,"%s::readConfig name=\"%s\" recognizer=\"%s\""
                    ,mLogName.data(), name.data(), recognizer.data()
                    );
      configuredUserAgents.add( name, recognizer, mLogName );
    }
}
Пример #2
0
   /// Construct the subhash for the hook and configure it.
   void readConfig(const UtlString& prefix, OsConfigDb& configDb)
      {
         if (hook)
         {
            OsConfigDb myConfig;
            UtlString myConfigName;

            // build up "<prefix>.<instance>." key for configuration subhash
            myConfigName.append(prefix);
            myConfigName.append('.');
            myConfigName.append(*this);
            myConfigName.append('.');
            
            if (OS_SUCCESS == configDb.getSubHash(myConfigName, myConfig))
            {
               OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
                             "Plugin configuring '%s' from '%s'",
                             data(), myConfigName.data()
                             );
               hook->readConfig(myConfig);
            }
            else
            {
               OsSysLog::add(FAC_KERNEL, PRI_CRIT,
                             "Plugin no configuration found for '%s'",
                             data()
                             );
            }
         }
      };
Пример #3
0
UtlBoolean
SipRedirectServer::initialize(OsConfigDb& configDb
                              ///< Configuration parameters
                              )
{
   configDb.get("SIP_REGISTRAR_DOMAIN_NAME", mDefaultDomain);

   mProxyNormalPort = configDb.getPort("SIP_REGISTRAR_PROXY_PORT");
   if (mProxyNormalPort == PORT_DEFAULT)
   {
      mProxyNormalPort = SIP_PORT;
   }
   mAckRouteToProxy.insert(0, "<");
   mAckRouteToProxy.append(mDefaultDomain);
   mAckRouteToProxy.append(";lr>");

   // Load the list of redirect processors.
   mRedirectPlugins.readConfig(configDb);
   mRedirectorCount = mRedirectPlugins.entries();

   // Call their ::initialize() methods.
   mpConfiguredRedirectors = new RedirectorDescriptor[ mRedirectorCount ];
   PluginIterator iterator(mRedirectPlugins);
   RedirectPlugin* redirector;
   UtlString redirectorName;
   bool bAuthorityLevelDbAvailable;
   UtlString authorityLevelDbPrefix = RedirectPlugin::Prefix;
   authorityLevelDbPrefix.append( AuthorityLevelPrefix );
   authorityLevelDbPrefix.append( '.' );
   OsConfigDb authorityLevelDb;

   bAuthorityLevelDbAvailable = ( configDb.getSubHash( authorityLevelDbPrefix, authorityLevelDb ) == OS_SUCCESS );
   int i;       // Iterator sequence number.

   for (i = 0; (redirector = static_cast <RedirectPlugin*> (iterator.next( &redirectorName )));
        i++)
   {
      mpConfiguredRedirectors[i].name = redirectorName;
      if( ( mpConfiguredRedirectors[i].bActive =
             ( redirector->initialize(configDb, i, mDefaultDomain) == OS_SUCCESS ) ) )
      {
         redirector->setUserAgent(mpSipUserAgent);
         int authorityLevel;
         if( bAuthorityLevelDbAvailable         &&
             authorityLevelDb.get( redirectorName, authorityLevel ) == OS_SUCCESS )
         {
            mpConfiguredRedirectors[i].authorityLevel = authorityLevel;
         }
         else
         {
            mpConfiguredRedirectors[i].authorityLevel = LOWEST_AUTHORITY_LEVEL;
         }
         Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                       "SipRedirectServer::initialize "
                       "Initialized redirector %s (authority level = %zd)", redirectorName.data(), mpConfiguredRedirectors[i].authorityLevel );
      }
      else
      {
         Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
                       "SipRedirectServer::initialize "
                       "Redirector %s is inactive ", redirectorName.data() );
      }
   }
   return true;
}
Пример #4
0
void PluginHooks::readConfig(OsConfigDb& configDb)
{
   OsSysLog::add(FAC_KERNEL, PRI_DEBUG, "PluginHooks::readConfig" );

   // Move any existing hooks from the current configured list to
   // a temporary holding list.
   UtlSList existingHooks;
   UtlContainable* existingHook;
   
   UtlSortedListIterator nextHook(mConfiguredHooks);
   while (existingHook = nextHook())
   {
      existingHooks.append(mConfiguredHooks.removeReference(existingHook));
   }
   // the mConfiguredHooks list is now empty
   
   // Walk the current configuration,
   //   any existing hook is moved back to the mConfiguredHooks list,
   //   newly configured hooks are added,
   //   each configured hook is called to read its own configuration.
   UtlString  hookPrefix(mPrefix);
   hookPrefix.append(HOOK_LIB_PREFIX);
   
   OsConfigDb allHooks;
   
   OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
                 "PluginHooks::readConfig looking up hooks '%s'",
                 hookPrefix.data()
                 );
   if (OS_SUCCESS == configDb.getSubHash(hookPrefix, allHooks)) // any hooks configured for prefix?
   {
      UtlString lastHook;
      UtlString hookName;
      UtlString hookLibrary;

      // walk each hook and attempt to load and configure it 
      for ( lastHook = "";
            OS_SUCCESS == allHooks.getNext(lastHook, hookName, hookLibrary);
            lastHook = hookName
           )
      {
         ConfiguredHook* thisHook;
         
         if (NULL == (thisHook = dynamic_cast<ConfiguredHook*>(existingHooks.remove(&hookName))))
         {
            // not an existing hook, so create a new one
            OsSysLog::add(FAC_KERNEL, PRI_DEBUG,
                          "PluginHooks: loading '%s'", hookName.data()
                          );
            thisHook = new ConfiguredHook(hookName, mFactory, hookLibrary);
         }

         // put the hook onto the list of active hooks
         mConfiguredHooks.insert(thisHook);

         // (re)configure the hook
         thisHook->readConfig(mPrefix, configDb);
      }
   }
   else
   {
      OsSysLog::add(FAC_KERNEL, PRI_INFO,
                    "PluginHooks: no '%s' hooks configured", mPrefix.data()
                    );
   }

   // discard any hooks that are no longer in the configuration
   existingHooks.destroyAll();
}