<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi<br>
<br>
I've been anticipating to setup Mediaproxy for more then a week
now without any success.<br>
I've used the following resources as guidelines, but still can't
figure out what I'm doing wrong or missing:<br>
<a class="moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/devel/mediaproxy.html">http://www.opensips.org/html/docs/modules/devel/mediaproxy.html</a><br>
<a class="moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/devel/nathelper.html">http://www.opensips.org/html/docs/modules/devel/nathelper.html</a><br>
<a class="moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/devel/usrloc.html">http://www.opensips.org/html/docs/modules/devel/usrloc.html</a><br>
<a class="moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/devel/mi_datagram.html">http://www.opensips.org/html/docs/modules/devel/mi_datagram.html</a><br>
<a class="moz-txt-link-freetext"
href="http://www.opensips.org/html/docs/modules/devel/dialog.html">http://www.opensips.org/html/docs/modules/devel/dialog.html</a><br>
<a class="moz-txt-link-freetext"
href="http://voiprookie.blogspot.com/2009/04/blog-post.html">http://voiprookie.blogspot.com/2009/04/blog-post.html</a><br>
mailing-list: [OpenSIPS-Users] Mediaproxy broken<br>
<br>
I use Counterpath softphone clients for my testing.<br>
One on my MacBookPro and other within Windows XP VirtualBox
Machine on same Mac.<br>
I have the Mac Firewall turned off.<br>
<br>
I can setup call from Windows Client to Mac Client, but when I
answer call on Mac the call gets dropped immediately, but Windows
client still says calling until it times out and 408 give error.<br>
<br>
I can't setup call from Mac client to Windows Client. It tries
calling but after a while the client returns with "Can't Connect"
without ringing on Windows Client.<br>
<br>
I've played around with the client Topology configurations on the
and the only setting that gives some light is "use local IP", and
this only on Mac Client.<br>
The only result I get is Mac Client rings when I call from Windows
Client, but then drops call immediately when answer.<br>
<br>
What I am looking to achieve is as follows:<br>
1. Media Proxy only be used when Devices are behind NAT.<br>
2. Not use MediaProxy for media when devices are behind the same
Firewall. i.e. 192.168.0.2@branchA calls 192.168.3.60@branchB<br>
3. I am very interested in the ICE feature and would really like
to get that working. I guess this will resolve requirement 2?<br>
<br>
Here is my configurations to show what I currently have:<br>
<br>
opensips.cfg<br>
<br>
loadmodule "dialog.so"<br>
loadmodule "mediaproxy.so"<br>
loadmodule "nathelper.so"<br>
loadmodule "mi_datagram.so"<br>
<br>
<br>
# ----- usrloc params -----<br>
#modparam("usrloc", "db_mode", 0)<br>
/* uncomment the following lines if you want to enable DB
persistency<br>
for location entries */<br>
modparam("usrloc", "db_mode", 2)<br>
modparam("usrloc", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips")<br>
modparam("usrloc", "nat_bflag", 3)<br>
<br>
# ----- dialog params ----- #<br>
modparam("dialog", "dlg_flag", 13)<br>
modparam("dialog", "db_mode", 3)<br>
<br>
<br>
# ----- nethelper ----- #<br>
modparam("nathelper", "natping_interval", 10)<br>
modparam("nathelper", "ping_nated_only", 1)<br>
<br>
<br>
# ----- mediaproxy params ---- #<br>
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/mediaproxy-dispatcher.sock")<br>
modparam("mediaproxy", "mediaproxy_timeout", 500)<br>
modparam("mediaproxy", "signaling_ip_avp", "$avp(s:nat_ip)")<br>
modparam("mediaproxy", "media_relay_avp", "$avp(s:media_relay)")<br>
modparam("mediaproxy", "ice_candidate", "low-priority")<br>
modparam("mediaproxy", "ice_candidate_avp",
"$avp(s:ice_candidate)")<br>
<br>
<br>
# ----- mi_datagram params ----- #<br>
modparam("mi_datagram", "socket_name",
"/var/run/opensips/opensips.sock")<br>
modparam("mi_datagram", "children_count", 4)<br>
<br>
<br>
####### Routing Logic ########<br>
<br>
<br>
# main request routing logic<br>
<br>
route{<br>
<br>
if (!mf_process_maxfwd_header("10")) {<br>
sl_send_reply("483","Too Many Hops");<br>
exit;<br>
}<br>
<br>
if (method==INVITE && !has_totag()) {<br>
# We can also use a specific media relay if we need to<br>
#$avp(s:media_relay) = "1.2.3.4";<br>
use_media_proxy();<br>
fix_nated_sdp("8","ip_of_this_server"); # topology
hide the sdp o header.<br>
}<br>
<br>
<br>
if (has_totag()) {<br>
# sequential request withing a dialog should<br>
# take the path determined by record-routing<br>
if (loose_route()) {<br>
if (is_method("BYE")) {<br>
setflag(1); # do accounting ...<br>
setflag(3); # ... even if the
transaction fails<br>
} else if (is_method("INVITE")) {<br>
# even if in most of the cases is
useless, do RR for<br>
# re-INVITEs alos, as some buggy
clients do change route set<br>
# during the dialog.<br>
record_route();<br>
}<br>
# route it out to whatever destination was
set by loose_route()<br>
# in $du (destination URI).<br>
route(1);<br>
} else {<br>
/* uncomment the following lines if you
want to enable presence */<br>
##if (is_method("SUBSCRIBE") &&
$rd == "localhost)<br>
## # in-dialog subscribe requests<br>
## route(2);<br>
## exit;<br>
##}<br>
if ( is_method("ACK") ) {<br>
if ( t_check_trans() ) {<br>
# non loose-route, but
stateful ACK; must be an ACK after<br>
# a 487 or e.g. 404 from
upstream server<br>
t_relay();<br>
exit;<br>
} else {<br>
# ACK without matching
transaction -><br>
# ignore and discard<br>
exit;<br>
}<br>
}<br>
sl_send_reply("404","Not here");<br>
}<br>
exit;<br>
}<br>
<br>
#initial requests<br>
<br>
# BYE processing<br>
if (method==BYE) {<br>
end_media_session();<br>
}<br>
<br>
# CANCEL processing<br>
if (is_method("CANCEL"))<br>
{<br>
if (t_check_trans())<br>
t_relay();<br>
exit;<br>
}<br>
<br>
t_check_trans();<br>
<br>
# authenticate if from local subscriber (uncomment to
enable auth)<br>
# authenticate all initial non-REGISTER request that
pretend to be<br>
# generated by local subscriber (domain from FROM URI is
local)<br>
#if (!(method=="REGISTER") && from_uri==myself)
/*no multidomain version*/<br>
if (!(method=="REGISTER") && is_from_local())
/*multidomain version*/<br>
{<br>
if (!proxy_authorize("", "subscriber")) {<br>
proxy_challenge("", "1");<br>
exit;<br>
}<br>
if (!db_check_from()) {<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
<br>
consume_credentials();<br>
# caller authenticated<br>
}<br>
<br>
# preloaded route checking<br>
if (loose_route()) {<br>
xlog("L_ERR",<br>
"Attempt to route with preloaded Route's
[$fu/$tu/$ru/$ci]");<br>
if (!is_method("ACK"))<br>
sl_send_reply("403","Preload Route
denied");<br>
exit;<br>
}<br>
<br>
# record routing<br>
if (!is_method("REGISTER|MESSAGE"))<br>
record_route();<br>
<br>
# account only INVITEs<br>
if (is_method("INVITE")) {<br>
setflag(1); # do accounting<br>
}<br>
##if (!uri==myself)<br>
## replace with following line if multi-domain support is
used<br>
if (!is_uri_host_local())<br>
{<br>
append_hf("P-hint: outbound\r\n");<br>
# if you have some interdomain connections via TLS<br>
##if($rd=="tls_domain1.net") {<br>
## t_relay("tls:domain1.net");<br>
## exit;<br>
##} else if($rd=="tls_domain2.net") {<br>
## t_relay("tls:domain2.net");<br>
## exit;<br>
##}<br>
if(is_from_local()) {<br>
route(1);<br>
} else {<br>
sl_send_reply("403","Not here");<br>
}<br>
}<br>
<br>
# requests for my domain<br>
<br>
## uncomment this if you want to enable presence server<br>
## and comment the next 'if' block<br>
## NOTE: uncomment also the definition of route[2] from
below<br>
##if( is_method("PUBLISH|SUBSCRIBE")) {<br>
## route(2);<br>
<br>
if (is_method("PUBLISH"))<br>
{<br>
sl_send_reply("503", "Service Unavailable");<br>
exit;<br>
}<br>
<br>
if (is_method("REGISTER"))<br>
{<br>
# authenticate the REGISTER requests (uncomment to
enable auth)<br>
if (!www_authorize("", "subscriber"))<br>
{<br>
www_challenge("", "1");<br>
exit;<br>
}<br>
if (!db_check_to())<br>
{<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
if (!save("location"))<br>
sl_reply_error();<br>
exit;<br>
}<br>
<br>
if ($rU==NULL) {<br>
# request with no Username in RURI<br>
sl_send_reply("484","Address Incomplete");<br>
exit;<br>
}<br>
<br>
# apply DB based aliases (uncomment to enable)<br>
alias_db_lookup("dbaliases");<br>
<br>
# do lookup with method filtering<br>
if (!lookup("location","m")) {<br>
switch ($retcode) {<br>
case -1:<br>
case -3:<br>
t_newtran();<br>
t_reply("404", "Not Found");<br>
exit;<br>
case -2:<br>
sl_send_reply("405", "Method Not
Allowed");<br>
exit;<br>
}<br>
}<br>
<br>
# when routing via usrloc, log the missed calls also<br>
setflag(2);<br>
<br>
route(1);<br>
}<br>
<br>
<br>
route[1] {<br>
# for INVITEs enable some additional helper routes<br>
if (is_method("INVITE")) {<br>
t_on_branch("2");<br>
t_on_reply("2");<br>
t_on_failure("1");<br>
}<br>
<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
}<br>
<br>
<br>
branch_route[2] {<br>
xlog("new branch at $ru\n");<br>
}<br>
<br>
<br>
onreply_route[2] {<br>
xlog("incoming reply\n");<br>
}<br>
<br>
<br>
failure_route[1] {<br>
if (t_was_cancelled()) {<br>
exit;<br>
}<br>
}<br>
<br>
/etc/mediaproxy/config.ini<br>
[Relay]<br>
dispatchers = ip_of_this_server:25060<br>
relay_ip = </font><font face="Helvetica, Arial, sans-serif">ip_of_this_server</font><font
face="Helvetica, Arial, sans-serif"><br>
port_range = 50000:60000<br>
log_level = DEBUG<br>
on_hold_timeout = 1800<br>
<br>
[Dispatcher]<br>
socket_path = /var/run/mediaproxy-dispatcher.sock<br>
listen = </font><font face="Helvetica, Arial, sans-serif">ip_of_this_server</font><font
face="Helvetica, Arial, sans-serif">:25060<br>
listen_management = </font><font face="Helvetica, Arial,
sans-serif">ip_of_this_server</font><font face="Helvetica, Arial,
sans-serif">:25061<br>
management_use_tls = no<br>
<br>
[OpenSIPS]<br>
socket_path = /var/run/opensips/opensips.sock<br>
<br>
<br>
Thank you very much<br>
<br>
Regards<br>
Deon</font>
</body>
</html>