@ -47,8 +47,8 @@ class OpenMeetingsGateway
$this->rest = new OpenMeetingsRestService();
$this->rest = new OpenMeetingsRestService();
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Constructor error: ' . $err);
error_log('Constructor error: '.$err);
error_log('Debug: ' . $this->rest->getDebug());;
error_log('Debug: '.$this->rest->getDebug()); ;
exit();
exit();
}
}
}
}
@ -59,7 +59,7 @@ class OpenMeetingsGateway
*/
*/
public function getRestUrl($name)
public function getRestUrl($name)
{
{
return $this->getUrl() . "/services/" . $name . "/";
return $this->getUrl()."/services/".$name."/";
}
}
/**
/**
@ -89,30 +89,30 @@ class OpenMeetingsGateway
public function loginUser()
public function loginUser()
{
{
$returnValue = 0;
$returnValue = 0;
$response = $this->rest->call($this->getRestUrl("UserService") . "getSession", "session_id");
$response = $this->rest->call($this->getRestUrl("UserService")."getSession", "session_id");
if ($this->rest->getError()) {
if ($this->rest->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($response, 1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($response, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Error: ' . $err);
error_log('Error: '.$err);
} else {
} else {
//error_log('getSession returned '.$response. ' - Storing as sessionId');
//error_log('getSession returned '.$response. ' - Storing as sessionId');
$this->sessionId = $response;
$this->sessionId = $response;
$url = $this->getRestUrl("UserService")
$url = $this->getRestUrl("UserService")
. "loginUser?"
. "loginUser?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& username=" . $this->_user
. "& username=".$this->_user
. "& userpass=" . $this->_pass;
. "&userpass=".$this->_pass;
$result = $this->rest->call($url);
$result = $this->rest->call($url);
if ($this->rest->getError()) {
if ($this->rest->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Error '. $err);
error_log('Error '.$err);
} else {
} else {
$returnValue = $result;
$returnValue = $result;
}
}
@ -135,8 +135,8 @@ class OpenMeetingsGateway
{
{
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Constructor error: ' . $err);
error_log('Constructor error: '.$err);
error_log('Debug: ' . $this->rest->getDebug());
error_log('Debug: '.$this->rest->getDebug());
exit();
exit();
}
}
@ -146,17 +146,17 @@ class OpenMeetingsGateway
}
}
$url = $this->getRestUrl($this->getRestUrl("RoomService")
$url = $this->getRestUrl($this->getRestUrl("RoomService")
. "updateRoomWithModeration?SID=" . $this->sessionId
. "updateRoomWithModeration?SID=".$this->sessionId
. "& room_id=" . $room->room_id
. "& room_id=".$room->room_id
. "& name=" . urlencode($room->name)
. "& name=".urlencode($room->name)
. "& roomtypes_id=" . $room->roomtypes_id
. "& roomtypes_id=".$room->roomtypes_id
. "& comment=" . $room->comment
. "& comment=".$room->comment
. "& numberOfPartizipants=" . $room->numberOfPartizipants
. "& numberOfPartizipants=".$room->numberOfPartizipants
. "& ispublic=false"
. "& ispublic=false"
. "& appointment=false"
. "& appointment=false"
. "& isDemoRoom=false"
. "& isDemoRoom=false"
. "& demoTime=0"
. "& demoTime=0"
. "& isModeratedRoom=" . $this->var_to_str($isModeratedRoom));
. "&isModeratedRoom=".$this->var_to_str($isModeratedRoom));
//error_log($url);
//error_log($url);
$result = $this->rest->call($url);
$result = $this->rest->call($url);
@ -165,14 +165,14 @@ class OpenMeetingsGateway
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Error: ' . $err);
error_log('Error: '.$err);
} else {
} else {
// echo '< h2 > Result< / h2 > < pre > '; print_r($result["return"]); echo '< / pre > ';
// echo '< h2 > Result< / h2 > < pre > '; print_r($result["return"]); echo '< / pre > ';
//error_log('Room updated successfully '.print_r($result,1));
//error_log('Room updated successfully '.print_r($result,1));
return $result;
return $result;
}
}
}
}
return - 1;
return -1;
}
}
/**
/**
@ -188,13 +188,13 @@ class OpenMeetingsGateway
{
{
$result = $this->rest->call($this->getRestUrl("UserService")
$result = $this->rest->call($this->getRestUrl("UserService")
. 'setUserObjectAndGenerateRecordingHashByURL?'
. 'setUserObjectAndGenerateRecordingHashByURL?'
. 'SID=' . $this->sessionId
. 'SID='.$this->sessionId
. '& username=' . urlencode($username)
. '& username='.urlencode($username)
. '& firstname=' . urlencode($firstname)
. '& firstname='.urlencode($firstname)
. '& lastname=' . urlencode($lastname)
. '& lastname='.urlencode($lastname)
. '& externalUserId=' . $userId
. '& externalUserId='.$userId
. '& externalUserType=' . urlencode($systemType)
. '& externalUserType='.urlencode($systemType)
. '& recording_id=' . $recording_id, 'return');
. '& recording_id='.$recording_id, 'return');
if ($result->fault) {
if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
@ -206,7 +206,7 @@ class OpenMeetingsGateway
return $result;
return $result;
}
}
}
}
return - 1;
return -1;
}
}
/**
/**
@ -226,28 +226,28 @@ class OpenMeetingsGateway
{
{
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Constructor error: ' . $err);
error_log('Constructor error: '.$err);
error_log('Debug: ' . $this->rest->getDebug());;
error_log('Debug: '.$this->rest->getDebug()); ;
exit();
exit();
}
}
$result = $this->rest->call($this->getRestUrl("UserService")
$result = $this->rest->call($this->getRestUrl("UserService")
. "setUserObjectAndGenerateRoomHashByURLAndRecFlag?"
. "setUserObjectAndGenerateRoomHashByURLAndRecFlag?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& username=" . urlencode($username)
. "& username=".urlencode($username)
. "& firstname=" . urlencode($firstname)
. "& firstname=".urlencode($firstname)
. "& lastname=" . urlencode($lastname)
. "& lastname=".urlencode($lastname)
. "& profilePictureUrl=" . urlencode($profilePictureUrl)
. "& profilePictureUrl=".urlencode($profilePictureUrl)
. "& email=" . urlencode($email)
. "& email=".urlencode($email)
. "& externalUserId=" . urlencode($userId)
. "& externalUserId=".urlencode($userId)
. "& externalUserType=" . urlencode($systemType)
. "& externalUserType=".urlencode($systemType)
. "& room_id=" . urlencode($room_id)
. "& room_id=".urlencode($room_id)
. "& becomeModeratorAsInt=" . $becomeModerator
. "& becomeModeratorAsInt=".$becomeModerator
. "& showAudioVideoTestAsInt=1"
. "& showAudioVideoTestAsInt=1"
. "& allowRecording=" . $this->var_to_str($allowRecording));
. "&allowRecording=".$this->var_to_str($allowRecording));
if ($result->fault) {
if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
@ -257,7 +257,7 @@ class OpenMeetingsGateway
return $result;
return $result;
}
}
}
}
return - 1;
return -1;
}
}
/**
/**
@ -268,15 +268,15 @@ class OpenMeetingsGateway
{
{
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
error_log('Constructor error: ' . $err);
error_log('Constructor error: '.$err);
error_log('Debug: ' . $this->rest->getDebug());
error_log('Debug: '.$this->rest->getDebug());
exit();
exit();
}
}
$url = $this->getRestUrl("RoomService")."deleteRoom?SID=".$this->sessionId."&rooms_id=".$openmeetings->room_id;
$url = $this->getRestUrl("RoomService")."deleteRoom?SID=".$this->sessionId."&rooms_id=".$openmeetings->room_id;
$result = $this->rest->call($url);
$result = $this->rest->call($url);
if ($result->fault) {
if ($result->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
@ -287,7 +287,7 @@ class OpenMeetingsGateway
return $result;
return $result;
}
}
}
}
return - 1;
return -1;
}
}
/**
/**
@ -297,20 +297,20 @@ class OpenMeetingsGateway
{
{
$result = $this->rest->call($this->getRestUrl("UserService")
$result = $this->rest->call($this->getRestUrl("UserService")
. "setUserObjectAndGenerateRoomHash?"
. "setUserObjectAndGenerateRoomHash?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& username=" . urlencode($username)
. "& username=".urlencode($username)
. "& firstname=" . urlencode($firstname)
. "& firstname=".urlencode($firstname)
. "& lastname=" . urlencode($lastname)
. "& lastname=".urlencode($lastname)
. "& profilePictureUrl=" . urlencode($profilePictureUrl)
. "& profilePictureUrl=".urlencode($profilePictureUrl)
. "& email=" . urlencode($email)
. "& email=".urlencode($email)
. "& externalUserId=" . urlencode($externalUserId)
. "& externalUserId=".urlencode($externalUserId)
. "& externalUserType=" . urlencode($externalUserType)
. "& externalUserType=".urlencode($externalUserType)
. "& room_id=" . $room_id
. "& room_id=".$room_id
. "& becomeModeratorAsInt=" . $becomeModeratorAsInt
. "& becomeModeratorAsInt=".$becomeModeratorAsInt
. "& showAudioVideoTestAsInt=" . $showAudioVideoTestAsInt);
. "&showAudioVideoTestAsInt=".$showAudioVideoTestAsInt);
if ($result->getError()) {
if ($result->getError()) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
@ -320,7 +320,7 @@ class OpenMeetingsGateway
return $result;
return $result;
}
}
}
}
return - 1;
return -1;
}
}
/**
/**
@ -338,29 +338,29 @@ class OpenMeetingsGateway
}
}
$url = $this->getRestUrl("RoomService")
$url = $this->getRestUrl("RoomService")
. $service.'?'
. $service.'?'
. 'SID=' . $room->SID
. 'SID='.$room->SID
. '& name=' . $room->name
. '& name='.$room->name
. '& roomtypes_id=' . $room->roomtypes_id
. '& roomtypes_id='.$room->roomtypes_id
. '& comment='. $room->comment
. '& comment='.$room->comment
. '& numberOfPartizipants=' . $room->numberOfPartizipants
. '& numberOfPartizipants='.$room->numberOfPartizipants
. '& ispublic=' . $this->var_to_str($room->ispublic)
. '& ispublic='.$this->var_to_str($room->ispublic)
. '& appointment=' . $this->var_to_str($room->appointment)
. '& appointment='.$this->var_to_str($room->appointment)
. '& isDemoRoom=' . $this->var_to_str($room->isDemoRoom)
. '& isDemoRoom='.$this->var_to_str($room->isDemoRoom)
. '& demoTime=' . $room->demoTime
. '& demoTime='.$room->demoTime
. '& isModeratedRoom=' . $this->var_to_str($room->isModeratedRoom)
. '& isModeratedRoom='.$this->var_to_str($room->isModeratedRoom)
. '& externalRoomType=' . $room->externalRoomType;
. '&externalRoomType='.$room->externalRoomType;
if ($room->allowRecording) {
if ($room->allowRecording) {
$url .= '& allowUserQuestions=' . $this->var_to_str($room->allowUserQuestions)
$url .= '& allowUserQuestions='.$this->var_to_str($room->allowUserQuestions)
. '& isAudioOnly=' . $this->var_to_str($room->isAudioOnly)
. '& isAudioOnly='.$this->var_to_str($room->isAudioOnly)
. '& waitForRecording=' . $this->var_to_str($room->waitForRecording)
. '& waitForRecording='.$this->var_to_str($room->waitForRecording)
. '& allowRecording=' . $this->var_to_str($room->allowRecording);
. '&allowRecording='.$this->var_to_str($room->allowRecording);
} elseif ($room->isAudioOnly) {
} elseif ($room->isAudioOnly) {
$url .= '& isAudioOnly=' . $this->var_to_str($room->isAudioOnly);
$url .= '&isAudioOnly='.$this->var_to_str($room->isAudioOnly);
}
}
$result = $this->rest->call($url);
$result = $this->rest->call($url);
if ($this->rest->fault) {
if ($this->rest->fault) {
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result,1));
error_log('Fault (Expect - The request contains an invalid SOAP body) '.print_r($result, 1));
} else {
} else {
$err = $this->rest->getError();
$err = $this->rest->getError();
if ($err) {
if ($err) {
@ -385,7 +385,7 @@ class OpenMeetingsGateway
return false;
return false;
}
}
$url = $this->getRestUrl("RoomService") . "getRoomsWithCurrentUsersByListAndType?SID=" . $this->sessionId
$url = $this->getRestUrl("RoomService")."getRoomsWithCurrentUsersByListAndType?SID=".$this->sessionId
. "&start=1&max=1000&orderby=name&asc=true&externalRoomType=chamilolms";
. "&start=1&max=1000&orderby=name&asc=true&externalRoomType=chamilolms";
//$url = $this->getRestUrl("RoomService")
//$url = $this->getRestUrl("RoomService")
// . "getRoomTypes?"
// . "getRoomTypes?"
@ -396,7 +396,7 @@ class OpenMeetingsGateway
$rooms = array();
$rooms = array();
foreach ($result as $room) {
foreach ($result as $room) {
//error_log(__FILE__.'+'.__LINE__.': one room found on remote: '.print_r($room,1));
//error_log(__FILE__.'+'.__LINE__.': one room found on remote: '.print_r($room,1));
if ($room['externalRoomType'] == $type & & count($room['currentusers']) > 0 ) {
if ($room['externalRoomType'] == $type & & count($room['currentusers']) > 0) {
$rooms[] = $room;
$rooms[] = $room;
}
}
}
}
@ -418,7 +418,7 @@ class OpenMeetingsGateway
$url = $this->getRestUrl("RoomService")
$url = $this->getRestUrl("RoomService")
. "getRoomById?"
. "getRoomById?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "&rooms_id=".$roomId;
. "&rooms_id=".$roomId;
//error_log(__FILE__.'+'.__LINE__.' Calling WS: '.$url);
//error_log(__FILE__.'+'.__LINE__.' Calling WS: '.$url);
$result = $this->rest->call($url, "return");
$result = $this->rest->call($url, "return");
@ -432,8 +432,8 @@ class OpenMeetingsGateway
{
{
$url = $this->getRestUrl("RoomService")
$url = $this->getRestUrl("RoomService")
. "getFlvRecordingByExternalRoomType?"
. "getFlvRecordingByExternalRoomType?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& externalRoomType=" . urlencode($this->config["moduleKey"]);
. "&externalRoomType=".urlencode($this->config["moduleKey"]);
$result = $this->rest->call($url, "return");
$result = $this->rest->call($url, "return");
@ -449,8 +449,8 @@ class OpenMeetingsGateway
{
{
$url = $this->getRestUrl("RoomService")
$url = $this->getRestUrl("RoomService")
. "getFlvRecordingByRoomId?"
. "getFlvRecordingByRoomId?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& roomId=" . urlencode($id);
. "&roomId=".urlencode($id);
$result = $this->rest->call($url, "return");
$result = $this->rest->call($url, "return");
@ -464,8 +464,8 @@ class OpenMeetingsGateway
{
{
$url = $this->getRestUrl("RoomService")
$url = $this->getRestUrl("RoomService")
. "getFlvRecordingByExternalUserId?"
. "getFlvRecordingByExternalUserId?"
. "SID=" . $this->sessionId
. "SID=".$this->sessionId
. "& externalUserId=" . $id;
. "&externalUserId=".$id;
$result = $this->rest->call($url, "return");
$result = $this->rest->call($url, "return");