/* Plugin Name: SASBoss WooCommerce Integration Description: A plugin to integrate WooCommerce with SASBoss API. Version: 0.7.1 Author: 13VoIP Pty Ltd License: Commercial License */ if (!defined("ABSPATH")) { exit(); } // Define plugin constants define("SASBOSS_PLUGIN_VERSION", "0.7.1"); define("SASBOSS_PLUGIN_DIR", plugin_dir_path(__FILE__)); define("SASBOSS_PLUGIN_URL", plugin_dir_url(__FILE__)); define("SASBOSS_REPO_URL", "https://dev.azure.com/13VoIP/43846730-84a7-443b-94f3-8867387f3829/_apis/git/repositories/5b1f7dc9-a01f-4ae7-b22c-974daeb973f0/items?path=/&resolveLfs=true&%24format=zip&api-version=5.0&download=true"); // URL to download updates function sasboss_plugin_init() { require_once SASBOSS_PLUGIN_DIR . "admin/class-sasboss-admin.php"; require_once SASBOSS_PLUGIN_DIR . "admin/class-sasboss-api.php"; } add_action("plugins_loaded", "sasboss_plugin_init"); // Add custom action links for settings and check for updates add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'sasboss_add_action_links'); function sasboss_add_action_links($links) { $settings_link = '' . __('Settings', 'sasboss') . ''; $update_link = '' . __('Check for Updates', 'sasboss') . ''; return array_merge($links, array($settings_link, $update_link)); } function sasboss_activate() { // Minimum version requirements $min_php = "7.2"; // Minimum version of PHP required for the plugin $min_wp = "5.0"; // Minimum version of WordPress required for the plugin // Check PHP Version if (version_compare(PHP_VERSION, $min_php, "<")) { deactivate_plugins(plugin_basename(__FILE__)); wp_die(__("This plugin requires PHP version $min_php or higher.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Check WordPress Version if (version_compare(get_bloginfo("version"), $min_wp, "<")) { deactivate_plugins(plugin_basename(__FILE__)); wp_die(__("This plugin requires WordPress version $min_wp or higher.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Include the plugin.php file for is_plugin_active() function availability include_once ABSPATH . "wp-admin/includes/plugin.php"; // Check if WooCommerce is active if (!is_plugin_active("woocommerce/woocommerce.php")) { deactivate_plugins(plugin_basename(__FILE__)); // Deactivate your plugin wp_die(__("This plugin requires WooCommerce to be active.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Create database tables sasboss_create_database_tables(); // Schedule a daily event to check for updates if (!wp_next_scheduled("sasboss_daily_update_check")) { wp_schedule_event(time(), "daily", "sasboss_daily_update_check"); } } register_activation_hook(__FILE__, "sasboss_activate"); // Hook for plugin deactivation register_deactivation_hook(__FILE__, "sasboss_deactivate"); function sasboss_deactivate() { // Clean up any options or transient data if needed sasboss_cleanup(); // Clear scheduled update checks wp_clear_scheduled_hook("sasboss_daily_update_check"); } // Create database tables function sasboss_create_database_tables() { global $wpdb; $settings_table = $wpdb->prefix . "sasboss_settings"; $enterprises_table = $wpdb->prefix . "sasboss_enterprises"; $dashboard_table = $wpdb->prefix . "sasboss_dashboard"; $billing_table = $wpdb->prefix . "sasboss_billing"; $services_table = $wpdb->prefix . "sasboss_services"; $dids_table = $wpdb->prefix . "sasboss_dids"; $sales_table = $wpdb->prefix . "sasboss_sales"; $charset_collate = $wpdb->get_charset_collate(); $sql_settings = "CREATE TABLE IF NOT EXISTS $settings_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, api_url VARCHAR(255) DEFAULT '' NOT NULL, api_user VARCHAR(255) DEFAULT '' NOT NULL, api_password VARCHAR(255) DEFAULT '' NOT NULL, api_role VARCHAR(255) DEFAULT '' NOT NULL, reseller_id VARCHAR(255) DEFAULT '' NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_enterprises = "CREATE TABLE IF NOT EXISTS $enterprises_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, reseller_id VARCHAR(255) NOT NULL, enterprise_name VARCHAR(255) NOT NULL, enterprise_short_name VARCHAR(255) NOT NULL, default_domain VARCHAR(255) NOT NULL, imp_domain VARCHAR(255) NOT NULL, industry VARCHAR(255) NOT NULL, disable_retail_billing VARCHAR(5) NOT NULL, portal_password VARCHAR(255) NOT NULL, address TEXT NOT NULL, contact TEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_dashboard = "CREATE TABLE IF NOT EXISTS $dashboard_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, data_key VARCHAR(255) NOT NULL, data_value LONGTEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_billing = "CREATE TABLE IF NOT EXISTS $billing_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, enterprise_id MEDIUMINT(9) NOT NULL, invoice_id VARCHAR(255) NOT NULL, invoice_data LONGTEXT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (enterprise_id) REFERENCES $enterprises_table(id) ON DELETE CASCADE ) $charset_collate;"; $sql_services = "CREATE TABLE IF NOT EXISTS $services_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, service_name VARCHAR(255) NOT NULL, service_description TEXT NOT NULL, service_price DECIMAL(10, 2) NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_dids = "CREATE TABLE IF NOT EXISTS $dids_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, did_number VARCHAR(255) NOT NULL, did_description TEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_sales = "CREATE TABLE IF NOT EXISTS $sales_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, sale_amount DECIMAL(10, 2) NOT NULL, sale_date DATETIME NOT NULL, enterprise_id MEDIUMINT(9) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (enterprise_id) REFERENCES $enterprises_table(id) ON DELETE CASCADE ) $charset_collate;"; require_once ABSPATH . "wp-admin/includes/upgrade.php"; dbDelta($sql_settings); dbDelta($sql_enterprises); dbDelta($sql_dashboard); dbDelta($sql_billing); dbDelta($sql_services); dbDelta($sql_dids); dbDelta($sql_sales); // Insert default settings row if not exists $exists = $wpdb->get_var("SELECT COUNT(*) FROM $settings_table"); if ($exists == 0) { $wpdb->insert($settings_table, [ "api_url" => "", "api_user" => "", "api_password" => "", "api_role" => "", "reseller_id" => "", ]); } } // Clean up on deactivation function sasboss_cleanup() { global $wpdb; $table_name = $wpdb->prefix . "sasboss_settings"; if (get_option("sasboss_delete_data_on_deactivation") === "yes") { $wpdb->query("DROP TABLE IF EXISTS $table_name"); delete_option("sasboss_plugin_version"); delete_option("sasboss_delete_data_on_deactivation"); } } // Enqueue scripts and styles function sasboss_enqueue_admin_scripts($hook) { if (strpos($hook, "sasboss") === false) { return; } wp_enqueue_style("sasboss-admin-style", SASBOSS_PLUGIN_URL . "admin/css/admin-style.css"); wp_enqueue_script( "sasboss-admin-script", SASBOSS_PLUGIN_URL . "admin/js/admin-script.js", ["jquery"], SASBOSS_PLUGIN_VERSION, true ); } add_action("admin_enqueue_scripts", "sasboss_enqueue_admin_scripts"); // Check for updates function sasboss_check_for_updates() { $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info || is_wp_error($latest_version_info)) { return; } if (!isset($latest_version_info['version'])) { return; } $latest_version = $latest_version_info['version']; $zip_url = $latest_version_info['zip_url']; if (version_compare($latest_version, SASBOSS_PLUGIN_VERSION, ">")) { // Notify about the update $transient->response[plugin_basename(__FILE__)] = (object) [ 'new_version' => $latest_version, 'package' => $zip_url, 'slug' => plugin_basename(__FILE__), 'plugin' => plugin_basename(__FILE__), 'url' => SASBOSS_REPO_URL, ]; } } function sasboss_get_plugin_version() { $plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), false); return $plugin_data['Version']; } function sasboss_get_latest_version_info() { // Azure DevOps API URL to get the VERSION file content $url = "https://dev.azure.com/13VoIP/43846730-84a7-443b-94f3-8867387f3829/_apis/git/repositories/5b1f7dc9-a01f-4ae7-b22c-974daeb973f0/items?path=/VERSION&api-version=5.0"; $response = wp_remote_get($url); if (is_wp_error($response)) { return [ 'success' => false, 'message' => $response->get_error_message(), 'zip_url' => '' ]; } $body = wp_remote_retrieve_body($response); $version = trim($body); if (empty($version)) { return [ 'success' => false, 'message' => __('Version file not found or empty.', 'sasboss'), 'zip_url' => '' ]; } $zip_url = SASBOSS_REPO_URL; return [ 'success' => true, 'message' => __('Latest version info retrieved successfully.', 'sasboss'), 'version' => $version, 'zip_url' => $zip_url ]; } // Download and install update function sasboss_download_and_install_update($version, $zip_url) { $zip_file = download_url($zip_url); if (is_wp_error($zip_file)) { return; } // Rename the zip file $new_zip_file = dirname($zip_file) . '/sasboss plugin.zip'; rename($zip_file, $new_zip_file); // Define a temporary directory to unzip the file $temp_dir = wp_tempnam() . '-sasboss-update'; if (!mkdir($temp_dir) && !is_dir($temp_dir)) { return; } // Unzip the file to the temporary directory $result = unzip_file($new_zip_file, $temp_dir); // Delete the zip file after extracting unlink($new_zip_file); if (is_wp_error($result)) { return; } // Identify the correct source directory $unzipped_files = scandir($temp_dir); $source = $temp_dir; // Check if there's only one subdirectory and use it as the source $sub_dirs = array_values(array_diff($unzipped_files, ['.', '..'])); if (count($sub_dirs) === 1 && is_dir($temp_dir . '/' . $sub_dirs[0])) { $source = $temp_dir . '/' . $sub_dirs[0]; } // Ensure the correct plugin directory name $destination = WP_PLUGIN_DIR . "/sasboss plugin"; rename($source, $destination); // Clean up the temporary directory sasboss_remove_dir($temp_dir); // Update the plugin version update_option("sasboss_plugin_version", $version); } // Helper function to remove directory recursively function sasboss_remove_dir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (is_dir($dir . "/" . $object)) { sasboss_remove_dir($dir . "/" . $object); } else { unlink($dir . "/" . $object); } } } rmdir($dir); } } // Add manual update check to settings page add_action("admin_init", "sasboss_manual_check_for_updates"); function sasboss_manual_check_for_updates() { if (isset($_GET["check_for_updates"])) { $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info['success']) { $_SESSION['update_message'] = $latest_version_info['message']; $_SESSION['update_success'] = false; $_SESSION['zip_url'] = $latest_version_info['zip_url']; } else { $_SESSION['update_message'] = __('Update check completed successfully.', 'sasboss'); $_SESSION['update_success'] = true; $_SESSION['zip_url'] = $latest_version_info['zip_url']; } // Redirect to the appropriate page if (isset($_GET["page"]) && $_GET["page"] === "sasboss-settings") { wp_redirect(admin_url("admin.php?page=sasboss-settings&update_checked=1")); } else { wp_redirect(admin_url("plugins.php?plugin_status=all&update_checked=1")); } exit(); } } function sasboss_admin_hooks() { if (!current_user_can("manage_options")) { wp_die(__("You do not have sufficient permissions to access this page.", "sasboss")); } add_action("admin_menu", "sasboss_add_admin_menu"); } add_action("admin_init", "sasboss_admin_hooks"); function sasboss_add_admin_menu() { $admin = new SASBoss_Admin(); } function sasboss_display_warning_message() { echo '
'; echo '

