reSIProcate/stack  9694
Defines | Functions
test503Generator.cxx File Reference
#include <sys/types.h>
#include <iostream>
#include <memory>
#include "rutil/DnsUtil.hxx"
#include "rutil/Inserter.hxx"
#include "rutil/Logger.hxx"
#include "resip/stack/Helper.hxx"
#include "resip/stack/SipMessage.hxx"
#include "resip/stack/SipStack.hxx"
#include "resip/stack/Uri.hxx"
Include dependency graph for test503Generator.cxx:

Go to the source code of this file.

Defines

#define RESIPROCATE_SUBSYSTEM   Subsystem::SIP

Functions

int main (int argc, char *argv[])

Define Documentation

#define RESIPROCATE_SUBSYSTEM   Subsystem::SIP

Definition at line 20 of file test503Generator.cxx.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 24 of file test503Generator.cxx.

References resip::SipStack::addTransport(), resip::Message::brief(), resip::Log::Cout, resip::Log::Info, InfoLog, resip::Log::initialize(), resip::SipMessage::isRequest(), resip::Helper::makeResponse(), resip::SipStack::process(), resip::SipStack::receive(), resip::SipStack::send(), resip::TCP, and resip::UDP.

{
   SipStack stack;

   Log::initialize(Log::Cout, Log::Info ,"test503Generator");   
   
   stack.addTransport(UDP, 5060);
   stack.addTransport(TCP, 5060);

   while(true)
   {
      stack.process(1000);
      SipMessage* msg = stack.receive();
      if (msg && msg->isRequest())
      {
         SipMessage* resp = Helper::makeResponse(*msg, 503);
         stack.send(*resp);
         InfoLog( << "Generated 503 to: " << msg->brief());
         delete resp;
      }
      delete msg;
   }

}

Here is the call graph for this function: