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

[reSIProcate] outbound proxy


Hi All,

I am in some problem regarding the Outbound Proxy. Can anyone help me how
to configure the outbound proxy.

The request is getting to the Proxy. But the Proxy is not able to send the
request to the destination.

I am attaching the log and the Proxy code also with this.

Thanks in advance,

Regards
Santosh
#include "iostream.h"

#include "resiprocate/Helper.hxx"
#include "resiprocate/SipMessage.hxx"
#include "resiprocate/Uri.hxx"
#include "resiprocate/SipStack.hxx"
#include "resiprocate/DeprecatedDialog.hxx"
#include "resiprocate/os/Logger.hxx"
#include "resiprocate/os/ThreadIf.hxx"
#include "resiprocate/SdpContents.hxx"

using namespace resip;
using namespace std;

class SipProxy
{
	private:
		SipStack sipStack;

	public:
		SipProxy();
		void buildFdSet(FdSet& fdset);
		void process(FdSet& fdset);
		void processRequest( SipMessage* );
		void processResponse( SipMessage* );
};

SipProxy::SipProxy()
{	
	sipStack.addTransport(UDP,5070);
}

void SipProxy::buildFdSet(FdSet& fdset)
{
   	sipStack.buildFdSet(fdset);
}

void SipProxy::process(FdSet& fdset)
{
	sipStack.process(fdset);
	SipMessage *received_message = sipStack.receive();
	if(received_message)
	{
		if(received_message->isRequest())
		{
			processRequest(received_message);
		}
		else
		if(received_message->isResponse())
		{
			processResponse(received_message);
		}
	}
}

void SipProxy::processRequest(SipMessage *request_received)
{
	if( request_received->header(h_RequestLine).method() == INVITE )
	{
		Uri new_uri;
		Uri received_uri = request_received->header(h_RequestLine).uri();
		Data username = received_uri.user();
		Data hostname = received_uri.host();
		if(username=="sipphone" && hostname == "idealabs.com")
		{
			
			request_received->header(h_RequestLine).uri().user() = "192.168.1.10";
			request_received->header(h_RequestLine).uri().host() = "192.168.1.10";
			
			request_received->header(h_RequestLine).uri().port() = 5060;
			//Uri new_uri = Uri("sip:sipphone@xxxxxxxxxxxx");
			//request_received->setForceTarget(new_uri);
		}

		--request_received->header(h_MaxForwards).value();

		Via via;
		via.sentHost() = "192.168.1.201";
		via.sentPort() = 5070;
		via.transport() = "UDP";
		request_received->header(h_Vias).push_back(via);

		cout<<"The New Request is: "<<endl;
		cout<<*request_received;
		sipStack.send(*request_received);
		cout<<"Request Sent";
	}
}

void SipProxy::processResponse(SipMessage *response_received)
{
	sipStack.send(*response_received);
}

int main(int argc, char *argv[])
{
	SipProxy sipProxy;
	while (true)
	{
      		FdSet fdset;
      		sipProxy.buildFdSet(fdset);
      		fdset.selectMilliSeconds(0);
      		sipProxy.process(fdset);
   	}
	return 1;
}
[root@localhost code]# ./proxy

INFO | 20060911-003942.451 |  |  | RESIP:TRANSPORT | 0 | 3086890688 | 
UdpTransport.cxx:30 | Creating UDP transport host= port=5070 ipv4=1

The New Request is:

INVITE sip:192.168.1.10@xxxxxxxxxxxx:5060 SIP/2.0
To: "Idealabs Phone"<sip:sipphone@xxxxxxxxxxxx>
From: "santosh kumar"<sip:santosh@xxxxxxxxxxxx>;tag=6d7d0759
Via: SIP/2.0/UDP 
192.168.1.201:5060;branch=z9hG4bK-d87543-1b7f510ab0d8cc3e-1--d87543-;rport=5060
Via: SIP/2.0/UDP 
192.168.1.201:5070;branch=z9hG4bK-d87543-6cbd4b420fa6932f-1--d87543-;rport
Call-ID: 0125862b173c8c01@bG9jYWxob3N0LmxvY2FsZG9tYWlu
CSeq: 1 INVITE
Contact: <sip:santosh@xxxxxxxxxxxxx:5060>
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 168

v=0
o=administrator 0 0 IN IP4 192.168.1.201
s=-
c=IN IP4 192.168.1.201
t=0 0
m=audio 11000 RTP/AVP 0 3 4 5 6 8 15 18
m=video 11002 RTP/AVP 26 34 31
a=sendrecv

Request Sent

WARNING | 20060911-003944.769 |  |  | RESIP:TRANSPORT | 0 | 3086890688 | 
TransportSelector.cxx:793 | Can't find matching transport [ V4 
192.168.1.201:5060 UDP connectionId=0 ]
INFO | 20060911-003944.769 |  |  | RESIP:TRANSPORT | 0 | 3086890688 | 
TransportSelector.cxx:663 | tid=1b7f510ab0d8cc3e failed to find a transport to 
[ V4 192.168.1.10:5060 UDP connectionId=0 ]
INFO | 20060911-003944.774 |  |  | RESIP:TRANSACTION | 0 | 3086890688 | 
TransactionState.cxx:1273 | Try sending request to a different dns result
INFO | 20060911-003944.774 |  |  | RESIP:TRANSACTION | 0 | 3086890688 | 
TransactionState.cxx:1253 | Ran out of dns entries for 192.168.1.10. Send 503