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

mayamatakeshi mayamatakeshi at gmail.com
Wed Aug 12 22:13:06 EDT 2009


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;
}




More information about the pjsip mailing list