I had been using 'perl_exec' in my scripts with great success until I decided to try using it in the onreply_route. The strangest thing now happens; I use my perl script to write information to a database, and it seems like the failure would have to be in DBI, but it only occurs in Openser. I execute a stored procedure, and instead of doing this:

  exec procedurename @arg1 = '{sip status}', @arg2 = '{callid}'

The procedure is called like this:

  declare @arg2 numeric({string length})
  exec procedurename @arg1 = '{sip status}', @arg2 = '{callid}' output

I have no idea where the thing is declaring @arg2 as an output variable. I can run my script manually forever and never get this message, but it happens about 50% of the time in Openser (i.e. half the time it works perfectly, without creating the output variable). I would try to run it somewhere else in my openser script, but the sip status isn't available in the request context (where I run similar scripts without any problems). The procedure is not supposed to return anything.

Here's the function I created:

*****
*****
use strict;
use DBI;
use DBI qw(:sql_types);
use OpenSER qw ( log );
use OpenSER::Constants;
use OpenSER::Message;

sub proxy_onreply {
        my $m = shift;

        my $status;
        my $callid;

        my $sth;
        my $dbh;
        my $query;

        $status = $m->getStatus();
        $callid = $m->pseudoVar("\$ci");

$dbh = DBI->connect("dbi:Sybase") || die "Database connection not made: $DBI::errstr";

       $query = "exec procedurename [EMAIL PROTECTED] = ?, [EMAIL PROTECTED] = 
?";
       $sth = $dbh->prepare($query);
       $sth->bind_param(1, $status, SQL_VARCHAR);
       $sth->bind_param(2, $callid, SQL_VARCHAR);

       $sth->execute;

       $sth->finish;
       $dbh->disconnect();
}
*****
*****

Any suggestions would be lovely.

Best regards,

Mik

_______________________________________________
Users mailing list
Users@openser.org
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to