' . __("Note: Data may be up to 10 minutes old. We are working towards realtime data feeds in later versions.", "sasboss") . '

'; echo '
'; } add_action('woocommerce_account_dashboard', 'sasboss_display_warning_message'); // Check for plugin updates and show message on plugins page add_filter('pre_set_site_transient_update_plugins', 'sasboss_check_for_plugin_updates'); function sasboss_check_for_plugin_updates($transient) { if (empty($transient->checked)) { return $transient; } // Get the plugin data $plugin_version = SASBOSS_PLUGIN_VERSION; // Check for updates $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info || is_wp_error($latest_version_info)) { return $transient; } $latest_version = $latest_version_info['version']; $zip_url = $latest_version_info['zip_url']; if (version_compare($plugin_version, $latest_version, '<')) { $plugin_slug = plugin_basename(__FILE__); $transient->response[$plugin_slug] = (object) [ 'slug' => $plugin_slug, 'new_version' => $latest_version, 'url' => SASBOSS_REPO_URL, 'package' => $zip_url, ]; } return $transient; } ?>
Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/wp-content/plugins/sasboss plugin/sasboss.php:1) in /home/site/wwwroot/wp-content/plugins/wp-seopress/inc/functions/options-advanced.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/wp-content/plugins/sasboss plugin/sasboss.php:1) in /home/site/wwwroot/wp-content/plugins/wp-seopress/inc/functions/options-advanced.php on line 110

