You can send the info you need to Asterisk using X headers, for example:

Kamailio has the pseudo variable $si which contains the public IP originating the request and you can send that to Asterisk using append_hf.

  append_hf("X-orig-IP: $si");


In Asterisk you can access the headers as ${SIP_HEADER(X-orig-IP)}


On Sat, Dec 27, 2014 at 7:00 PM, Cibin Paul <paul_cibin@me.com> wrote:
Hey,  thanks for looking into this. Phones register with kamailio and I have configured kamailio to load balance the asterisk servers using round robin algorithm. Phones registered in kamailio will directly send the call to the asterisk servers. From there I will send the call out using other routes.

In the contact field of the sip header, I get the username@private ip instead of the public ip. I need it in the format username@public ip

> On 27-Dec-2014, at 3:26 pm, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
>
> Hello,
>
> I am not that familiar with asterisk to know all the insides SIPURI and
> SIPCHANNEL(recvip), you have to explain which fields you need from the
> SIP packet in order to be able to assist further, unless someone else
> more familiar with asterisk can jump in.
>
> Also, it is not clear how the flow is there, you say you have kamailio
> behind asterisk servers, does that mean the phone is sending to asterisk
> first, which then forwards to kamailio?
>
> Cheers,
> Daniel
>
>> On 26/12/14 18:37, Cibin Paul wrote:
>> Hi,
>>
>> I have a kamailio 4.1 as a gateway  and registrar behind asterisk servers. On asterisk, I save the IP address of the originating call parsing the SIPURI or SIPCHANNEL(recvip). In both cases, I am receiving the private ip of the user agent registered with kamailio. Do I need to change anything in kamailio to receive the actual IP address. Please suggest.
>>
>> Regards
>> Cibin
>>
>>
>> _______________________________________________
>> 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
>
> --
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
> _______________________________________________
> 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

_______________________________________________
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