[asterisk-users] how to use a database (was: figuring out what happened to a call)

Antony Stone Antony.Stone at asterisk.open.source.it
Wed Dec 5 10:00:33 CST 2018

On Wednesday 05 December 2018 at 15:31:38, hw wrote:

> On 12/05/2018 01:19 PM, Antony Stone wrote:
> > On Wednesday 05 December 2018 at 13:04:57, hw wrote:
> >> On 12/04/2018 07:07 PM, Antony Stone wrote:
> >>> On Tuesday 04 December 2018 at 16:11:39, hw wrote:
> >>>> On 12/01/2018 05:30 PM, Marcelo Terres wrote:
> >>>>> Queue_log
> >>>> 
> >>>> Thanks!
> >>>> 
> >>>> That's not really it; however, how do I make it so that asterisk
> >>>> writes this information right away into a mariadb database instead of
> >>>> into a file so that I could actually use it?
> >>> 
> >>> Send your queue_log entries to odbc?
> >> 
> >> odbc?  Seriously?
> > 
> > Yes, it's the preferred method of talking to databases from Asterisk.
> After reading some documentation, anything else but odbc appears to be
> more or less deprecated :/


> > If you want to use the MySQL-specific driver / connector, you can still
> > use that for some things, but Voicemail in a database can only be done
> > via ODBC, for example.
> > 
> >>> It's a setting in extconfig.conf.
> >> 
> >> Does mysql not work?  It's mentioned there, too.
> > 
> > By all means try it - if it's mentioned, it'll probably work, but ODBC is
> > the more generic and better-supported way of using databases with
> > Asterisk.
> Since it really seems to be the most reasonable choice, I've set up an
> odbc connection and used alembic to create tables in a database for
> asterisk.
> Now how is this managable?  Is there a tool that reads the files I have
> and enters the configuration into the database?

Not that I know of.

> And when changes are to be made, editing configuration files is tremendously
> easier than going through the tables in the database and try to make the
> changes there.

Okay, so carry on using config files if you want to.

I was only answering your question about getting Asterisk Queue logs *out* 
into a database table; I wasn't recommending anything about reading config file 
*from* a database (although this is indeed possible if you want to).

> For now, can I make it so that only the queue_log is written into the
> database?


> I don't see a table for that.

You need to create that for yourself.

Asterisk can write to database tables, but doesn't help you set them up, for 
reasons I can't comment on.

> How dynamic are changes made in the database?

If by "dynamic" you mean "quickly used" then the answer is "immediately".

> For example, if I want to have an extension 'foobar' and want to ring
> different devices depending on some factors (like time of day, for example),
> can I modify the entry in the database for the device to ring from 'bar' to
> 'baz', and baz will ring instead of bar from thereon?


> That seems to be what this is intended for; in any case, it's what I'm going
> to need, which is why I went to all these lengths to connect to a database.

Okay, sounds good, then.

> Is it possible to use configuration from both the database and the files
> at the same time?


> That would save me converting all the entries in the files for now.



What do you get when you cross a joke with a rhetorical question?

                                                   Please reply to the list;
                                                         please *don't* CC me.

More information about the asterisk-users mailing list