|
reSIProcate/DialogUsageManager
9694
|
#include "resip/stack/SipStack.hxx"#include "resip/dum/ClientAuthManager.hxx"#include "resip/dum/ClientRegistration.hxx"#include "resip/dum/DialogUsageManager.hxx"#include "resip/dum/MasterProfile.hxx"#include "resip/dum/RegistrationHandler.hxx"#include "rutil/Log.hxx"#include "rutil/Logger.hxx"#include "rutil/Subsystem.hxx"#include "resip/dum/KeepAliveManager.hxx"
Go to the source code of this file.
Classes | |
| class | ClientHandler |
Defines | |
| #define | RESIPROCATE_SUBSYSTEM Subsystem::TEST |
Functions | |
| int | main (int argc, char **argv) |
| #define RESIPROCATE_SUBSYSTEM Subsystem::TEST |
Definition at line 24 of file basicRegister.cxx.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 71 of file basicRegister.cxx.
References resip::DialogUsageManager::addTransport(), resip::Log::Cout, ClientHandler::done, resip::DialogUsageManager::getMasterProfile(), resip::Uri::host(), resip::Log::initialize(), resip::DialogUsageManager::makeRegistration(), resip::SipStack::process(), resip::DialogUsageManager::process(), resipCout, resip::DialogUsageManager::send(), resip::DialogUsageManager::setClientAuthManager(), resip::DialogUsageManager::setClientRegistrationHandler(), resip::DialogUsageManager::setKeepAliveManager(), resip::DialogUsageManager::setMasterProfile(), resip::Log::Stack, resip::TCP, resip::TLS, resip::UDP, resip::NameAddr::uri(), resip::Uri::user(), and resip::V4.
{
if ( argc < 3 ) {
resipCout << "usage: " << argv[0] << " sip:user passwd\n";
return 0;
}
Log::initialize(Log::Cout, Log::Stack, argv[0]);
NameAddr userAor(argv[1]);
Data passwd(argv[2]);
#ifdef USE_SSL
#ifdef WIN32
Security* security = new WinSecurity;
#else
Security* security = new Security;
#endif
SipStack stack(security);
#else
SipStack stack;
#endif
DialogUsageManager clientDum(stack);
SharedPtr<MasterProfile> profile(new MasterProfile);
auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager);
ClientHandler clientHandler;
clientDum.addTransport(UDP, 0, V4);
// clientDum.addTransport(UDP, 0, V6);
clientDum.addTransport(TCP, 0, V4);
// clientDum.addTransport(TCP, 0, V6);
#ifdef USE_SSL
clientDum.addTransport(TLS, 0, V4);
// clientDum.addTransport(TLS, 0, V6);
#endif
clientDum.setMasterProfile(profile);
clientDum.setClientRegistrationHandler(&clientHandler);
clientDum.setClientAuthManager(clientAuth);
clientDum.getMasterProfile()->setDefaultRegistrationTime(70);
// keep alive test.
auto_ptr<KeepAliveManager> keepAlive(new KeepAliveManager);
clientDum.setKeepAliveManager(keepAlive);
clientDum.getMasterProfile()->setDefaultFrom(userAor);
profile->setDigestCredential(userAor.uri().host(),
userAor.uri().user(),
passwd);
SharedPtr<SipMessage> regMessage = clientDum.makeRegistration(userAor);
NameAddr contact;
clientDum.send( regMessage );
int n = 0;
while ( !clientHandler.done )
{
stack.process(100);
while(clientDum.process());
if (n == 1000) clientHandler.done = true;
if (!(n++ % 10)) cerr << "|/-\\"[(n/10)%4] << '\b';
}
return 0;
}

1.7.5.1