Add new extension by changing directly Asterisk database

Hello there,
I’m developping an web interface that do the provisionning of Sip extentions. I have Asterisk and freepbx installed in a Centos Os.
I looked up all the tables in Asterisk database using Mysql, and i found ‘all’ the tables and field that are related to an extention, and i’ve done the same thing to create a new extention directly in the database. i executed afterwards the /var/lib/asterisk/bin/retrieve_conf script.
When browzing in the freepbx extention web page, i noticed that the extention that i added exists. i use a harphone, and when i put this extension on it, i can only have incomming calls( from other Extentions to this Extention added) .
i have those warnings :
[2013-08-21 11:15:24] WARNING[10449]: ast_expr2.fl:445 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected ‘>’, expecting $end; Input:

[2013-08-21 11:15:24] WARNING[10449]: ast_expr2.fl:449 ast_yyerror: If you have questions, please refer to doc/tex/channelvariables.tex.
[2013-08-21 11:15:24] WARNING[10449]: func_logic.c:188 acf_if: Syntax IF(?[][:]) (expr must be non-null, and either or must be non-null)
[2013-08-21 11:15:24] WARNING[10449]: func_logic.c:189 acf_if: In this case, =’’, =’’, and =‘15’

Have you a hint ?
thanks you :slight_smile:

Technically the mysql tables you found are part of the FreePBX database. Asterisk uses it’s own internal database and you will need to seed those values appropriately also.

Thank you for your reply, it confirms my depths.
Now the question is that i want to seed this those values to asterisk database using the informations in the freepbx database, in another words, i have to simulate the ‘submit’ button in the buttom of the freepbx Extention webpage. Is it possible? or i have to seed those fields directly in asterisk console?

Thank you

what you are trying to do is a bad idea.

Even if you figure out all the places that should be updated, they can change from release to release.

You should be using the FreePBX API calls. Unfortunately, adding/updating extensions is one of the ‘ugliest’ as those are very old and badly written meaning they are dependent on lots of various values being in the _REQUEST[] array. They’ve been slated to be modified which may likely happen in 2.12 so that they are much easier to call but in the meantime that is the reality.

You can look at something like the Bulk Extension’s module as an example of code that sets up and configures those.

I can but agree with everything Phillippe has to say, with the exception of that it is a “bad idea”. It’s a great idea, just difficult to implement right now :wink:

I succeded on developpin a script that does the double job of adding a new extension on both asterisk and freepbx databases. It’s like simulating the work of the freepbx web interface. Thank you for your replies :slight_smile:

Congratulations :slight_smile:

For voicemail funcionality, you will need to massage a third database that the comedian mail application uses, the flatform /etc/asterisk/voicemail.conf

Thank you dicko :wink:

For voicemail , i will check up your suggestion , thank you :slight_smile:

Hello Smox,

I’m trying to do the exact same task but for trunks, could you share the process you follow to discover all the spots where configuration changes need to be done?

Best regards

Hello Jlopez,
Im doing this work for à company as my internship , i dont think they will accept sharing the process… i will ask the boss anyway.
I have to do the same work too for DID & trunks. I will tell you more if found more about trunks. All you have to do is to browse the Mysql database for freepbx, and see all the tables, and locate those of your interest. it’s quite a long work, but it a working method.
good luck :slight_smile: and we stay in touch

It’s fine, I’ll look for the tables then, have a great day =)

This is an Open Source project. You come here for help then won’t share back. Please show this to your boss and tell him to be part of the community or don’t ask for help.

It also sounds like he is using FreePBX for something it was not designed for.

I successfully created a script for adding|editing|removing trunks, I use it against elastic setups, however it may be useful to freepbx users as well.