Skip to content

Commit

Permalink
Copy migration.php into container
Browse files Browse the repository at this point in the history
  • Loading branch information
Stell0 committed Oct 31, 2023
1 parent 58a110c commit 787d636
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions freepbx/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ done
COPY var/www/html/freepbx/admin/libraries/BMO/Cron.class.php /var/www/html/freepbx/admin/libraries/BMO/Cron.class.php
COPY etc/amportal.conf /etc
COPY initdb.d/initdb.php /initdb.d/
COPY initdb.d/migration.php /initdb.d/
COPY usr/sbin/asterisk /usr/sbin/
COPY var/www/html/freepbx/push-proxy.php /var/www/html/freepbx/push-proxy.php
COPY usr/src/nethvoice/samples/* /usr/src/nethvoice/samples/
Expand Down
12 changes: 6 additions & 6 deletions freepbx/initdb.d/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@
$extensions = array_column($res, 'extension');

# set media_encryption to no in freepbx sip table
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'media_encryption' AND `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')";
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'media_encryption' AND `id` IN (".str_repeat('?, ', count($extensions) - 1) . '?'.")";
$stmt = $db->prepare($sql);
$stmt->execute($extensions);

# set srtp to true in rest_devices_phones table
$sql = "UPDATE `asterisk`.`rest_devices_phones` SET `srtp` = 1 WHERE `extension` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')";
$sql = "UPDATE `asterisk`.`rest_devices_phones` SET `srtp` = 1 WHERE `extension` IN (".str_repeat('?, ', count($extensions) - 1) . '?'.")";
$stmt = $db->prepare($sql);
$stmt->execute($extensions);

# configure proxy on all FreePBX extensions
$proxy_host = $_ENV['PUBLIC_IP'];
$proxy_port = 5060;

$sql = "UPDATE `asterisk`.`sip` SET `data` = ? WHERE `keyword` = 'outbound_proxy' AND `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')";
$sql = "UPDATE `asterisk`.`sip` SET `data` = ? WHERE `keyword` = 'outbound_proxy' AND `id` IN (".str_repeat('?, ', count($extensions) - 1) . '?'.")";
$stmt = $db->prepare($sql);
$stmt->execute(array_merge(['sip:'.$proxy_host.':'.$proxy_port], $extensions));

# set rtp_symmetric to no in freepbx sip table
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rtp_symmetric' WHERE `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')";
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rtp_symmetric' WHERE `id` IN (".str_repeat('?, ', count($extensions) - 1) . '?'.")";
$stmt = $db->prepare($sql);
$stmt->execute($extensions);

# set rewrite_contact to no in freepbx sip table
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rewrite_contact' WHERE `id` IN ('".str_repeat('?, ', count($extensions) - 1) . '?'."')";
$sql = "UPDATE `asterisk`.`sip` SET `data` = 'no' WHERE `keyword` = 'rewrite_contact' WHERE `id` IN (".str_repeat('?, ', count($extensions) - 1) . '?'.")";
$db->query($sql);
$stmt = $db->prepare($sql);
$stmt->execute($extensions);
$stmt->execute($extensions);

0 comments on commit 787d636

Please sign in to comment.