@miconda I found a simple way to get the value of the X-Forwarded-For header without
changing the code in the websocket module.
I thought about this after reading again the comment for Juha.
I'm retrieving the X-Forwarded-For header in the event:xhttp and use htable to track
the conid associated:
```shell
event_route[xhttp:request] {
....
$var(orig_ip) = $hdr(X-Forwarded-For);
if (($var(orig_ip) != $null) && ($var(orig_ip) != "")) {
$sht(ws_src=>$conid) = $var(orig_ip);
xlog("L_INFO", "WebSocket $conid original source ip is
$var(orig_ip)\n");
}
```
And in any context where $conid is available, I can retrieve the value with (in my case to
set xavp attr in the location_attrs table when the phone registers) :
```shell
$var(real_src_ip) = $sht(ws_src=>$conid);
if (($var(real_src_ip) != "") && ($var(real_src_ip) != $null))
{
xavp_params_explode("real_src_ip=$var(real_src_ip)",
"contact_extras");
}
```
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1002#issuecomment-281148921