Thank you for your reply. I tried what you suggested.

The problem is when there are multiple locations/registrations per AOR on different ports and doing parallel forking.
Accessing $fs only gives one of the sockets (first or last?), not all of them.
Accessing $sndfrom gives all of the used outgoing sockets, because it's populated in the onsedn_route route, which is called for every outgoing packet, but in onsend_route I can't use record_route functions, neither mangle with the SIP header anymore in any way. It's too late by the time I get to onsend_route...

No solution so far..


Reda



On Tue, Jan 17, 2012 at 21:47, Ovidiu Sas <osas@voipembedded.com> wrote:
When you route through usrloc, there is a PV that should be set - forced socket:
http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#forced_socket
You can check the socket via 'kamctl ul show' command.
If the PV is not populated, check the send attributes:
http://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#send_address_attributes
Based on that, you should know through which interface the INVITE
should be sent and therefore you should be able to set the proper
Record-Route header.

Regards,
Ovidiu Sas

--
VoIP Embedded, Inc.
http://www.voipembedded.com


On Tue, Jan 17, 2012 at 3:01 PM, Reda Aouad <reda.aouad@gmail.com> wrote:
> I just tried the record_route_advertised_address("public_ip").
> It doesn't add the port number of the outgoing socket.
>
> Any suggestions?
>
> RA
>
>
>
> On Mon, Jan 16, 2012 at 15:57, Reda Aouad <reda.aouad@gmail.com> wrote:
>>
>> I know about record_route_advertised_address("ip:port") function. If I
>> understood correctly, it inserts a top-most RR header with the public IP if
>> double RR is enabled. But that doesn't solve the multiple ports problem. I
>> would get in the SIP header :
>>
>> Record-Route: <public_ip;lr=on>
>> Record-Route: <private_ip:port;lr=on>
>>
>> If user B sees the first Record-Route header, it remembers port=5060 for
>> future requests.
>> I cannot manually set the port in the config file since it depends on
>> which port user B is registered, which I don't have a way to find it.
>>
>> RA
>>
>>
>>
>> On Mon, Jan 16, 2012 at 15:51, Andrew Pogrebennyk
>> <apogrebennyk@sipwise.com> wrote:
>>>
>>> Hi,
>>>
>>> On 01/16/2012 03:41 PM, Reda Aouad wrote:
>>> > I suggest that the function record_route( ) takes a public IP address
>>> > as
>>> > a parameter, still doing what it does (correct record routing and
>>> > cookie
>>> > addition did=xxx and loose route lr=on), but only replacing the private
>>> > IP address on which Kamailio listens with a public IP address. Or that
>>> > the record_route( ) function uses the advertised_address to construct
>>> > the RR header.
>>>
>>> maybe you are looking for the function record_route_advertised_address()
>>> which is available in git master:
>>> http://web.archiveorange.com/archive/v/jZFTGE0yjPqCTTcAkzuf
>>>

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users