[Users] problem to detect a loop - load_contacts()/next_contacts()

Matteo Piazza matteo.piazza at create-net.it
Wed Dec 7 15:52:12 CET 2005


I have realized a serial forking with load_contacts() and 
next_contacts(), but i have this problem:
When the first time arrive the invite messages the contacts are loaded 
by the function load_contacts(). So when the call flow enters in the 
failure_route I can load the second contact. At this point the script 
reload another time the contacts. But in this way Is is impossible to 
load the third contact, because the script load the preference of the 
new contact.
For example:
I call 309 at domain.it,
the script loads 309 contacts and call the fisrt: 309 at domain.it
309 not answered,
the scrip enters in failure route,
it loads the 400 at domain.it and call 400,
At this moment I loads the contacts of 400 at domain.it WRONG!!!!!


In which way it is possibile to load the contacts only the firt time.
I hope that the problem is clear.

Best
Matteo
=======================================


This is my location table
============================================================

username | domain | contact                            |  q
400      |        | sip:400 at 192.168.9.193             | 1.00
401      |        | sip:400 at 192.168.9.194             | 1.00
308      |       | sip:308 at 192.168.9.181:5060          | 1.00
309      |       | sip:309 at 192.168.9.131;transport=udp | 1.00
309      |       | sip:400 at 192.168.9.97          | 0.80
309	|	| sip:401 at 192.168.9.97          | 0.60



....................
....................
route{
......
......
......

  if(load_contacts()){
     xlog("L_ERR","LOAD CONTACTS!\n");
  };

  if(next_contacts()){
     xlog("L_ERR","NEXT CONTACT!\n");
  };

  t_on_failure("1");
  t_relay();
  exit;
}

route[1] {
  log(1,"ROUTE 1 !\n");
   if (!t_relay()) {
         sl_reply_error();
         };
         exit;
}


route[2] {
         # send it out now; use stateful forwarding as it works reliably
         # even for UDP2TCP
         log(1,"ROUTE 2 !\n");
         t_on_failure("1");
         if (!t_relay()) {
                 sl_reply_error();
         };
         exit;
}

failure_route[1] {
  log(1,"FAILURE ROUTE !\n");
  if (t_check_status("408")){
         if (next_contacts()) {
                 log(1,"NUOVO CONTATTO !\n");
                 route(2);
                 exit;
         };
  };
exit;
}

This is the output:
7(5504) LOAD CONTACTS!
  7(5504) NEXT CONTACT!
14(5518) FAILURE ROUTE !
14(5518) NUOVO CONTATTO !
14(5518) ROUTE 2 !
  6(5502) LOAD CONTACTS!
  6(5502) NEXT CONTACT!







More information about the Users mailing list