C?dric, I think I got the answer for your old question. How did you add Route Header into pjsip_msg? After pjsip_endpt_create_request(), I used pjsip_generic_string_hdr_create() to create a hdr for route and add it into tdata->msg. Yes, sip message sent by pjsip has correct Route Header. But pjsip_process_route_set() can't get this when counting target because pjsip_msg_find_hdr() is used PJSIP_H_ROUTE to lookup. So I think you made the same mistake. The code of pjsip is ok. regards, Gang On Fri, Feb 27, 2009 at 3:58 PM, Gang Liu <gangban.lau at gmail.com> wrote: > sorry, I make a mistake. Ignore it. > > regards, > Gang > > On Fri, Feb 27, 2009 at 3:06 PM, Gang Liu <gangban.lau at gmail.com> wrote: >> >> Hi benny, >> ??? When I try pjsip_endpt_send_request_stateless() function today, I >> got the same issue which >> C?dric. reported before. >> >> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-November/005565.html >> >> ? pjsip_process_route_set() function select request URI as target >> when topmostRoute is loose route.But It should be URI from >> topmostRoute. After change below code to use topmost_route_uri, the >> trarget is correct. >> ... >> ? ? ? ?if (has_lr_param) { >> ? ? ? ? ? ?new_request_uri = tdata->msg->line.req.uri; >> ? ? ? ? ? ?^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> ? ? ? ? ? ?/* We shouldn't need to delete topmost Route if it has lr >> param. >> ? ? ? ? ? ? * But seems like it breaks some proxy implementation, so we >> ? ? ? ? ? ? * delete it anyway. >> ? ? ? ? ? ? */ >> ? ? ? ? ? ?/* >> ? ? ? ? ? ?pj_list_erase(first_route_hdr); >> ? ? ? ? ? ?if (first_route_hdr == last_route_hdr) >> ? ? ? ? ? ? ? ?last_route_hdr = NULL; >> ? ? ? ? ? ?*/ >> ? ? ? ?} else { >> ? ? ? ? ? ?new_request_uri = (const pjsip_uri*) >> ... >> >> regards, >> Gang > >