[Serusers] Command cannot be used in the block

Steve Blair blairs at isc.upenn.edu
Mon Jul 12 19:33:17 CEST 2004


Hello:

   I need some help with getting an unanswered call rolled over to
SEMS for voicemail.

  When an inbound call goes unanswered I would like to call to
go to SEMS voicemail. The SEMS/SER interface works for
specific test cases but the general case is failing with the error
"parse error (700,18-19): Command cannot be used in the block".

   In the general case I have a voicemail check in the main section of my
config file. If the calling party enters a specific extension the call 
is routed to
SEMS using the logic: (This works).

     ## test
      if (uri=~"^sip:68001")
     {
        if(method=="ACK" || method=="INVITE" || method=="BYE" || 
method=="REFER"){
           if(t_newtran()){
             if(!vm("/tmp/am_fifo","voicemail")) {
              log("couldn't contact voicemail server\n");
              t_reply("500", "couldn not contact voicemail server");
             };
          }
          else {
            log("could not create new transaction\n");
            sl_send_reply("500","could not create new transaction");
          };
       }; # end if method
      break;
     };
    ## end test

   For the specific case I moved some of the above logic into a
failure_route block, I added the following check for this failure
condition in the main config file and then I attempt to execute
the voice mail logic in the failure block. I don't think the t_newtran
function can be used in a failure block but I don't see how else
to implement a "roll over to voicemail when not answered" type
of routing.

My failure check code is:

# redirect user to vm if not availabile?  Flag it now in case of
# rewrite and store it in flag 6 for route block 6
     if (is_user_in("Request-URI", "voicemail")) {
       t_on_failure("6");
       setflag(6);
       log(1, "[SER]: Flag for VM redirect successful. \n");
     } else {
       log(1, "[SER]: Flag for VM redirect unsuccessful. \n");
     };

My failure_route is:

failure_route[6] {

  xlog("L_INFO", "\n[SER]: START FAILURE BLOCK #6 Unavailable user:
       Time: [%Tf] Method: <%rm> R-uri: <%ru> Contact Header: <%ct>
       From uri <%fu> To < %tu> IP source address <%is> \n\n");

  if(method=="ACK" || method=="INVITE" || method=="BYE" || method=="REFER"){

    if(t_newtran()){
      if(!vm("/tmp/am_fifo","voicemail")) {
        log("couldn't contact voicemail server\n");
        t_reply("500", "couldn not contact voicemail server");
      };
    }
    else {
      log("could not create new transaction\n");
      sl_send_reply("500","could not create new transaction");
    };
  }; # end if method
  break;
}

  Any thoughts on this would be helpful.

Thanks,Steve

-- 

  
ISC Network Engineering
The University of Pennsylvania
3401 Walnut Street, Suite 221A
Philadelphia, PA 19104  


voice: 215-573-8396 

       215-746-7903

fax: 215-898-9348    

sip:blairs at upenn.edu




More information about the sr-users mailing list