[OpenSIPS-Users] problem with module dialog

nguyen khue minhkhue49da at yahoo.com
Mon Aug 1 12:48:33 CEST 2011


Hi Vlad,

I use two Asterisks to test with OpenSIPS. I have 1000 users from 1000 to 2000, with user had last number is 0,1,2,3,4 (ex: 1000, 1001, ...) I route it to Asterisk 1 (id = 1), other users, I route it to Asterisk 2 (id = 2).
This is content of load_balancer table in database:
+----+----------+-------------------+-------------------+------------+-------------+
| id | group_id | dst_uri           | resources         | probe_mode | description |
+----+----------+-------------------+-------------------+------------+-------------+
|  1 |        1 | sip:192.168.0.178 | transc=30;pstn=30 |          0 |             |
|  2 |        2 | sip:192.168.0.176 | transc=30;pstn=30 |          0 |             |
+----+----------+-------------------+-------------------+------------+-------------+
I had develop one module for my project with name call_monitor, in this module, I process some SIP messages as: INVITE, 200 OK, INFO, BYE.
This is config file, please check it for me
route{

if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}

if (is_method("INFO")){
if (!process_info_message()){
sl_send_reply("503","Service Unavaiable");
exit;
}
if ($fU =~"1[0-9][0-9][0-5]"){
forward("192.168.0.178:5060");
}
else {
forward("192.168.0.176:5060");
}
        }
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails
process_bye_message();
if ($fU =~"1[0-9][0-9][0-5]"){
forward("192.168.0.178:5060");
}
else {
forward("192.168.0.176:5060");
}
} else if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
if (is_method("ACK"))
{
if (t_check_trans()){
t_relay();
}
if ($fU =~"1[0-9][0-9][0-5]"){
forward("192.168.0.178:5060");
}
else {
forward("192.168.0.176:5060");
}
}
route(1);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after 
# a 487 or e.g. 404 from upstream server
t_relay();
if ($fU =~"1[0-9][0-9][0-5]"){
forward("192.168.0.178:5060");
}
else {
forward("192.168.0.176:5060");
}
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
if (is_method("BYE")){
process_bye_message();
t_relay();
if ($fU =~"1[0-9][0-9][0-5]"){
forward("192.168.0.178:5060");
}
else {
forward("192.168.0.176:5060");
}
}
#sl_send_reply("404","Not here");
}
exit;
}

# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}

t_check_trans();

# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
sl_send_reply("403","Preload Route denied");
exit;
}

# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();

# account only INVITEs
if (is_method("INVITE")) {
setflag(1); # do accounting
}
if (!uri==myself)
{
append_hf("P-hint: outbound\r\n"); 
route(1);
}

if (is_method("PUBLISH"))
{
sl_send_reply("503", "Service Unavailable");
exit;
}

if (is_method("REGISTER"))
{

if (!save("location"))
sl_reply_error();
exit;
}

if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}

# do lookup with method filtering
if (!lookup("location","m")) {
switch ($retcode) {
case -1:
case -3:
#t_newtran();
#t_reply("404", "Not Found");
route(2);
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}

# when routing via usrloc, log the missed calls also
setflag(2);

route(1);
}

route[2]{
if (is_method("INVITE")){
if (!has_totag()){
if (vega_process_invite()){
t_on_branch("2");
t_on_failure("1");
t_on_reply("2");
if ($fU =~"1[0-9][0-9][0-5]"){
load_balance("1","pstn");
t_relay();
exit;
}
else {
load_balance("2","pstn");
t_relay();
exit;
}

}
else {
xlog("Process INVITE failed, drop call anyway\n");
sl_send_reply("404","Method not Allowed");
exit;
}
}
}
exit;
}
branch_route[2] {
xlog("new branch at $ru\n");
}
onreply_route[2] {

xlog("incoming reply\n");
if (has_body("application/sdp")){
if (process_ok_message()){
exit();
}else {
drop();
exit();
}
}

if (t_check_status("404")) {
process_nothere_message();
exit();
}
}
failure_route[1] {
if (t_was_cancelled()) {
exit;
}
}

I had removed route[1], because all case will jump to route[2].

Thanks & Best regards
Khue Nguyen.


________________________________
From: Vlad Paiu <vladpaiu at opensips.org>
To: users at lists.opensips.org
Sent: Monday, August 1, 2011 3:17 PM
Subject: Re: [OpenSIPS-Users] problem with module dialog


Hello,

It seems that you somehow loop the traffic to your server, because
    that error means the message has over 64 Route headers. 
Please check your config file for the source of this bad routing.


Regards,

-- 
Vlad Paiu
OpenSIPS Developer

On 07/30/2011 06:28 AM, nguyen khue wrote: 
Hi all,
>
>
>I am using module dialog with  module load_balancer. I use sipp to test performance, with 50 first calls, opensips work normal. But, from the call 51th opensips had error:
>ERROR:core:print_rr_body: too many RR
>I use opensips 1.6.2, please help me fix it.
>Best regards
>Khue Nguyen.
>
>
>
_______________________________________________
Users mailing list Users at lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110801/927e7f6b/attachment-0001.htm>


More information about the Users mailing list