I have run /usr/local/fop2/autoconfig_buttons_freepbx.sh both with and without fop2admin.
When the fop2admin plugin installed, I can't see any extensions except ZAP/G0 and ZAP/G1.
When the fop2admin plugin uninstalled, I can see all the extension buttons.
I looked into the shell script /usr/local/fop2/autoconfigure_buttons_freepbx.sh and I realized that the script
actually retrieve the extension buttons from the table fop2buttons when it found there is fop2admin plugin as shown below:-
mysql -ENB -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME -e \
"SELECT device AS channel,type,if(type<>'trunk',exten,'') AS extension,\
label,mailbox,context,'$QUEUECONTEXT' as queuecontext,concat('*',mailbox) AS extenvoicemail, \
privacy,\`group\`,IF(type='trunk',IF(email<>'',concat('splitme-',email),''),email) as email, \
queuechannel,originatechannel FROM fop2buttons WHERE device NOT LIKE 'USER/%' AND device<>'' \
ORDER BY type,exten" | sed '/\*\*/d' | sed 's/: /=/g' | sed '/.*=$/d' | while read LINEA
So, I open and view the data in the table fop2buttons, and I noticed that there only 3 records which are the
ZAP/G0, ZAP/G1 and Park/default? Where are the extensions? I can only found them in table fop2users???
HI
I have realised the real issue that actually causing all extensions gone.
That is the "Apply Configure change" red button on top screwed up the whole thing!!! (I am running on FreePBX 2.2.1)
When I select fop2admin from Module Admin and click on "process", and then click on "confirm" button to complete the installation, I immediately login into mysql and look into table fop2buttons and I can see all the extensions are there. However, when I click on the red button "Apply configuration changes" on top, and I try view the table again, all extension are gone except the last 3 records??? how come like that?
I have finally fixed my problem by editing the PHP script in /var/www/html/admin/modules/fop2admin.
In the PHP file functions.inc.php, I comment the following statement, then ev erything is working fine for now.
Cheers!
Best regards,
Chu
// fop2_del_button($boton_id_a_borrar);
<?php
function fop2admin_get_config($engine) {
// Executed on APPLY in FreePBX, we regenerate the fop2buttons if needed
global $amp_conf, $db, $active_modules;
Another issue is the user deletion, when I delete FOP user, it did not delete user from the fop2uttons.
So, I have edit the functions.inc.php again to look for the function statement fop2_del_user($id),
and I added a new line to delete the user from fop2buttons using the exten field.
Cheers!
Regards,
Chu
function fop2_del_user($id) {
$id = intval($id);
$thisItem = fop2_get_user($id);
$exten = $thisItem;
$results = sql("DELETE FROM fop2UserGroup WHERE exten = '$exten'","query");
$results = sql("DELETE FROM fop2users WHERE id = '$id'","query");
[color=#FF0000:3pgvj4ls]$results = sql("DELETE FROM fop2buttons WHERE exten = '$exten'","query");[/color:3pgvj4ls]
Comments
/usr/local/fop2/autoconfig-buttons-freepbx.sh
And look at the output.
Did you make some changes to fop2.cfg ? Did you install the fop2admin module ?
I have run /usr/local/fop2/autoconfig_buttons_freepbx.sh both with and without fop2admin.
When the fop2admin plugin installed, I can't see any extensions except ZAP/G0 and ZAP/G1.
When the fop2admin plugin uninstalled, I can see all the extension buttons.
I looked into the shell script /usr/local/fop2/autoconfigure_buttons_freepbx.sh and I realized that the script
actually retrieve the extension buttons from the table fop2buttons when it found there is fop2admin plugin as shown below:-
mysql -ENB -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME -e \
"SELECT device AS channel,type,if(type<>'trunk',exten,'') AS extension,\
label,mailbox,context,'$QUEUECONTEXT' as queuecontext,concat('*',mailbox) AS extenvoicemail, \
privacy,\`group\`,IF(type='trunk',IF(email<>'',concat('splitme-',email),''),email) as email, \
queuechannel,originatechannel FROM fop2buttons WHERE device NOT LIKE 'USER/%' AND device<>'' \
ORDER BY type,exten" | sed '/\*\*/d' | sed 's/: /=/g' | sed '/.*=$/d' | while read LINEA
So, I open and view the data in the table fop2buttons, and I noticed that there only 3 records which are the
ZAP/G0, ZAP/G1 and Park/default? Where are the extensions? I can only found them in table fop2users???
Can anyone please advise me what is gone here?
Thankyou and best regards,
Chu
I have realised the real issue that actually causing all extensions gone.
That is the "Apply Configure change" red button on top screwed up the whole thing!!! (I am running on FreePBX 2.2.1)
When I select fop2admin from Module Admin and click on "process", and then click on "confirm" button to complete the installation, I immediately login into mysql and look into table fop2buttons and I can see all the extensions are there. However, when I click on the red button "Apply configuration changes" on top, and I try view the table again, all extension are gone except the last 3 records??? how come like that?
Regards,
Chu
I have finally fixed my problem by editing the PHP script in /var/www/html/admin/modules/fop2admin.
In the PHP file functions.inc.php, I comment the following statement, then ev erything is working fine for now.
Cheers!
Best regards,
Chu
// fop2_del_button($boton_id_a_borrar);
<?php
function fop2admin_get_config($engine) {
// Executed on APPLY in FreePBX, we regenerate the fop2buttons if needed
global $amp_conf, $db, $active_modules;
$fopbutton = fop2_all_freepbx_buttons();
$botonesdefinidos = fop2_list_botones();
foreach ($botonesdefinidos as $devname => $datarray) {
if(!array_key_exists($devname,$fopbutton)) {
$results = sql("SELECT id FROM fop2buttons WHERE device='$devname'","getRow",DB_FETCHMODE_ASSOC);
$boton_id_a_borrar = $results;
[color=#0040FF:14yvsbpm]// fop2_del_button($boton_id_a_borrar);[/color:14yvsbpm]
}
}
Another issue is the user deletion, when I delete FOP user, it did not delete user from the fop2uttons.
So, I have edit the functions.inc.php again to look for the function statement fop2_del_user($id),
and I added a new line to delete the user from fop2buttons using the exten field.
Cheers!
Regards,
Chu
function fop2_del_user($id) {
$id = intval($id);
$thisItem = fop2_get_user($id);
$exten = $thisItem;
$results = sql("DELETE FROM fop2UserGroup WHERE exten = '$exten'","query");
$results = sql("DELETE FROM fop2users WHERE id = '$id'","query");
[color=#FF0000:3pgvj4ls]$results = sql("DELETE FROM fop2buttons WHERE exten = '$exten'","query");[/color:3pgvj4ls]