Hi:

I'm trying to configure a Kamailio 3.2 server as a Redirect Server.

A softswitch we own will send a SIP INVITE for some calls like this "INVITE sip:102@sipwise.telecentro.net.ar SIP/2.0".
Once detected the B number "102" (in this example), the kamailio server will search in a sqlite3 database the transltated number the call should be directed.
And then the server will send a 300 Redirect with the new request uri. Like this "SIP/2.0 300 Redirect /.../ Contact: sip:63793266@voip.telecentro.net.ar".
And the softswitch will let the call go to the right number.
The translation desition is made based on the geographic area where the A party is located.

If the translated number is like 63793266 or 1557311721 the system is working ok. So the .cfg file seems to be OK.

But if the translated number is like 8003330303 the variable holding the SQL return is set to "-486604289".

I think this is related to data types.
In the logs I can see that kamailio is defaulting datatypes to INT (I've tested varchar, int, and bigint in sqlite3), but I don't know how large could an integer be in Kamailio. According to sqlite3 documentation the number 8003330303 is not long enough and in fact the number is in the database.

Has anybody seen something like this?
Can anyone help?

I can provide the hole script and database if this helps.

Regards,
Sebastian Ferguson