reSIProcate/DialogUsageManager  9694
Classes | Defines | Functions
test3pcc.cxx File Reference
#include "resip/stack/SdpContents.hxx"
#include "resip/stack/SipMessage.hxx"
#include "resip/stack/ShutdownMessage.hxx"
#include "resip/stack/SipStack.hxx"
#include "resip/dum/ClientAuthManager.hxx"
#include "resip/dum/ClientInviteSession.hxx"
#include "resip/dum/ClientRegistration.hxx"
#include "resip/dum/DialogUsageManager.hxx"
#include "resip/dum/DumShutdownHandler.hxx"
#include "resip/dum/InviteSessionHandler.hxx"
#include "resip/dum/MasterProfile.hxx"
#include "resip/dum/RegistrationHandler.hxx"
#include "resip/dum/ServerInviteSession.hxx"
#include "resip/dum/ServerOutOfDialogReq.hxx"
#include "resip/dum/OutOfDialogHandler.hxx"
#include "resip/dum/AppDialog.hxx"
#include "resip/dum/AppDialogSet.hxx"
#include "resip/dum/AppDialogSetFactory.hxx"
#include "rutil/Log.hxx"
#include "rutil/Logger.hxx"
#include "rutil/Random.hxx"
#include <sstream>
#include <time.h>
Include dependency graph for test3pcc.cxx:

Go to the source code of this file.

Classes

class  Controller

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Functions

int main (int argc, char **argv)

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::TEST

Definition at line 26 of file test3pcc.cxx.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 130 of file test3pcc.cxx.

References resip::DialogUsageManager::addTransport(), resip::Log::Cout, resip::Data::data(), resip::DialogUsageManager::getMasterProfile(), resip::Log::initialize(), resip::DialogUsageManager::makeInviteSession(), resip::DialogUsageManager::process(), resip::FdSet::selectMilliSeconds(), resip::DialogUsageManager::send(), resip::DialogUsageManager::setClientAuthManager(), resip::DialogUsageManager::setInviteSessionHandler(), resip::DialogUsageManager::setMasterProfile(), resip::Data::size(), type, resip::UDP, and resip::Log::Warning.

{
   Log::initialize(Log::Cout, resip::Log::Warning, argv[0]);

   DialogUsageManager controller;
   controller.addTransport(UDP, 12005);

   SharedPtr<MasterProfile> uacMasterProfile(new MasterProfile);      
   auto_ptr<ClientAuthManager> uacAuth(new ClientAuthManager);
   controller.setMasterProfile(uacMasterProfile);
   controller.setClientAuthManager(uacAuth);

   Controller invSessionHandler;
   controller.setInviteSessionHandler(&invSessionHandler);

   NameAddr controllerAor("sip:controller@internal.xten.net");
   controller.getMasterProfile()->setDefaultFrom(controllerAor);
   NameAddr target("sip:rohan@internal.xten.net");

   Data txt("v=0\r\n"
            "o=- 327064655 327074279 IN IP4 192.168.0.129\r\n"
            "s=3pcc test\r\n"
            "c=IN IP4 0.0.0.0\r\n"
            "t=0 0\r\n"
//            "m=audio 7154 RTP/AVP 0\r\n"
//            "a=sendrecv\r\n"
      );
            
   HeaderFieldValue hfv(txt.data(), txt.size());
   Mime type("application", "sdp");
   SdpContents sdp(&hfv, type);
   
   controller.send(controller.makeInviteSession(target, &sdp));
   
   
   int n = 0;
   while (true)
   {
     FdSet fdset;
     // Should these be buildFdSet on the DUM?
     controller.buildFdSet(fdset);
     int err = fdset.selectMilliSeconds(100);
     assert ( err != -1 );
     controller.process(fdset);
     if (!(n++ % 10)) cerr << "|/-\\"[(n/10)%4] << '\b';
   }   
   return 0;
}

Here is the call graph for this function: