Interesting question: How to make a message be sent to a specific IP/Port, even if the Request URI has an UNRESOLVABLE domain name?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The required functionality is: create a pjsip_tx_data; send this data to a specific IP/port.  The creation of pjsip_tx_data is easy.  Sending this to a specific IP/port is the one that seems to be tough.

This seems a trivial enough functionality, that I am confident Benny and our team would have created a function to do this.  It doesn't look like this functionality is visible for my eye, and that makes it all the more interesting (and curious) to find out how to do it.

I am wondering that there should be a very simple code using something similar to: pjsip_endpt_send_request.

For your response, Maya:
This is a good code sample when we are using a dialog.  The load generator I have is sending the SIP: "MESSAGE" outside of any dialog.  I am currently going through the inner workings of the pjsip_dlg_set_route_set to see if there is anything I could do better.  In the message that I am sending, I definitely see the route header with the correct destination IP address and the port:
Route: <sip:10.8.39.25:5061;lr>\r\n.  But, it does not seem to be getting used during the sending procedure.

If there are any other viable options, I would be happy and excited to try them out.
Bala


-----Original Message-----
From: pjsip-bounces@xxxxxxxxxxxxxxx [mailto:pjsip-bounces at lists.pjsip.org] On Behalf Of mayamatakeshi
Sent: Wednesday, August 12, 2009 7:13 PM
To: pjsip list
Cc: Gallardo, Gabriel
Subject: Re: Interesting question: How to make a message be sent to a specific IP/Port, even if the Request URI has an UNRESOLVABLE domain name?

On Thu, Aug 13, 2009 at 9:01 AM, Muthusamy,
Balamurugan<bmuthusa at qualcomm.com> wrote:
> Adding it with the router header does not work. ?It might be because I am sending it as a UAC transaction, which possibly ignores the route header?
>
> Klaus, when you say you had not tried it with pjsip API, have you done similar thing in a PJ SUA API? ?If so, could you point me out to a sample of that? ?I can go through and construct what is happening, in order to solve this issue.
>
> Fundamentally there should be an easy way to set a requestURI to a specific value, yet have the message sent to a specified IP/Port combination. ?This I believe would already have been implemented by PJSIP, and if there is any pointers on how to do this, I would be grateful for the big help.



I think you should not just add a Route header but set a route set for
the dialog calling pjsip_dlg_set_route_set.

When I need to send a request through a proxy, I use code like this:

bool set_proxy(pjsip_dialog *dlg, const char *proxy_uri) {

	pj_status_t status;
	
	if(!proxy_uri || !proxy_uri[0]) return true; //nothing to do
proxy_uri was not set

	//proxy_uri must contain ";lr".
	char *buf = (char*)pj_pool_zalloc(dlg->pool, 500);
	strcpy(buf,proxy_uri);
	if(!strstr(proxy_uri,";lr")){
		strcat(buf,";lr");
	}	


	pj_list_init(&route_set);

	route = (pjsip_route_hdr*)pjsip_parse_hdr( dlg->pool, &hname,
				 (char*)buf, strlen(buf),
				 NULL);
	if(!route){
		return false;
	}

	pj_list_push_back(&route_set, route);

	pjsip_dlg_set_route_set(dlg, &route_set);

	return true;
}

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux