You could move the test on INVITE and call to use_media_proxy(); until you have reached
the sections routing to and from the gateway. Of course, calls from the gw could be
tested using if (src_ip == ip_address_of_gw).
Anyway, the idea would be to wait with the call to use_media_proxy until you are sure that
these calls are from/to the gateway.
Please remember that all incoming calls to UAs behind symmetric NAT and some combinations
with UAs behind port-restricted NAT need to be proxied. If you only proxy gw calls, some
ip-to-ip calls will fail.
g-)
---- Original Message ----
From: Mohamed Omar
To: serusers(a)lists.iptel.org
Sent: Monday, December 20, 2004 02:41 AM
Subject: [Serusers] NAT & Madia Proxy.
I'm currently run ser with media proxy and it
working fine if I force
all calls throught the the media proxy...
I want only calls destine to PSTN gateway to go through the media
proxy for billing purpose and all other calls, I just want to fix the
NAT and setup the call. I dont want the media to go throught my
server if it not destine to PSTN network.
Let me know how my config should be...Am new with SER and am stuck on
this. below is my configure for NAT.
Thanks in Advance.
# -- nat ping --
modparam("mediaproxy", "natping_interval", 10)
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/mediaproxy.sock")
# ------------------------- request routing logic -------------------
# main routing logic
record_route();
# loose-route processing
if (loose_route()) {
t_relay();
break;
};
# -- nat code --
if (method == "BYE" || method == "CANCEL") {
end_media_session();
};
if (client_nat_test("3")) {
if (method == "REGISTER" || !
search("^Record-Route:")) {
fix_contact();
force_rport();
};
};
if (method=="INVITE") {
use_media_proxy();
t_on_reply("1");
setflag(6);
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
if (method=="REGISTER") {
save("location");
break;
};
# setflag(1);
# native SIP destinations are handled using our
USRLOC DB
if (!lookup("location")) {
log (1, "********************** Rewriting the host:port
***********************************");
rewritehostport ("PSTN Gateway Ip:5060");
};
};
if (method == "INVITE"){
t_relay();
sl_send_reply ("180", "Ringing");
break;
}
if (!t_relay()) {
sl_send_reply("404", "Not Found");
break;
};
# -- nat code ----
}
onreply_route[1] {
if (status=~"(183)|2[0-9][0-9]") {
if (client_nat_test("1")) {
fix_contact();
};
use_media_proxy();
};
if (status=~"[3-4]0[0-9]") {
end_media_session();
break;
};
}
Post your free ad now! Yahoo! Canada Personals
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers