[OpenSER-Users] newbie help - handeling 302s and 404s

Max Gregorian gregorian442 at googlemail.com
Sat Jan 5 02:45:40 CET 2008


As per the logs, the error is in the syntax. It mentions missing brackets
somewhere.

Starts from where it says
"..  0(9514) parse error (129,6-7): syntax error
 0(9514) parse error (129,6-7): missing '(' or ')' ?
 0(9514) parse error (129,6-7): bad command: missing ';'?
 0(9514) parse error (129,7-8): bad command (!!!attention: from
v1.0.0+ use 'return' instead of 'break'!!!)"

Do as it says - also in 1.1.1 'exit' was replaced by 'break' in some
sections - see changelog. I have had this before.

If I was you, I would go there (really useful tip:- it gives you the line
number/s where the errors occured). Go to the first error and debug
downwards from there. You'd find it's probably the 'exit' in the first route
function.

Where it says:

if (!lookup("location")) {
       route(5);
exit;

};



On 27/12/2007, Lazer Ramm <vchouse at gmail.com> wrote:

> Hi,
>
> thanx for taking the time to answer my question.
>
> when i try to run openser i get the following errors . how do i debug
> them ? this is my first time using version 1.1.x
>
> [root at IPX100 openser]# openser -f openser.cfg
> 0(9514) loading module /usr/lib/openser/modules/sl.so
> 0(9514) loading module /usr/lib/openser/modules/tm.so
> 0(9514) loading module /usr/lib/openser/modules/rr.so
> 0(9514) loading module /usr/lib/openser/modules/maxfwd.so
> 0(9514) loading module /usr/lib/openser/modules/usrloc.so
> 0(9514) loading module /usr/lib/openser/modules/registrar.so
> 0(9514) loading module /usr/lib/openser/modules/textops.so
> 0(9514) loading module /usr/lib/openser/modules/uac_redirect.so
> 0(9514) set_mod_param_regex: usrloc matches module usrloc
> 0(9514) set_mod_param_regex: found <db_mode> in module usrloc
> [/usr/lib/openser/modules/usrloc.so]
> 0(9514) set_mod_param_regex: rr matches module rr
> 0(9514) set_mod_param_regex: found <enable_full_lr> in module rr
> [/usr/lib/openser/modules/rr.so]
> 0(9514) find_cmd_export_t: found <mf_process_maxfwd_header>(1) in
> module maxfwd [/usr/lib/openser/modules/maxfwd.so]
> 0(9514) find_cmd_export_t: found <sl_send_reply>(2) in module sl
> [/usr/lib/openser/modules/sl.so]
> 0(9514) find_cmd_export_t: found <sl_send_reply>(2) in module sl
> [/usr/lib/openser/modules/sl.so]
> 0(9514) find_cmd_export_t: found <record_route>(0) in module rr
> [/usr/lib/openser/modules/rr.so]
> 0(9514) find_cmd_export_t: found <loose_route>(0) in module rr
> [/usr/lib/openser/modules/rr.so]
> 0(9514) find_cmd_export_t: found <append_hf>(1) in module textops
> [/usr/lib/openser/modules/textops.so]
> 0(9514) find_cmd_export_t: found <save>(1) in module registrar
> [/usr/lib/openser/modules/registrar.so]
> 0(9514) find_cmd_export_t: found <lookup>(1) in module registrar
> [/usr/lib/openser/modules/registrar.so]
> 0(9514) parse error (129,6-7): syntax error
> 0(9514) parse error (129,6-7): missing '(' or ')' ?
> 0(9514) parse error (129,6-7): bad command: missing ';'?
> 0(9514) parse error (129,7-8): bad command (!!!attention: from
> v1.0.0+ use 'return' instead of 'break'!!!)
> 0(9514) parse error (129,8-9): bad command (!!!attention: from
> v1.0.0+ use 'return' instead of 'break'!!!)
> 0(9514) parse error (129,10-11): bad command (!!!attention: from
> v1.0.0+ use 'return' instead of 'break'!!!)
> 0(9514) find_cmd_export_t: found <t_on_failure>(1) in module tm
> [/usr/lib/openser/modules/tm.so]
> 0(9514) find_cmd_export_t: found <t_relay>(0) in module tm
> [/usr/lib/openser/modules/tm.so]
> 0(9514) find_cmd_export_t: found <sl_reply_error>(0) in module sl
> [/usr/lib/openser/modules/sl.so]
> 0(9514) find_cmd_export_t: found <t_check_status>(1) in module tm
> [/usr/lib/openser/modules/tm.so]
> 0(9514) find_cmd_export_t: found <t_relay>(0) in module tm
> [/usr/lib/openser/modules/tm.so]
> 0(9514) find_cmd_export_t: found <get_redirects>(1) in module
> uac_redirect [/usr/lib/openser/modules/uac_redirect.so]
> 0(9514) find_cmd_export_t: found <t_relay>(0) in module tm
> [/usr/lib/openser/modules/tm.so]
> 0(9514) parse error (157,1-2): syntax error
> 0(9514) parse error (157,1-2):
> ERROR: bad config file (8 errors)
> 0(9514) DEBUG: tm_shutdown : start
> 0(9514) DEBUG: tm_shutdown : emptying hash table
> 0(9514) DEBUG: tm_shutdown : releasing timers
> 0(9514) DEBUG: tm_shutdown : removing semaphores
> 0(9514) DEBUG: tm_shutdown : destroying tmcb lists
> 0(9514) DEBUG: tm_shutdown : done
> 0(9514) shm_mem_destroy
>
>
>
>
> # -------------------------  request routing logic -------------------
>
> # main routing logic
>
> route{
>
>        # initial sanity checks -- messages with
>        # max_forwards==0, or excessively long requests
>        if (!mf_process_maxfwd_header("10")) {
>                sl_send_reply("483","Too Many Hops");
>                exit;
>        };
>
>        if (msg:len >=  2048 ) {
>                sl_send_reply("513", "Message too big");
>                exit;
>        };
>
>        # we record-route all messages -- to make sure that
>        # subsequent messages will go through our proxy; that's
>        # particularly good if upstream and downstream entities
>        # use different transport protocol
>        if (!method=="REGISTER")
>                record_route();
>
>        # subsequent messages withing a dialog should take the
>        # path determined by record-routing
>        if (loose_route()) {
>                # mark routing logic in request
>                append_hf("P-hint: rr-enforced\r\n");
>                #route(1);
>        };
>
>        if (uri==myself) {
>
>                if (method=="REGISTER") {
>                        save("location");
>                        exit;
>
>                };
> #this closes the if uri ==
> }
>
> if (!lookup("location")) {
>        route(5);
> exit;
> };
>
> ## ANYTHING ADDED BELOW CAUSE OPENSER TO CRASH ???####
>
> route[5] {
>        rewritehostport("10.10.10.10:5060");
>        t_on_failure("1");
>        route(1);
>        exit;
> }
>
> route[1] {
>        if (!t_relay()) {
>                sl_reply_error();
>        };
>        exit;
> }
>
> failure_route[1] {
>        if (t_check_status("404")) {
>                rewritehostport("192.168.10.1:5060");
>                append_branch();
>                t_relay();
>        } else {
>                get_redirects("*");
>                t_relay();
>        }
> }
>
>
>
> #this closes the route
> }
>
>
>
>
>
>
>
> On Dec 27, 2007 12:14 PM, Jesus Rodriguez <jesusr at voztele.com> wrote:
> >
> > Hi Lazer,
> >
> >  >i need a simple config that achieves the following (w/ out a db)
> >  >
> >  >if a user is not registered then all calls should go to a default gw
> >  >192.168.10.1
> >  >
> >  >the default gw will only respond w/ a 302 or a 404
> >  >
> >  >if a 302 is received then openser should forward the call on to the
> >  >new gw listed in the reply
> >  >
> >  >if a 404 is received the call should be forwarded to a different gw
> > 172.16.20.1
> >  >
> >  >if the send gw is done then the call should die.
> >
> >
> > Try with somehting like this (not tested):
> >
> > if (!lookup("location")) {
> >         route(5);
> >         exit;
> > }
> >
> > route[5] {
> >         rewritehostport("192.168.10.1:5060");
> >         t_on_failure("1");
> >         route(1);
> >         exit;
> > }
> >
> > route[1] {
> >         if (!t_relay()) {
> >                 sl_reply_error();
> >         };
> >         exit;
> > }
> >
> > failure_route[1] {
> >         if (t_check_status("404")) {
> >                 rewritehostport("172.16.20.1:5060");
> >                 append_branch();
> >                 t_relay();
> >         } else {
> >                 get_redirects("*");
> >                 t_relay();
> >         }
> > }
> >
> >
> > Saludos
> > JesusR.
> >
> >
> >
> >
> >  >here is what i was thinking of but as a newbie i may be off my rocker
> >  >i seem to get an error
> >  >
> >  > ERROR: t_check_status: cannot check status for a reply which has no
> >  >T-state established
> >  >
> >  >but again my whole approach may be wrong.
> >  >
> >  >
> >  >                if (!lookup("location")) {
> >  >
> >  >rewritehostport ("192.168.10.1:5060");
> >  >if (t_check_status("(404)|(480)")) {
> >  >    log("404 or 480 negative reply\n");
> >  >rewritehostport ("172.16.20.1:5060");
> >  >}
> >  >else{
> >  >t_on_failure("1");
> >  > t_relay();
> >  >}
> >  >
> >  >
> >  >                failure_route[1] {
> >  >
> >  >                        get_redirects("*");
> >  >                       t_relay();
> >  >}
> >  >                }
> >
> >
> >
> >
> > Saludos
> > JesusR.
> >
> > ------------------------------------
> > Jesus Rodriguez
> > VozTelecom Sistemas, S.L.
> > jesusr at voztele.com
> > http://www.voztele.com
> > Tel. 902360305
> > -------------------------------------
> >
> >
> >
> >
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.openser.org
> http://lists.openser.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20080105/9f0093a0/attachment.htm 


More information about the Users mailing list