| Author |
Message |
sadzas
Joined: Jun 13, 2008
Posts: 37
Status: Offline
|
| Posted:
Jun 19, 2009 - 06:13 PM |
|
Hi all!
I have Kamailio 1.4.4 working fine with RTPproxy. I want make a pass of signaling:
ABC <-----> Kamailio <-----> DEF
Kamailio <-----> GHI
Kamailio <-----> JKM
So, Kamailio must to discriminate the $rU, but using RTPproxy, because I'm using NAT.
This is my kamailio.cfg
| Code: |
#--------------------------------------------------------#
# PARAMETROS GENERALES
#--------------------------------------------------------#
debug=3
fork=yes
log_stderror=yes
check_via=no
dns=no
rev_dns=no
port=5060
children=4
#--------------------------------------------------------#
#--------------------------------------------------------#
# CARGA DE MODULOS
#--------------------------------------------------------#
mpath="//lib/kamailio/modules/"
loadmodule "mi_fifo.so"
loadmodule "db_mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "nathelper.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
#--------------------------------------------------------#
#--------------------------------------------------------#
# CONFIGURACION DE LOS PARAMETROS
#--------------------------------------------------------#
#--- MI FIFO
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
modparam("usrloc|auth_db","db_url","mysql://openser:openserrw@localhost/openser")
#--- USRLOC
modparam("usrloc", "db_mode", 0)
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "nat_bflag", 6)
#--- REGISTRAR
modparam("registrar|nathelper", "received_avp", "$avp(i:42)")
#--- AUTH
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
#--- RR
modparam("rr", "enable_full_lr", 1)
#--- NATHELPER
modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:7890")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", 7)
modparam("nathelper", "sipping_from", "sip:localhost")
#--------------------------------------------------------#
#--------------------------------------------------------#
# RUTEOS
#--------------------------------------------------------#
route{
#--------------------------------------------------------#
# SANITY
#--------------------------------------------------------#
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
exit;
};
#--------------------------------------------------------#
#--------------------------------------------------------#
# DETECCION DE NAT
route(2);
#--------------------------------------------------------#
#--------------------------------------------------------#
if (!method=="REGISTER")
record_route();
if (loose_route()) {
append_hf("P-hint: rr-enforced\r\n");
route(1);
};
if (!uri==myself) {
append_hf("P-hint: outbound\r\n");
route(1);
};
#--------------------------------------------------------#
#--------------------------------------------------------#
# REGISTRACION
#--------------------------------------------------------#
if (uri==myself) {
if (method=="REGISTER") {
if (isflagset(5)) {
setbflag(6);
# if you want OPTIONS natpings uncomment next
# setbflag(7);
};
save("location");
exit;
};
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
}
#--------------------------------------------------------#
#--------------------------------------------------------#
# RUTEOS
#--------------------------------------------------------#
route[1] {
if (subst_uri('/(sip:.*);nat=yes/\1/')){
setbflag(6);
};
if (isflagset(5)||isbflagset(6)) {
route(3);
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
route[2]{
force_rport();
if (nat_uac_test("19")) {
if (method=="REGISTER") {
fix_nated_register();
} else {
fix_nated_contact();
};
setflag(5);
};
}
route[3] {
if (is_method("BYE|CANCEL")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
force_rtp_proxy();
t_on_failure("1");
};
if (isflagset(5))
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
t_on_reply("1");
}
failure_route[1] {
if (isbflagset(6) || isflagset(5)) {
unforce_rtp_proxy();
}
}
route[4] {
log(1, "Reenvia a Mitel \n");
rewritehostport("192.168.2.1:5060");
exit;
}
route[5] {
log(1, "Reenvia a Offnet \n");
rewritehostport("192.168.3.1:5060");
exit;
}
route[6] {
log(1, "Reenvia a Cisco \n");
rewritehostport("192.168.4.1:5060");
exit;
}
#--------------------------------------------------------#
onreply_route[1] {
if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") {
force_rtp_proxy();
}
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isbflagset(6)) {
fix_nated_contact();
}
exit;
}
|
So, what I want is detect the dialed number and resend by the right way.
Example:
if ($rU =~ "20[0-9]"){
route(4);
}
if ($rU =~ "30[0-9]"){
route(5);
}
if ($rU =~ "40[0-9]"){
route(6);
}
Where do I have to define this? How it should be?
thanks in advance. |
|
|
|
 |
sadzas
Joined: Jun 13, 2008
Posts: 37
Status: Offline
|
| Posted:
Jun 19, 2009 - 08:40 PM |
|
At this moment, my CFG looks right this:
| Code: |
route[3] {
if (is_method("BYE|CANCEL")) {
unforce_rtp_proxy();
} else if (is_method("INVITE")){
if ($rU =~ "22[0-9]") {
force_rtp_proxy();
route(4);
}
force_rtp_proxy();
t_on_failure("1");
};
if (isflagset(5))
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
t_on_reply("1");
}
failure_route[1] {
if (isbflagset(6) || isflagset(5)) {
unforce_rtp_proxy();
}
}
route[4] {
log(1, "Reenvia a Mitel \n");
t_relay("udp:192.168.2.1:5060");
t_on_reply("1");
xlog("Script is at the end\n");
exit;
}
#--------------------------------------------------------#
|
Something is missing, if I make a capture with ethereal, I can see a NOT FOUND message:
| Code: |
192.168.10.135 -> xx.xx.xx.xx SIP/SDP Request: INVITE sip:220@xx.xx.xx.xx, with session description
xx.xx.xx.xx -> 192.168.10.135 SIP Status: 404 Not Found
|
So, it must to be wrong the place where I put my "DID" question. |
|
|
|
 |
|
| Forum Rules and Guidelines |
About VoIP User |
Privacy Policy
|
All logos and trademarks in this site are property of their respective owner. Comments and posts are property of the poster, all the rest (c) 2003-2008 VoIP User Limited.
VoIP User Limited is incorporated in England and Wales under Company Number 6694577.
No part of this site may be reproduced without our prior consent.
|
|