I don't see a problem in the code. Take a look to this video. It shows the publish/unpublish actions done by both an Administrator and a Teacher.
There are two parts in this video. In the first part both actions (publish and unpublish) are executed by both users (Administrator and Teacher) using our (Blindside Networks) private infrastructure. There is a delay when executing the action because the way we queue the actions. But still the action is executed.
In the second part I am using test-install (the server that comes pre-configured by default) and the actions are executed immediately. There is no queue for the requests because it is a single server.
Because the response you are getting you may want to activate the console and see if there is another error triggered.
Also, you may want to add this two lines:
error_log('Took ' . $this->info['total_time'] . ' seconds to send a request to ' . $this->info['url']); error_log($this->info['http_code']);
To the file
In the line 3182
$this->info = curl_getinfo($curl);
This way you can see in the logs if the Bigbluebutton server is responding correctly to the requests.