[Serusers] blind call forwarding addition

Martin Lane martin.l.lane at gmail.com
Thu Oct 1 18:03:34 CEST 2009


SER Users:

Thanks in advance for any help!

I am running ser 0.9.6 and have a relatively simple cfg file.  I have only
four (4) digit extensions, no PSTN, no NAT and I do not care about
authorization so my config file is basically the Hello World ser.cfg with my
system parameters and a few statements in route that allowed me to create
standing conference rooms and an echo application with sems.

Now I need to implement call forwarding and I have been able to setup the
MySQL ser usr_preferences table per chapter 10 of the 'SER - Getting
Started' and the 'mySQL newbie? Problems with mySQL and SER?' documents.
After adding the call forwarding functionality discussed in chapter 10
inside my config file any number dialed to a SIP device rings busy. All SIP
devices register and can call the conference rooms or the echo application
but they can not call each other.  I will spare you my WireShark logs but
can provide if that is needed.

I'm looking for trouble shooting suggestions.  Is there a way to print to
the std i/o from inside the cfg file?  This is the first time I needed to
handle the INVITE message so I've included my INVITE Message Handler and the
Call Forwarding Handler that I added for this effort:



if (method=="ACK") {
 route(1);
 break;
} if (method=="INVITE") {
 route(3);
 break;
} if (method=="REGISTER") {
 route(2);
 break;
};

...

route[3] {
# ----------------------------------------------------------------------
# INVITE Message Handler
# ----------------------------------------------------------------------
# Note: We are using this fuction only as a hook into the
#       blind call forwarding feature.  Simply want to change the
#       R-URI and relay the message.

if (avp_db_load("$ruri/username", "s:callfwd")) {
   setflag(22);
   avp_pushto("$ruri", "s:callfwd");

  # Would love to do a printf here to see if this code is being hit!!!
  # Wireshark show INVITE messages are being sent.
  # debug/printf("\n\n******  Inside route(3) ********\n\n");

   # At this point the a blind call forwarding record was found and the
   # new destination was written in the R-URI.

   # DEBUG: try just calling route(1).
   # route(1);

   # Send to Call Forwarding Handler
   route(6);
   break;
   };
route(1);
}

route[6] {
# ----------------------------------------------------------------------
# Blind Call Forwarding Handler
#
# This must be done as a route block because sl_send_reply() cannot be
# called from the failure_route block
# ----------------------------------------------------------------------
  lookup("aliases");
  if (!is_uri_host_local()) {
     if (!isflagset(22)) {
        append_branch();
     };
     route(1);
     break;
  };
  if (!lookup("location")) {
     if (uri=~"^sip:[0-9]{4}@") {
        route(1);
        break;
      };
      sl_send_reply("404", "User Not Found");
      break;
  };

 # DEBUG: There are no alias' and we are not sending calls to other
 # networks.  We may just need to call route(1) and not this
 # function.

  route(1);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20091001/eb5d3114/attachment.htm>


More information about the sr-users mailing list