[Devel] [PATCH] mediaproxy module and src-ip AVP

Andreas Granig andreas.granig at inode.info
Wed Apr 26 14:13:32 CEST 2006


Hi,

I ran into a problem with mediaproxy and a load-balanced system setup. 
use_media_proxy() on a backend-proxy passes the src-ip of the request, 
which is the address of the load-balancer, to the proxy dispatcher, so 
media relaying then does not work.

Thus I've written a small patch for the mediaproxy module which allows 
you to write an IP address to an AVP which is then used as src-ip by 
use_media_proxy().  If the AVP isn't set, the IP gathered by the 
transport layer is used.

Here's an example of its usage.

On the load-balancer:

route[0] {
   ...
   if( /* request is from UAC */) {
     append_hf("P-Src-Ip: $si\r\n");
   }
   ...
}
reply_route[1] {
   ...
   if( /* response is from UAC */) {
     append_hf("P-Src-Ip: $si\r\n");
   }
   ...
}


And on the backend-proxy controlling the mediaproxy:

...
modparam("mediaproxy", "src_ip_avp", "i:100")
...

route[0] {
   ...
   route(1);
   use_media_proxy();
   ...
}

route[1] {
   avp_delete("$avp(i:100)");
   if(is_present_hf("P-Src-Ip")) {
     avp_write("$hdr(P-Src-Ip)", "$avp(i:100)");
     remove_hf("P-Src-Ip");
   }
}

reply_route[1] {
   ...
   route(1);
   use_media_proxy();
   ...
}


If this feature is also helpful for others, I'll post it on the 
sourceforge tracker.

Cheers,
Andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mediaproxy-avp.diff
Type: text/x-patch
Size: 3893 bytes
Desc: not available
Url : http://openser.org/pipermail/devel/attachments/20060426/830885bf/mediaproxy-avp.bin


More information about the Devel mailing list