Asterisk with MySQL

i was looking at documentation regarding how to bind asterisk with MySQL database
i’m stuck at the point where i should create the tables. it starts with something like

CREATE TABLE sip_buddies (
id int(11) NOT NULL auto_increment,
name varchar(80) NOT NULL default ‘’,

and so on

but i have no idea where should i write these lines, is it in a CLI? or should they be in a file proper to MySQL. if the latter, does anyone know which one is it?

thank you

That looks like SQL code to me. Thats the stuff you would type into the MySQL client.

Best way to do this is to put it into a text file and run the mysql client with input from the sql file.

For example:
Create a text file. Something like: asterisk_mysql_table_create.sql and put all of your mysql table setup stuff in there. Dont forget to put a “create database_name;” and “use database_name;” at the start of the file to set what database to create your tables in.

To run that file in mysql simply, from the command line type:

[root@mypbx ~] # [i]mysql -p < asterisk_mysql_table_create.sql[/i]

The -p will prompt you for a password if you have one for MySQL.

Have a look at some mysql getting started tutorials to get more of a feel for what you need to do.

Let us know how you go


you need to install the mysql addon and include other sip columns in the sip buddy table. you might find below link useful:

best regards,

thanks for your help
in fact, i had no idea that i should run those commands in MySQL CLI
so everything works perfect now, besides one thing:
if i use the database to register sip users, the user registration is successful, i can make calls between users (the extensions are also extracted from the database), but whenever i try to use the MeetMe application, i get this error:

[Jul 27 17:35:41] WARNING[19859]: channel.c:3277 set_format: Unable to find a codec translation path from 0x100 (g729) to 0x2 (gsm)
[Jul 27 17:35:41] WARNING[19859]: file.c:992 ast_streamfile: Unable to open conf-getpin (format 0x100 (g729)): No such file or directory

i ran some tests, and i can use the MeetMe application when extensions are located in the database, but as soon as i point my sip users to the database rather than sip.conf, i get this error
any idea what could be the reason?

Codecs: You are running the free “passthough” version of the g729 codec and it wont convert to other codecs.

If you can get away with it, use ulaw (USA, Canada etc) or alaw (Europe. Aust, NZ etc). They take up 88K or so per channel as opposed to < 32K per channel with overhead. That will probably solve part of your problem.


Buy some g729 licenses :smile:

Let me know how you go

hello, well i would have loved to buy the licenses but unfortunately that’s not an option for me now lol
so i disallowed g729 from the available codecs, and everything works like a charm now, although i’m getting a warning saying:

[Jul 28 10:05:10] WARNING[22127]: channel.c:3277 set_format: Unable to find a codec translation path from 0x8 (alaw) to 0x400 (ilbc)

but the call is being established without problems, so i guess i can ignore it :unamused:
thanks again for your help



or allow=alaw, depending on where you are. If you set that for each SIP node, you wont have any codec conversions.

Also, check the settings in your iax.conf, you may have some stuff in there. The error looks like you have an ilbc setting hidden somewhere. (maybe even h323 or mgcp)

But it does work. Thats the main thing :smiley:

Glad to have helped.