Deprecated: Creation of dynamic property RevsliderDiviModule::$icon_path is deprecated in /home/site/wwwroot/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1425
What Is a VoIP Phone System and How Does It Work? | Cloud Business Phone System | 13VoIP

Gone are the days when we relied on traditional landline phones to communicate. As technology races forward, we now have more efficient, cost-effective, and flexible communication methods. VoIP (Voice over Internet Protocol) is one such breakthrough that has disrupted the way we communicate. In this blog post, we’ll dive deep into the world of VoIP phone systems and uncover how they work, ultimately transforming our conversations.


The VoIP Revolution:

VoIP is a digital communication system that allows us to make phone calls over the internet instead of conventional phone lines. In a nutshell, VoIP converts voice signals into digital packets, which are then transmitted over the internet to the recipient, where they’re converted back into voice signals. This modern marvel offers a myriad of benefits, including lower costs, enhanced features, and unmatched flexibility.


How VoIP Phone Systems Work:

Voice Conversion: The process begins with the conversion of analog voice signals into digital data packets. This is achieved using a device called an Analog Telephone Adapter (ATA) or specialized VoIP phones with built-in converters.

Data Packet Transmission: Once the voice signals are converted into digital data packets, they are compressed and divided into smaller packets. These smaller packets are then sent over the internet using the Internet Protocol (IP) to the intended recipient.

