Hello,
Sorry for a novice question and equally sorry if it is already answered elsewhere.
I have an OpenSER setup with Mediaproxy in same box. I am including the configuration at the bottom. My question is does ALL media traffic (even the media traffic between non NAT'ed clinets, and media traffic between NAT'ed clients where both-way media traffic works perfectly fine without a media proxy) passes through Mediaproxy dispatcher/server? Or only the media traffic between (troubled) NAT'ed clients are passed through MediaProxy server?
My goal is to have the OpenSER to provide registration where the actual calls will be routed through an external Asterisk server. I do not want media traffic passing through Mediaproxy unless I have a NAT related media problems with a certain client. But apparently current set up is forcing all media traffic to pass through the Mediaproxy server.
Any advise or suggestion will be greatly appreciated.
modparam("nathelper", "natping_interval", 0) modparam("mediaproxy","natping_interval", 30 modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock" modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients") modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")
modparam("registrar", "nat_flag", 6)
route { # ----------------------------------------------------------------- # Record Route Section # ----------------------------------------------------------------- if (method=="INVITE" && client_nat_test("3")) { # INSERT YOUR IP ADDRESS HERE record_route_preset("192.0.2.13:5060;nat=yes"); } else if (method!="REGISTER") { record_route(); };
# ----------------------------------------------------------------- # Call Tear Down Section # ----------------------------------------------------------------- if (method=="BYE" || method=="CANCEL") { end_media_session(); };
# ----------------------------------------------------------------- # Loose Route Section # ----------------------------------------------------------------- if (loose_route()) {
if ((method=="INVITE" || method=="REFER") && !has_totag()) { sl_send_reply("403", "Forbidden"); break; };
if (method=="INVITE") {
if (!proxy_authorize("","subscriber")) { proxy_challenge("","0"); break; } else if (!check_from()) { sl_send_reply("403", "Use From=ID"); break; };
consume_credentials();
if (client_nat_test("3") || search("^Route:.*;nat=yes")) { setflag(6) use_media_proxy(); }; };
route(1); break; };
# ----------------------------------------------------------------- # Call Type Processing Section # ----------------------------------------------------------------- if (uri!=myself) { route(4); route(1); break; };
if (method=="ACK") { route(1); break; else if (method=="CANCEL") { route(1); break; } else if (method=="INVITE") { route(3); break; } else if (method=="REGISTER") { route(2); break; };
lookup("aliases"); if (uri!=myself) { route(4); route(1); break; };
if (!lookup("location")) { sl_send_reply("404", "User Not Found"); break; };
route(1); }
route[1] {
# ----------------------------------------------------------------- # Default Message Handler # -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method="INVITE" || method=="ACK") { end_media_session(); };
sl_reply_error(); }; }
route[2] {
# ----------------------------------------------------------------- # REGISTER Message Handler # ----------------------------------------------------------------
sl_send_reply("100", "Trying");
if (!search("^Contact:[ ]**") && client_nat_test("7")) { setflag(6); fix_nated_register(); force_rport(); };
if (!www_authorize("","subscriber")) { www_challenge("","0"); break; };
if (!check_to()) { sl_send_reply("401", "Unauthorized"); break; };
consume_credentials();
if (!save("location")) { sl_reply_error(); }; }
route[3] {
# ----------------------------------------------------------------- # INVITE Message Handler # -----------------------------------------------------------------
if (client_nat_test("3")) { setflag(7); force_rport(); fix_nated_contact(); };
if (!proxy_authorize("","subscriber")) { proxy_challenge("","0"); break; } else if (!check_from()) { sl_send_reply("403", "Use From=ID"); break; };
consume_credentials();
lookup("aliases"); if (uri!=myself) { route(4); route(1); break; };
if (!lookup("location")) { sl_send_reply("404", "User Not Found"); break; };
route(4); route(1); }
route[4] {
# ----------------------------------------------------------------- # NAT Traversal Section # -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) { if (!isflagset(8)) { setflag(8); use_media_proxy(); }; }; }
onreply_route[1] {
if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:[ ]*0")) { use_media_proxy(); }; };
if (client_nat_test("1")) { fix_nated_contact(); }; }
El Thursday 24 April 2008 09:41:58 Ash Rah escribió:
My goal is to have the OpenSER to provide registration where the actual calls will be routed through an external Asterisk server. I do not want media traffic passing through Mediaproxy unless I have a NAT related media problems with a certain client. But apparently current set up is forcing all media traffic to pass through the Mediaproxy server.
So you need to, manually, improve your OpenSe script just to force MediaProxy if the caller or called is behind NAT.
I thought the script I am using takes care of that already. Any suggestion what I am doing wrong in my script.
Thanks.
if (client_nat_test("3") || search("^Route:.*;nat=yes")) { setflag(6); use_media_proxy(); };
Iñaki Baz Castillo wrote:
El Thursday 24 April 2008 09:41:58 Ash Rah escribió:
My goal is to have the OpenSER to provide registration where the actual calls will be routed through an external Asterisk server. I do not want media traffic passing through Mediaproxy unless I have a NAT related media problems with a certain client. But apparently current set up is forcing all media traffic to pass through the Mediaproxy server.
So you need to, manually, improve your OpenSe script just to force MediaProxy if the caller or called is behind NAT.
El Thursday 24 April 2008 10:13:20 Ash Rah escribió:
I thought the script I am using takes care of that already. Any suggestion what I am doing wrong in my script.
Thanks.
if (client_nat_test("3") || search("^Route:.*;nat=yes")) { setflag(6); use_media_proxy(); };
No idea, add "xlog" to test it:
if (client_nat_test("3") || search("^Route:.*;nat=yes")) { xlog("L_INFO", "--------- Enabling MediaProxy -----------\n"); setflag(6); use_media_proxy(); };