SQL DATABASE clears information when open freepbx webpage

Hi there,

I have a problem with asterisk sql database.

I wrote directly extensions or sip information or followme information, in the database using SQL commands, i list the tables and seem’s ok.

But, after i opened the webpage of freepbx, not pressing the orange/bar in the top of the page, just to saw the modifications i have made in sql, the changes i had made wasn’t there, actually the freepbx doesn’t update the information.

Just simple opening the Freepbx Webpage, it write values automatically in the SQL database, replacing the information i was put there throw the sql command in the database.

A Little Exemple

mysql> use asterisk
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables
-> ;
±-------------------------------------+
| Tables_in_asterisk |
±-------------------------------------+
| admin |
| ampusers |
| findmefollow |
60 rows in set (0.00 sec)

//////// I saw the contents of the findmefollow table////////

mysql> select * from findmefollow
-> ;
±-------±----------±--------±-------±------------------------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
| grpnum | strategy | grptime | grppre | grplist | annmsg_id | postdest | dring | remotealert_id | needsconf | toolate_id | pre_ring | ringing |
±-------±----------±--------±-------±------------------------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
| 2200 | ringallv2 | 10 | | 2200-3200#-4200#-912345 | 0 | from-did-direct,777,1 | | 0 | | 0 | 0 | Ring |
±-------±----------±--------±-------±------------------------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
1 row in set (0.00 sec)

////// I want to change the grpList value from 2200-3200#-4200#-912345 to 1999, for example.
I excute the command to update database value////

mysql> update findmefollow set grplist=1999
-> ;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

////////// and I can see the changes////

mysql> select * from findmefollow
-> ;
±-------±----------±--------±-------±--------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
| grpnum | strategy | grptime | grppre | grplist | annmsg_id | postdest | dring | remotealert_id | needsconf | toolate_id | pre_ring | ringing |
±-------±----------±--------±-------±--------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
| 2200 | ringallv2 | 10 | | 1999 | 0 | from-did-direct,777,1 | | 0 | | 0 | 0 | Ring |
±-------±----------±--------±-------±--------±----------±----------------------±------±---------------±----------±-----------±---------±--------+
1 row in set (0.00 sec)

/////// Now, when i open the freepbx webpage i saw in the followme option, of the extension(2200) the values are not (1999) as i expected, appears the old values(2200-3200#-4200#-912345) and when i go again to see the database values is already changed again with the old values too(2200-3200#-4200#-912345).
//////////

So anyone can help me with this?

How can i do the changes directly in sql database, assuming that changes update too in freepbx, and not from freepbx to sql.???

best regards
PM
(newbie mode activated) :slight_smile:

Writing directly to the SQL tables to add/edit/delete extensions will not work.

Others can chime in as to why it will not work. There are probable other threads that discuss why it will not work.

It’s won’t work because you also need to update the astdb and write out the dialplan to the Asterisk config files.

This is what the FreePBX framework is all about.

Hi,

And how i can do that?

Can you explain me, pls?

for follow-me you will need to change for example 1120:-

rasterisk -x “database show AMPUSER 1120/followme”

/AMPUSER/1120/followme/ddial : EXTENSION
/AMPUSER/1120/followme/grpconf : DISABLED
/AMPUSER/1120/followme/grplist : 1120-13230000000#
/AMPUSER/1120/followme/grptime : 30
/AMPUSER/1120/followme/prering : 4

to the asterisk database

rasterisk -x "database put AMPUSER 1120/followme/ddial EXTENSION"
rasterisk -x "database put AMPUSER 1120/followme/grpconf ENABLED"
rasterisk -x "database put AMPUSER 1120/followme/grplist 1120-13235551212# "
rasterisk -x "database put AMPUSER 1120/followme/grptime 60"
rasterisk -x “database put AMPUSER 1120/followme/prering 12”

This is just an example but the methodology will work for any “insertion” if you mess with numberss, then you need to mess with sip iax users and devices as appropriate.

Then do the mysql stuff, then run

/var/lib/asterisk/bin/retrieve_conf

when your done to “set” the data if necessary.

So a one-liner might be something like

rasterisk -x “database put AMPUSER 2200/followme/grplist 1999”&& mysql -p[password] -u[user] -D asterisk -e “UPDATE findmefollow SET grplist=‘1999’ WHERE grpnum =‘2200’”&&/var/lib/asterisk/bin/retrieve_conf