|
reSIProcate/stack
9694
|
#include <iostream>#include <memory>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>#include "rutil/Socket.hxx"#include "rutil/Logger.hxx"#include "resip/stack/SipStack.hxx"#include "resip/stack/SipMessage.hxx"#include "resip/stack/Uri.hxx"#include "resip/stack/Helper.hxx"#include "resip/stack/Transport.hxx"#include "resip/stack/ParserCategories.hxx"
Go to the source code of this file.
Defines | |
| #define | RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Functions | |
| int | main (int argc, char *argv[]) |
| #define RESIPROCATE_SUBSYSTEM Subsystem::SIP |
Definition at line 24 of file testSipStack1.cxx.
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 27 of file testSipStack1.cxx.
References resip::Log::Cout, resip::Log::Crit, CritLog, resip::Log::Debug, DebugLog, dest, resip::SipMessage::encode(), resip::Uri::host(), resip::Log::Info, InfoLog, resip::Log::initialize(), resip::initNetwork(), resip::Helper::makeInvite(), resip::Uri::port(), resip::SipStack::process(), resip::SipStack::receive(), resipCout, resip::Uri::scheme(), resip::SipStack::send(), resip::Log::Stack, resip::NameAddr::uri(), and resip::Uri::user().
{
Log::Level l = Log::Debug;
if (argc > 1)
{
switch(*argv[1])
{
case 'd': l = Log::Debug;
break;
case 'i': l = Log::Info;
break;
case 's': l = Log::Stack;
break;
case 'c': l = Log::Crit;
break;
}
}
Log::initialize(Log::Cout, l, argv[0]);
CritLog(<<"Test Driver Starting");
initNetwork();
try
{
SipStack sipStack;
SipMessage* msg=NULL;
InfoLog ( << "Try to send a message" );
NameAddr dest;
NameAddr from;
NameAddr contact;
from.uri().scheme() = "sip";
from.uri().user() = "fluffy";
from.uri().host() = "localhost";
from.uri().port() = 5060;
dest = from;
contact = from;
auto_ptr<SipMessage> message = auto_ptr<SipMessage>(Helper::makeInvite( dest, from, contact));
DebugLog ( << "Sending msg:" << *message );
sipStack.send( *message );
while (1)
{
//DebugLog ( << "Try TO PROCESS " );
sipStack.process(25);
//DebugLog ( << "Try TO receive " );
msg = sipStack.receive();
if ( msg )
{
DebugLog ( << "got message: " << *msg);
msg->encode(resipCout);
}
}
}
catch (Transport::Exception& e)
{
InfoLog (<< "Failed to create sip stack" << e);
exit(-1);
}
return 0;
}

1.7.5.1