[OpenSIPS-Users] error-handling a parser error

Brett Nemeroff brett at nemeroff.com
Wed Jan 26 17:33:36 CET 2011


On Wed, Jan 26, 2011 at 10:27 AM, Jeff Pyle
> Brett,

> Your suggestion made me realize I've been attacking this the wrong way.
> Rather than try to get Opensips to tell me when it's throwing the parser
> error and handle that, it does make a lot more sense to do something to
> identify the result of the error and deal with it accordingly.  Something
> like checking for an empty $var(id_num) after the above function, or
> perhaps looking at $(re{uri.user}) before assigning it.
>
> Another I-D-ten-T mystery solved...


Ha :) I wouldn't go that far. :)

I know some parser errors generate that 400. I think it probably takes
a more critical field, like RURI to throw the full error.

I know in many programming languages there are ways to evaluate for
validity to keep these errors from being thrown. I'm not aware of any
way in the script to do this.. something along the lines of (invalid
syntax here)

if (is_set($(re{uri.user}))) {
    $var(id_num) = $(re{uri.user});
} else {
    route["FIX_MISSING_RPID"];
}

-Brett



More information about the Users mailing list