[OpenSIPS-Users] Routing Permission errors

Deon Vermeulen vermeulen.deon at gmail.com
Sat Sep 18 16:36:21 CEST 2010


Good Day

I am trying to setup Routing Parameters but get errors when checking  
opensips config.

Can some one please point out what I'm doing wrong in my script below  
or suggestions doing it differently will really be appreciated?

##################################
#----- Group Routing Params -----#
##################################
         #Normalize the local number e.164 - Windhoek (061)
         if (uri=~"^sip:[2-9][0-9]{6}@") {
           if (db_is_user_in("credentials","local")) {
             prefix("061");
             route(4);
             exit;
           }
           else {
             sl_send_reply("403", "No permissions for local calls");
             exit;
           }
         }
           # ---- National Calls ---- #
         if (uri=~"^sip:06[1-9]{6}@") {
           if (db_is_user_in("credentials","ld")) {
             route(4);
             exit;
             }
             else {
               sl_send_reply("403", "No permissions for long distance");
               exit;
             }
         }
           # ---- International Calls ---- #
         if (uri=~"^sip:00[0-9]*@") {
           if (db_is_user_in("credentials","Int")) {
             strip(3);
             route(4);
             exit;
           }
           else {
             sl_send_reply("403", "No permissions for internat. calls");
             exit;
           }
         }

#########################
#----- PSTN Routes -----#
#########################
#######################################################
#            Send the calls to the PSTN               #
#   Change the IP Address below to reflect network    #
#######################################################

         # ---- "Static" Routing ---- #
                 ##route[4] {
                 ## rewritehostport("x.x.x.x");
                 ##  route(1);

         # ---- Dynamic Routing ---- #     #### ---- THIS IS WHAT  
SHOULD BE USED ---- #####
         if(!do_routing()){
             send_reply("503", "No rules found matching the URI  
prefix");
            exit;
           }
            # flag 10 – flag the transaction to handle the failure route
           setflag(10);
           route(1);
         }
         failure_route[1] {
           if (t_was_cancelled()) {
             exit;
           }
           if(isflagset(10)){
             if (use_next_gw()) {
               #xlog ("next gateway $ru \n");
               t_on_failure("1");
               t_relay();
               exit;
            }
            else {
              t_reply("503", "Service not available, no more gateways");
              exit;
            }
         }
}


I get this error when checking the config with "opensipsctl -C /etc/ 
opensips/opensips.cfg

Sep 18 18:21:11 [19963] CRITICAL:core:yyerror: parse error in config  
file, line 409, column 2-4: syntax error
Sep 18 18:21:11 [19963] CRITICAL:core:yyerror: parse error in config  
file, line 409, column 2-4:
Sep 18 18:21:11 [19963] ERROR:core:main: bad config file (2 errors)


" if (uri=~"^sip:[2-9][0-9]{6}@") { "   Starts on line 409


I have the uri.so module loaded.
Do I need the regex.so module?


I am also looking for help to setup a Group permission "VOIP_XYZ" to  
only allow calls between users in a specific Domain "XYZ".


Thank you very very much in advance.


Regards
Deon


More information about the Users mailing list