[asterisk-users] Lookup ${EXTEN} in database, update context/route if found... AGI?

Doug Lytle support at drdos.info
Thu Jun 3 10:37:12 CDT 2010


Tim Nelson wrote:
>
> I do have a few additional questions however:
>
> -How reliable is the MYSQL application?
>    

I've been running it for years now with no failures.


> -In the event of a failed database query (load too high), what happens to the call?
>    

The channel will get stuck indefinitely.  I discovered this early on.  
For a test, I shut down mysql and made a few calls.  Since then, Sean 
Bright was nice enough to tell me what to patch in the mysql_addon that 
allowed me to specify a timeout (Included at the end of the message)

> -Also, what about slow queries? If a query takes a few seconds to complete, does the call wait for the query to complete or are there timeouts for the query that could result in dropped calls?

I don't have any experience with slow queries, the facilities that I'm 
dealing with don't have huge call volume.  I'm sure others on the list 
would point you to the more robust func_odbc.

> -Are there any problems with concurrency? What if there are 50 simultaneous calls that need to perform this database lookup? Providing the MySQL server is fine with that number of simultaneous queries, will the MYSQL app and/or Asterisk handle it gracefully?
> -Does it make sense to open, disconnect, and clear every connection for every call? Is there a way to have a persistent connection for better performance?
>    
This is beyond my experience, so I really can't comment.  If I was doing 
this amount of volume, I'd probably go with func_odbc (And may still, 
just to learn it)


The source that needs to be patched is located:

asterisk-addons/apps/app_addon_sql_mysql.c


Patch and instructions attached:

"Find this line:

if (mysql_real_connect(mysql, dbhost, dbuser...

Add this before that line:

int timeout = 10; /* 10 second timeout */
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *) &timeout);

And recompile."


-- 

Ben Franklin quote:

"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."




More information about the asterisk-users mailing list