< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] How to cleanly shutdown and re-init DUM?


Hi there, I'm looking for some advice on two basic problems...

1) How do I cleanly shutdown DUM at application exit?  My initialization
code is given below for reference...

2) How do I re-initialize after a network cable disconnection?  Do I need to
somehow remove and re-add transports?  Do I need to completely reinitialize
(i.e. run a clean "shutdown" as per my first question, followed by my init
code below?

Thanks
 - Jeremy -

   void PCM::Initialize( String* logFilePath, int logLevel )
   {
      resip::Log::Level lev = resip::Log::Info;
      switch ( logLevel )
      {
      case 1:
         lev = resip::Log::Info;
         break;
      case 2:
         // this is the most verbose
         lev = resip::Log::Stack;
         break;
      }

      NetString
nsLogFilePath(String::Concat(logFilePath,"sipstacklog.txt"));
      resip::Log::initialize( Log::File, lev, "NH",
nsLogFilePath.ToAnsiString() );

      this->m_sipStack = new resip::SipStack();
      this->m_stackThread = new resip::StackThread(*this->m_sipStack);
      this->m_dum = new resip::DialogUsageManager(*this->m_sipStack);
      this->m_dumThread = new resip::DumThread(*this->m_dum);

      SharedPtr<MasterProfile> profile(new MasterProfile);
      std::auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager);   

      // note that I've got IPv6 support turned OFF for now
      this->m_dum->addTransport(UDP, 10000 + rand()&0x7fff, V4);

      this->m_dum->setMasterProfile(profile);
      this->m_dum->setClientAuthManager(clientAuth);

      // set up our supported call flows
      this->m_messageController = new
MessageController(*this->m_sipStack,this);
        ...

      this->m_dum->setClientRegistrationHandler(this->m_messageController);
      
      // the following ensures that the DUM *only* handles REGISTER requests
and
      // NO OTHER SIP REQUESTS since we want to manually process those
ourselves in
      // the MessageController
      resip::MessageFilterRuleList dumFilterRules;
      resip::MessageFilterRule::MethodList methodList;
      methodList.push_back(resip::REGISTER);
 
dumFilterRules.push_back(MessageFilterRule(resip::MessageFilterRule::SchemeL
ist(),
                                           resip::MessageFilterRule::Any,
                                           methodList) );
      this->m_dum->setMessageFilterRuleList(dumFilterRules);

      this->m_sipStack->registerTransactionUser(*this->m_messageController);

      this->m_stackThread->run();
      this->m_messageController->run();
      this->m_dumThread->run();
   }


Jeremy Geras
Software Developer,
NewHeights Software
(250) 380-0584
jgeras@xxxxxxxxxxxxxx