<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Hi Philip,<br>
<br>
In avpops module, set:<br>
</tt><br>
<pre class="programlisting">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]<tt> <a href="https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query" target="_blank">https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query</a></tt>
Regards
</pre>
<tt></tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2020Amsterdam/">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
</pre>
<div class="moz-cite-prefix">On 2/29/20 7:48 AM, Saint Michael
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAC9cSODR1OY4BkwFn61=Gi_xRwCnecp0VFGCVH3-XuYoDEhuLA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">I finally
compiled and loaded db_unixodbc.so.</div>
<div class="gmail_default" style="font-size:small">But I am lost
as how to use it from the script to run a query from local
MySQL</div>
<div class="gmail_default" style="font-size:small">for example,
now I do</div>
<div class="gmail_default" style="font-size:small"> 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</div>
<div class="gmail_default" style="font-size:small">The php
script uses php-odbc, but it is extremely cpu-intensive.
</div>
<div class="gmail_default" style="font-size:small">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.</div>
<div class="gmail_default" style="font-size:small">How can I use
db_unixodb to run ad-hoc queries from an ODBC database?</div>
<div class="gmail_default" style="font-size:small">Is there an
example?</div>
<div class="gmail_default" style="font-size:small">Philip Orlens</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
<div class="gmail_default" style="font-size:small"><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Feb 28, 2020 at 6:18
AM Bogdan-Andrei Iancu <<a
href="mailto:bogdan@opensips.org" moz-do-not-send="true">bogdan@opensips.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"> <tt>Same in 2.4</tt><br>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a href="https://www.opensips.org/events/Summit-2020Amsterdam/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
</pre>
<div>On 2/28/20 1:13 PM, Saint Michael wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_default" style="font-size:small">I use
opensips 2.4</div>
<div class="gmail_default" style="font-size:small">Is
this only for 3.0.X?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Feb 28, 2020
at 3:58 AM Bogdan-Andrei Iancu <<a
href="mailto:bogdan@opensips.org" target="_blank"
moz-do-not-send="true">bogdan@opensips.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px
0px 0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"> <tt>Hi Philip,<br>
<br>
There is the db_unixodbc module [1] the can be
used from other modules or directly from script
(via avpops queries [2])<br>
<br>
<br>
[1] <a
href="https://opensips.org/html/docs/modules/3.0.x/db_unixodbc.html"
target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.0.x/db_unixodbc.html</a><br>
[2] <a
href="https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query"
target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.0.x/avpops.html#func_avp_db_query</a><br>
<br>
Regards,<br>
</tt>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a href="https://www.opensips.org/events/Summit-2020Amsterdam/" target="_blank" moz-do-not-send="true">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
OpenSIPS Bootcamp, Miami, March 2020
<a href="https://opensips.org/training/OpenSIPS_Bootcamp_2020/" target="_blank" moz-do-not-send="true">https://opensips.org/training/OpenSIPS_Bootcamp_2020/</a>
</pre>
<div>On 2/27/20 7:32 PM, Saint Michael wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"><span
class="gmail_default"
style="font-size:small">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?</span></blockquote>
<div><span class="gmail_default"
style="font-size:small">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</span></div>
<div><span class="gmail_default"
style="font-size:small">Philip Orleand</span></div>
<div><span class="gmail_default"
style="font-size:small"><br>
</span></div>
<div><span class="gmail_default"
style="font-size:small"></span> </div>
<blockquote class="gmail_quote"
style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"><span
class="gmail_default"
style="font-size:small"></span><br>
</blockquote>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>