Reassembling and Decoding: Upon reaching the recipient’s end, the digital data packets are reassembled and converted back into analog voice signals, which can be heard by the receiver. This process happens in real-time, ensuring smooth and clear conversations.


VoIP Phone System Essentials

To set up a VoIP phone system, you will need the following components:

High-speed internet connection: A stable and fast internet connection is essential for seamless VoIP communication. A bandwidth of at least 100 Kbps per phone line is recommended to ensure optimal call quality.

VoIP service provider: Choose a reliable VoIP service provider that offers features tailored to your business or personal needs. Research the provider’s reputation, customer support, and pricing plans before making a decision.

VoIP-compatible hardware: You will need either an ATA, IP phones, or softphones (software-based phones installed on a computer or mobile device) to make VoIP calls.

VoIP-enabled PBX (Private Branch Exchange): For businesses, a VoIP-enabled PBX can handle call routing, extensions, and advanced features such as voicemail, call forwarding, and conferencing.


Advantages of VoIP Phone Systems

Cost savings: VoIP significantly reduces both local and international call charges compared to traditional phone systems, leading to substantial savings for individuals and businesses alike.

Enhanced features: VoIP phone systems come packed with advanced features like call forwarding, voicemail-to-email, video conferencing, and virtual phone numbers, improving communication efficiency.

Scalability: VoIP systems can be easily scaled up or down to match your changing communication needs, making them perfect for growing businesses.

Mobility: VoIP allows you to make and receive calls from any device with an internet connection, providing unmatched mobility and flexibility for remote workers or frequent travelers.



VoIP phone systems have revolutionized the way we communicate, offering unparalleled cost savings, enhanced features, and seamless integration with modern technology. By understanding the inner workings of VoIP and its advantages, you can make informed decisions about adopting this powerful communication tool for your personal or business needs. Embrace the VoIP revolution and step into the future of telecommunications!