<p dir="ltr">Hi Michele!</p>
<p dir="ltr">Is your rtpproxy running on bridge mode?<br>
</p>
<div class="gmail_quote">Em 18/10/2013 10:02, "Michele Pinassi" <<a href="mailto:michele.pinassi@unisi.it">michele.pinassi@unisi.it</a>> escreveu:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
i have Opensips on a server with two interfaces, PUBLIC and PRIVATE<br>
(172.20.x.x).<br>
<br>
This is my opensips.cfg:<br>
<br>
####### Routing Logic ########<br>
route {<br>
force_rport();<br>
<br>
if (is_method("INVITE")) {<br>
if (!get_source_group("$var(group)") ) {<br>
$var(group) = 3; /* Default value */<br>
}<br>
<br>
# User group:<br>
# 1 = Internal VoIP subnet 172.20<br>
# 2 = External VoIP subnet but inside Unisi context 172.16 | 10.0.0<br>
# 3 = Outside/foreign (not allowed)<br>
<br>
xlog("L_INFO", "User group is $var(group) [$fd/$fu/$rd/$ru/$si]\n");<br>
<br>
if ($var(group) == 2) { # Outside VoIP LAN<br>
if (is_method("REGISTER")) {<br>
fix_nated_register();<br>
setbflag(NAT);<br>
} else {<br>
fix_nated_contact();<br>
setflag(NAT);<br>
}<br>
}<br>
}<br>
<br>
if (!mf_process_maxfwd_header("10")) {<br>
sl_send_reply("483","Too Many Hops");<br>
exit;<br>
}<br>
<br>
# Verifica che l'IP provenga da una rete abilitata (address table)<br>
if (!check_address("0","$si","$sp","$proto")) {<br>
xlog("L_INFO","IP $si Forbidden");<br>
sl_send_reply("403", "Forbidden");<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>
<br>
# validate the sequential request against dialog<br>
if ( $DLG_status!=NULL && !validate_dialog() ) {<br>
xlog("In-Dialog $rm from $si (callid=$ci) is not valid<br>
according to dialog\n");<br>
## exit;<br>
}<br>
<br>
if (is_method("BYE")) {<br>
setflag(ACC_DO); # do accounting ...<br>
setflag(ACC_FAILED); # ... 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>
<br>
if (check_route_param("nat=yes"))<br>
setflag(NAT);<br>
<br>
# route it out to whatever destination was set by loose_route()<br>
# in $du (destination URI).<br>
route(relay);<br>
} else {<br>
if (is_method("SUBSCRIBE") && $rd == "<a href="http://127.0.0.1:5060" target="_blank">127.0.0.1:5060</a>") { #<br>
CUSTOMIZE ME<br>
# in-dialog subscribe requests<br>
route(handle_presence);<br>
exit;<br>
}<br>
if ( is_method("ACK") ) {<br>
if ( t_check_trans() ) {<br>
# non loose-route, but stateful ACK; must be an ACK<br>
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>
# 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>
if ( !(is_method("REGISTER") || is_from_gw() ) ) {<br>
if (is_from_local()) {<br>
if (!proxy_authorize("", "subscriber")) {<br>
proxy_challenge("", "0");<br>
exit;<br>
}<br>
if (!db_check_from()) {<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
<br>
consume_credentials();<br>
} else {<br>
if (!is_uri_host_local()) {<br>
send_reply("403","Rely forbidden");<br>
exit;<br>
}<br>
}<br>
<br>
}<br>
<br>
# preloaded route checking<br>
if (loose_route()) {<br>
xlog("L_ERR", "Attempt to route with preloaded Route's<br>
[$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>
# create dialog with timeout<br>
if ( !create_dialog("B") ) {<br>
send_reply("500","Internal Server Error");<br>
exit;<br>
}<br>
<br>
setflag(ACC_DO); # do accounting<br>
}<br>
<br>
<br>
if (!is_uri_host_local()) {<br>
append_hf("P-hint: outbound\r\n");<br>
<br>
route(relay);<br>
}<br>
<br>
# requests for my domain<br>
<br>
if( is_method("PUBLISH|SUBSCRIBE"))<br>
route(handle_presence);<br>
<br>
if (is_method("REGISTER"))<br>
{<br>
<br>
# authenticate the REGISTER requests<br>
if (!www_authorize("", "subscriber"))<br>
{<br>
www_challenge("", "0");<br>
exit;<br>
}<br>
<br>
if (!db_check_to())<br>
{<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
<br>
if ( 0 ) setflag(TCP_PERSISTENT);<br>
<br>
if (!save("location"))<br>
sl_reply_error();<br>
<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>
<br>
# apply DB based aliases<br>
alias_db_lookup("dbaliases");<br>
<br>
# do lookup with method filtering<br>
if (!lookup("location","m")) {<br>
switch ($retcode) {<br>
case -1: # Note here: check for blacklist numbers<br>
if (!check_blacklist("globalblacklist")) {<br>
sl_send_reply("403", "Forbidden");<br>
exit;<br>
}<br>
<br>
# Check for user ACLs<br>
if($rU=~"^\0") {<br>
if(!db_is_user_in("Credentials","extern")) {<br>
xlog("L_INFO","403 - Forbidden<br>
[$fd/$fu/$rd/$ru/$si]\n");<br>
sl_send_reply("403", "Forbidden - No permission for<br>
external calls");<br>
exit;<br>
}<br>
}<br>
<br>
# Then route it !<br>
cr_user_carrier("$fU", "$fd", "$avp(carrier)");<br>
if($avp(carrier)==0) {<br>
xlog("L_INFO","Not here: default route<br>
[$fd/$fu/$rd/$ru/$si]\n");<br>
<br>
if($(rU{s.len}) < 4) {<br>
xlog("L_ERR", "Number incomplete/failure for $rU\n");<br>
prefix("FAIL_");<br>
route(vmbox);<br>
}<br>
<br>
if(!cr_route("default", "$fd", "$rU", "$rU",<br>
"call_id", "$avp(host)")) {<br>
xlog("L_ERR", "Number not found for $rU\n");<br>
prefix("FAIL_");<br>
route(vmbox);<br>
}<br>
} else {<br>
xlog("L_INFO","Not here: user route<br>
[$fd/$fu/$rd/$ru/$si/$avp(carrier)]\n");<br>
<br>
$avp(domain)="<a href="http://voip.unisi.it" target="_blank">voip.unisi.it</a>";<br>
if (!cr_route("$avp(carrier)", "$avp(domain)",<br>
"$rU", "$rU","call_id", "$avp(host)")) {<br>
sl_send_reply("404", "Not found");<br>
xlog("L_ERR", "cr_route failed\n");<br>
exit;<br>
}<br>
}<br>
<br>
t_on_failure("missed_call");<br>
<br>
if (!t_relay()) {<br>
sl_reply_error();<br>
};<br>
exit;<br>
case -3: # internal error<br>
t_newtran();<br>
t_reply("404", "Not Found");<br>
exit;<br>
case -2: # method not supported<br>
sl_send_reply("405", "Method Not Allowed");<br>
exit;<br>
}<br>
}<br>
<br>
if (isbflagset(NAT)) setflag(NAT);<br>
<br>
# when routing via usrloc, log the missed calls also<br>
setflag(ACC_MISSED);<br>
route(relay);<br>
}<br>
<br>
<br>
route[relay] {<br>
# for INVITEs enable some additional helper routes<br>
if (is_method("INVITE")) {<br>
<br>
if (isflagset(NAT)) {<br>
rtpproxy_offer("ro");<br>
}<br>
<br>
t_on_branch("per_branch_ops");<br>
t_on_reply("handle_nat");<br>
t_on_failure("missed_call");<br>
}<br>
<br>
if (isflagset(NAT)) {<br>
add_rr_param(";nat=yes");<br>
}<br>
<br>
if (!t_relay()) {<br>
send_reply("500","Internal Error");<br>
};<br>
exit;<br>
}<br>
<br>
<br>
# Presence route<br>
route[handle_presence]<br>
{<br>
if (!t_newtran())<br>
{<br>
sl_reply_error();<br>
exit;<br>
}<br>
<br>
if(is_method("PUBLISH"))<br>
{<br>
handle_publish();<br>
}<br>
else<br>
if( is_method("SUBSCRIBE"))<br>
{<br>
handle_subscribe();<br>
}<br>
<br>
exit;<br>
}<br>
<br>
<br>
branch_route[per_branch_ops] {<br>
xlog("new branch at $ru\n");<br>
}<br>
<br>
<br>
onreply_route[handle_nat] {<br>
if (nat_uac_test("1"))<br>
fix_nated_contact();<br>
if ( isflagset(NAT) )<br>
rtpproxy_answer("ro");<br>
# xlog("incoming reply\n");<br>
}<br>
<br>
<br>
failure_route[missed_call] {<br>
if (t_was_cancelled()) {<br>
exit;<br>
}<br>
<br>
if (t_check_status("408|5[0-9][0-9]")) {<br>
if(!cr_route("default", "$fd", "$rU", "$rU", "call_id",<br>
"$avp(host)")){<br>
t_reply("403", "Not allowed");<br>
} else {<br>
revert_uri();<br>
prefix("FAILURE_");<br>
rewritehostport("<a href="http://172.20.1.5:5060" target="_blank">172.20.1.5:5060</a>");<br>
t_relay();<br>
}<br>
}<br>
}<br>
<br>
route[vmbox] {<br>
xlog("L_INFO","Route VMBOX [$fd/$fu/$rd/$ru/$si/]\n");<br>
<br>
rewritehostport("<a href="http://172.20.1.5:5060" target="_blank">172.20.1.5:5060</a>");<br>
<br>
route(relay);<br>
}<br>
<br>
<br>
local_route {<br>
if (is_method("BYE") && $DLG_dir=="UPSTREAM") {<br>
<br>
acc_db_request("200 Dialog Timeout", "acc");<br>
<br>
}<br>
}<br>
<br>
SIP Signaling works but RTP (Voice) not. If i register a device like<br>
"<a href="mailto:sip%3A5001@10.1.65.117">sip:5001@10.1.65.117</a>" call signalling works but voice not.<br>
<br>
Any hint ?<br>
<br>
Thanks, Michele<br>
<br>
--<br>
Michele Pinassi<br>
Responsabile Telefonia di Ateneo<br>
Servizio Reti, Sistemi e Sicurezza Informatica - Università degli Studi di Siena<br>
tel: 0577.(23)2169 - fax: 0577.(23)2053<br>
<br>
Per trovare una soluzione rapida ai tuoi problemi tecnici<br>
consulta le FAQ di Ateneo, <a href="http://www.faq.unisi.it" target="_blank">http://www.faq.unisi.it</a><br>
<br>
<br>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div>