Paul Posted January 26, 2018 Report Share Posted January 26, 2018 A new TeamSpeak 3 alpha module is available. To install, download the attached teamspeak.zip and unzip the file. Upload the teamspeak directory to ~/components/modules/ and go to Settings > Company > Modules to install it. Any bugs, comments, or suggestions, please post them below. Michael, Blesta Addons, activa and 1 other 2 2 Quote Link to comment Share on other sites More sharing options...
augesrob Posted October 21, 2018 Report Share Posted October 21, 2018 Some reason i cant bind to port using serveradmin and <correct password> what username and pass would i use? Quote Link to comment Share on other sites More sharing options...
elzek1 Posted May 23, 2019 Report Share Posted May 23, 2019 Hello Paul I have installed the module and it has no suspend function, it only has cancel. the problem with the cancel function is that it permanently deletes the service and does not fulfill the same function as suspend. Quote Link to comment Share on other sites More sharing options...
Tyson Posted May 23, 2019 Report Share Posted May 23, 2019 Cancellations typically remove the account from the service, so it would make sense for the canceled service to delete the server on Teamspeak. It doesn't look like the Teamspeak API supports any type of service suspension, so the module doesn't support suspensions in Blesta. What is the behavior you are expecting? Quote Link to comment Share on other sites More sharing options...
elzek1 Posted May 24, 2019 Report Share Posted May 24, 2019 6 hours ago, Tyson said: Cancellations typically remove the account from the service, so it would make sense for the canceled service to delete the server on Teamspeak. It doesn't look like the Teamspeak API supports any type of service suspension, so the module doesn't support suspensions in Blesta. What is the behavior you are expecting? Hello Tyson Previously I used whmcs and when the service went into suspension, 2 things happened: 1.- Virtual server was stopped 2.- Auto-start function disabled, this in case vps was restarted vitual server client did not start. Quote Link to comment Share on other sites More sharing options...
elzek1 Posted May 24, 2019 Report Share Posted May 24, 2019 Hello I added functions to code of this module. Whit this code suspend and unsuspend works fine, please check it: Teamspeak.php suspend function: public function suspendService($package, $service, $parent_package = null, $parent_service = null) { $row = $this->getModuleRow(); $api = $this->getApi( $row->meta->hostname, $row->meta->username, $row->meta->password, $row->meta->port ); if (!$row) { $this->Input->setErrors( ['module_row' => ['missing' => Language::_('Teamspeak.!error.module_row.missing', true)]] ); return; } // Get service parameters $service_fields = $this->serviceFieldsToObject($service->fields); // Modify "virtualserver_autostart" to 0 $this->parseResponse($api->suspendServer($service_fields->teamspeak_sid)); // Stop server $this->parseResponse($api->stopServer($service_fields->teamspeak_sid)); return null; } Teamspeak.php unsuspend function: public function unsuspendService($package, $service, $parent_package = null, $parent_service = null) { $row = $this->getModuleRow(); $api = $this->getApi( $row->meta->hostname, $row->meta->username, $row->meta->password, $row->meta->port ); if (!$row) { $this->Input->setErrors( ['module_row' => ['missing' => Language::_('Teamspeak.!error.module_row.missing', true)]] ); return; } // Get service parameters $service_fields = $this->serviceFieldsToObject($service->fields); // Modify "virtualserver_autostart" to 1 $this->parseResponse($api->unsuspendServer($service_fields->teamspeak_sid)); // Start server $this->parseResponse($api->startServer($service_fields->teamspeak_sid)); return null; } These codes call two new functions in teamspeak_api.php: teamspeak_api.php suspendserver function: public function suspendServer($sid) { try { // Build the parameters array $api_params = [ 'virtualserver_autostart' => 0 ]; // Fetch the virtual server instance, and modify it $instance = $this->apiRequest('serverquery')->serverList()[$sid]; $result = $instance->modify($api_params); // Add a control variable to know if the API request has been send successfully if (empty($result['error'])) { $result['status'] = true; } } catch (Exception $e) { $result = [ 'error' => $e->getMessage(), 'status' => false, 'code' => $e->getCode() ]; } return (object) $result; } teamspeak_api.php unsuspendserver function: public function unsuspendServer($sid) { try { // Build the parameters array $api_params = [ 'virtualserver_autostart' => 1 ]; // Fetch the virtual server instance, and modify it $instance = $this->apiRequest('serverquery')->serverList()[$sid]; $result = $instance->modify($api_params); // Add a control variable to know if the API request has been send successfully if (empty($result['error'])) { $result['status'] = true; } } catch (Exception $e) { $result = [ 'error' => $e->getMessage(), 'status' => false, 'code' => $e->getCode() ]; } return (object) $result; } That is all, i attached file if someone wants to donwnload it teamspeak.php teamspeak_api.php Quote Link to comment Share on other sites More sharing options...
Tyson Posted May 24, 2019 Report Share Posted May 24, 2019 Do you have a link to their API documentation? If their system will observe that 'virtualserver_autostart' option and not let the user start a suspended server, then we can update the module to add service suspensions/unsuspensions as you have. Quote Link to comment Share on other sites More sharing options...
elzek1 Posted May 24, 2019 Report Share Posted May 24, 2019 https://docs.planetteamspeak.com/ts3/php/framework/ On suspend Mode all option are disable from client side Tyson and activa 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.