[pjsip] Outbound proxy

Benny Prijono bennylp at pjsip.org
Thu Nov 29 06:27:05 EST 2007


Gergely Kovacs wrote:
> Hi,
> 
> I'd like to make pjsip-perf send INVITE message with "From:
> alice at atlanta.com", "To: bob at boston.com" headers and "bob at boston.com"
> RURI to an outbound proxy specified by an IP address.
> 
> 
>     pj_str_t proxy = {"sip:root at bug.sip-server.net", 27 };
> 
>     status = pjsip_dlg_create_uac( pjsip_ua_instance(),
>                    &from,    /* local URI      app.local_uri  */
>                    &app.local_contact,    /* local Contact    */
>                    dst_uri,        /* remote URI        */
>                    &proxy,        /* remote target    */
>                    &dlg);        /* dialog        */
> 
> If I change remote target parameter of pjsip_dlg_create_uac function to
> the address of proxy then the message will be sent to proxy correctly,
> but the RURI is changed to the  address of proxy. If I use the
> destination URI as remote target then PJSIP tries to resolve the domain
> of destination URI which fails because it can't be found in DNS.
> 
> I had a look at the source and I've not found any solution for this
> problem at pjsip level. (I found that pjsip_transport_send() has a
> Destination address parameter but I'd prefer pjsip_inv_send_msg())
> 
> How could I send message to an outbound proxy?
> 

Hi Gergely,

the way to do this would be to set the route set for the dialog, 
using something like:

{
   pjsip_route_header route_set, *route;
   pj_str_t hname = pj_str("Route");
   pj_str_t proxy = pj_str("sip:root at bug.sip-server.net");

   pj_list_init(&route_set);
   route = pjsip_parse_hdr(dlg->pool, &hname, proxy.ptr,
                           proxy.slen, NULL);
   pj_list_push_back(&route_set, route);

   pjsip_dlg_set_route_set(dlg, &route_set);
}

cheers,
  -benny






More information about the pjsip mailing list