[OpenSIPS-Users] Avp_db_query causing error with invalid parameter value. How to fix it?

Rodrigo Pimenta Carvalho pimenta at inatel.br
Wed Feb 24 14:48:55 CET 2016


Hi Bogdan.


I have just analyzed some more information about the case, as you asked me. See below the queries that cause the error.

In addiction, in the past I had changed the file that you can find attached in this message (it is for sqlite). There was an error in such file that prevented me to execute these complex queiries. After discussing in this list, a solution was proposed to such file, as you can see. Could you inspect the file and tell me if there is some problem there? Any hint will be very helpful!


P.S.: before the error for the queries there is no another error just before as seen in the log.




route{
...
    if (has_totag()) {

        if (loose_route()) {
...

        } else {

            if ( is_method("ACK") ) {
                if ( t_check_trans() ) {
                    # non loose-route, but stateful ACK; must be an ACK after
                    # a 487 or e.g. 404 from upstream server

                    t_relay();

                    # if a call is rejected or the caller gives up waiting for an answer, we have this 2 queries being executed:
                    avp_db_query("DELETE FROM acc WHERE time IN (SELECT time FROM acc UNION SELECT time FROM missed_calls ORDER BY time DESC LIMIT 300 OFFSET 150)");
                    avp_db_query("DELETE FROM missed_calls WHERE time IN (SELECT time FROM acc UNION SELECT time FROM missed_calls ORDER BY time DESC LIMIT 300 OFFSET 150)");

                    exit;
                } else {
                    # ACK without matching transaction ->
                    # ignore and discard
                    exit;
                }
            }
            sl_send_reply("404","Not here");
        }


        exit;
    }

...

    if (is_method("INVITE")) {

...

    }


    if (is_method("REGISTER"))
    {

...

        # this query executes whenever the client does a SIP REGISTER:
        avp_db_query("UPDATE location SET callerName='$fn' WHERE id = last_insert_rowid()");

        exit;
    }

    if ($rU==NULL) {

  ...

    # when routing via usrloc, log the missed calls also
    if (($fU==$avp(I_A)) || ($fU==$avp(I_B)) ){
       setflag(ACC_MISSED);
    }
    route(relay);
}



route[relay] {
    # for INVITEs enable some additional helper routes
    if (is_method("INVITE")) {

        #if (isflagset(NAT)) {
            #rtpproxy_offer("ro");
        #}

        t_on_branch("per_branch_ops");
        t_on_reply("handle_nat");
        t_on_failure("missed_call");
    }

...

    #this queries execute whenever a peer is calling, or a peer answer, o a call is terminated.
    avp_db_query("DELETE FROM acc WHERE time IN (SELECT time FROM acc UNION SELECT time FROM missed_calls ORDER BY time DESC LIMIT 300 OFFSET 150)");
    avp_db_query("DELETE FROM missed_calls WHERE time IN (SELECT time FROM acc UNION SELECT time FROM missed_calls ORDER BY time DESC LIMIT 300 OFFSET 150)");

    exit;
}




Thanks a lot!




RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979


________________________________
De: users-bounces at lists.opensips.org <users-bounces at lists.opensips.org> em nome de Rodrigo Pimenta Carvalho <pimenta at inatel.br>
Enviado: quarta-feira, 24 de fevereiro de 2016 09:07
Para: Bogdan-Andrei Iancu; OpenSIPS users mailling list
Cc: Daniel Lopes Fússia
Assunto: Re: [OpenSIPS-Users] Avp_db_query causing error with invalid parameter value. How to fix it?


Hi Bogdan.


I will do this check and let you know the result. Wait some minutes, please.


Thanks.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979


________________________________
De: Bogdan-Andrei Iancu <bogdan at opensips.org>
Enviado: terça-feira, 23 de fevereiro de 2016 19:19
Para: OpenSIPS users mailling list
Cc: Daniel Lopes Fússia; Rodrigo Pimenta Carvalho
Assunto: Re: [OpenSIPS-Users] Avp_db_query causing error with invalid parameter value. How to fix it?

Hi Rodrigo,

Can you identify the actual query (like maybe printing something in the script via xlog) that generates this error ? also, are there any previous errors just above this one ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

[http://www.opensips-solutions.com/imgs/opensips-solutions-logo.gif]<http://www.opensips-solutions.com/>

Home — OpenSIPS Solutions<http://www.opensips-solutions.com/>
www.opensips-solutions.com
OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.

On 23.02.2016 22:06, Rodrigo Pimenta Carvalho wrote:


Hi.


Most of my queries in avp_db_query is causing the following error:



"ERROR:db_sqlite:db_sqlite_free_result: invalid parameter value"


How to fix it? I'm sure that all SQL queries is correct, as I have tested it in an isolated way direct over the database. In addiction, all SQL commands with avp_db_query can change the data in the database correctly. The unique issue is the "ERROR" seen in the log.


The documentation doesn't comment on it.


Any hint will be very helpful!


Thanks a lot.



RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979



_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160224/a312e853/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbase.c
Type: text/x-csrc
Size: 20932 bytes
Desc: dbase.c
URL: <http://lists.opensips.org/pipermail/users/attachments/20160224/a312e853/attachment-0001.c>


More information about the Users mailing list