[OpenSIPS-Users] is there native odbc module?

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Mar 3 14:30:19 EST 2020


Hi Philip,

In avpops module, set:

modparam("avpops", "db_url",
     "unixodbc://opensips:opensipsrw@localhost/my_dsn")

(be sure the DSN matches what you have in odbc.ini).

And from the script, use the avp_db_query() [1] to run a raw query.

[1]https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query  

Regards

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit, Amsterdam, May 2020
   https://www.opensips.org/events/Summit-2020Amsterdam/

On 2/29/20 7:48 AM, Saint Michael wrote:
> I finally compiled and loaded db_unixodbc.so.
> But I am lost as how to  use it from the script to run a query from 
> local MySQL
> for example, now I do
>  exec("/usr/lib/aniv/aniodbc.php","$fU-$rU-$si","$var(new_anix)"), 
> where the variable new_anix contains all the information I need to do 
> my routing
> The php script uses php-odbc,   but it is extremely cpu-intensive.
> Through db_unixodbc.so I want to be able to run a query using a DSN 
> name plus user name and password and store the result in a single 
> variable.
> How can I use db_unixodb to run ad-hoc queries from an ODBC database?
> Is there an example?
> Philip Orlens
>
>
>
>
> On Fri, Feb 28, 2020 at 6:18 AM Bogdan-Andrei Iancu 
> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>
>     Same in 2.4
>
>     Bogdan-Andrei Iancu
>
>     OpenSIPS Founder and Developer
>        https://www.opensips-solutions.com
>     OpenSIPS Summit, Amsterdam, May 2020
>        https://www.opensips.org/events/Summit-2020Amsterdam/
>
>     On 2/28/20 1:13 PM, Saint Michael wrote:
>>     I use opensips 2.4
>>     Is this only for 3.0.X?
>>
>>     On Fri, Feb 28, 2020 at 3:58 AM Bogdan-Andrei Iancu
>>     <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>
>>         Hi Philip,
>>
>>         There is the db_unixodbc module [1] the can be used from
>>         other modules or directly from script (via avpops queries [2])
>>
>>
>>         [1] https://opensips.org/html/docs/modules/3.0.x/db_unixodbc.html
>>         [2]
>>         https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query
>>
>>         Regards,
>>
>>         Bogdan-Andrei Iancu
>>
>>         OpenSIPS Founder and Developer
>>            https://www.opensips-solutions.com
>>         OpenSIPS Summit, Amsterdam, May 2020
>>            https://www.opensips.org/events/Summit-2020Amsterdam/
>>         OpenSIPS Bootcamp, Miami, March 2020
>>            https://opensips.org/training/OpenSIPS_Bootcamp_2020/
>>
>>         On 2/27/20 7:32 PM, Saint Michael wrote:
>>>
>>>             I am new to opensips. Right now I am using exec to
>>>             interface with my database via php-odbc. Is there a
>>>             native odbc module that would have less overhed than my
>>>             current approach?
>>>
>>>         Also, how do I get a record of the call written to a
>>>         database or a file? basic information, caller ID, number,
>>>         duration, and date
>>>         Philip Orleand
>>>
>>>
>>>
>>>         _______________________________________________
>>>         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/20200303/7aa1301b/attachment.html>


More information about the Users mailing list