chan-sccp / sccp_manager

SCCP Manager
21 stars 13 forks source link

SCCP line unset from device after editing extension under SCCP extension tab #89

Open marcelloc opened 1 year ago

marcelloc commented 1 year ago

Hi, first of all, this project is great! I'm using freepbx16 and sccp but I'm having some issues with line association image

Before editing user settings line is associated to device image

image After changing any settings here, saving and reloading

image line gets empty.

Looking at database, the sccpbuttonconfig for the instance that has the line associated, in this case instance 1 was deleted from database. image

If I reinsert it or associate the line again on sccp line tab, all gets working again.

image

Tried also with one or more lines associated to a device with same result/bahavior

cagriaksu commented 1 year ago

I also have this problem. When I make a change, the line button dissappears from phone and other speed-dial buttons move up. And when I re-associate the line, the button on top gets removed.

Did anyone also had this issue?

teldatip commented 1 year ago

I am having the same issue. Does anyone have a work around for this?? I would hate for this to be a reason why I go back to Cisco CME & just use the FreePBX as the voicemail for the cisco phones.....

marcelloc commented 1 year ago

I am having the same issue. Does anyone have a work around for this?? I would hate for this to be a reason why I go back to Cisco CME & just use the FreePBX as the voicemail for the cisco phones.....

I've wrote this php script that backups the working configuration and restores line config when it get lost on save config.

This is a workaround for the issue until it can get fixed

create /root/backup_buttonconfig/ dir on your freepbx

fix_sccp_line_config_on_database_after_save_config.txt

run it using crontab every minute `

teldatip commented 1 year ago

Thank you. This workaround worked. Much appreciated!!!!

On Sun, Apr 9, 2023 at 8:55 PM Marcello Coutinho @.***> wrote:

I am having the same issue. Does anyone have a work around for this?? I would hate for this to be a reason why I go back to Cisco CME & just use the FreePBX as the voicemail for the cisco phones.....

I've wrote this php script that backups the working configuration and restores line config when it get lost on save config.

This is a workaround for the issue until it can get fixed

create /root/backup_buttonconfig/ dir on your freepbx

`#!/usr/bin/php connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "select * from sccpbuttonconfig order by ref,instance"; $result = $conn->query($sql); $ref=""; $instance=1; if ($result->num_rows > 0) { // output data of each row //ref | reftype | instance | buttontype | name | options while($row = $result->fetch_assoc()) { if ($ref != $row['ref']) { $ref = $row['ref']; $instance = 1; } $file = "/root/backup_buttonconfig/$ref.$instance"; if ($instance == $row['instance']) { //fazer backup da configuracao //todo: melhorar a rotina para gravar o arquivo somente se a informação for diferente file_put_contents($file,serialize($row),LOCK_EX); } else { //restaurar configuracao if ($row['instance'] > $instance) { while ($instance < $row['instance']) { if (file_exists($file)) { $bkp = unserialize(file_get_contents($file)); echo "Restaurando configuracao da linha $instance no dispositivo $ref\n"; $sqli="insert into sccpbuttonconfig values('" . implode("','",$bkp) . "')"; $r2 = $conn->query($sqli); var_dump($sqli); var_dump($r2); $instance++; } else { echo "dispositivo $ref precisa de reconfiguração da linha $instance\n"; } $instance++; } } } if (in_array("debug",$argv)) { foreach ($row as $field => $data) { echo "$field=$data "; } echo "\n"; } //echo $row["ref"]. " - " . $row["reftype"]. " " . $row["instance"]. " " . $row["buttontype"] . " " . ; $instance++; } } else { echo "0 results"; } $conn->close(); ?>

`

— Reply to this email directly, view it on GitHub https://github.com/chan-sccp/sccp_manager/issues/89#issuecomment-1501360295, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6VQHBX2SYPLR5ESHXOJUB3XAOACLANCNFSM6AAAAAATFZGV2I . You are receiving this because you commented.Message ID: @.***>

teldatip commented 1 year ago

Ok. So I tried to run the same configuration in another FreePBX server with SCCP Manager installed with registered extensions that you sent me and it doesn't seem to be working. My thought is I may have not created the folder correctly. So to be clear, am I supposed to create a directory within the root directory and then create another file and place the script inside of there?

Thanks...

marcelloc commented 1 year ago

Create /root/backup_buttonconfig/ dir on your freepbx server and the script you can save on any path you want.

Don't forget to chmod +x the script and call it on cron every minute.

The script saves current "good" config and restore line settings every time it's missing a line on database.