diff --git a/build/MagnusBilling-current.tar.gz b/build/MagnusBilling-current.tar.gz index afac23b0f..e9e0045b0 100644 Binary files a/build/MagnusBilling-current.tar.gz and b/build/MagnusBilling-current.tar.gz differ diff --git a/protected/commands/UpdateMysqlCommand.php b/protected/commands/UpdateMysqlCommand.php index ee94e46cf..91f7579a7 100755 --- a/protected/commands/UpdateMysqlCommand.php +++ b/protected/commands/UpdateMysqlCommand.php @@ -1999,6 +1999,17 @@ public function run($args) $this->update($version); } + //2024-01-22 + if ($version == '7.8.4.5') { + $sql = "INSERT INTO pkg_configuration VALUES + (NULL, 'API allow multiple user/email', 'api_allow_same_ip', '0', 'Allow create muiltiple clients with same email via API', 'global', '1'); + "; + $this->executeDB($sql); + + $version = '7.8.4.6'; + $this->update($version); + } + } public function executeDB($sql) diff --git a/protected/components/ApiAccess.php b/protected/components/ApiAccess.php index f5cc883e6..f2c71c46c 100755 --- a/protected/components/ApiAccess.php +++ b/protected/components/ApiAccess.php @@ -193,6 +193,8 @@ private function checkPermissions($modelApi) $action = 'r'; } else if ($_POST['action'] == 'resendActivationEmail') { $action = 'r'; + } else if ($_POST['action'] == 'spyCall') { + $action = 'r'; } if ( ! preg_match('/' . $action . '/', $modelApi->action)) { @@ -206,17 +208,19 @@ private function createUser($baseController) $values = $_POST; - $modelUser = User::model()->find('email = :key', [':key' => $values['email']]); + if ($baseController->config['global']['api_allow_same_ip'] == 0) { + $modelUser = User::model()->find('email = :key', [':key' => $values['email']]); - if (isset($modelUser->id)) { + if (isset($modelUser->id)) { - echo json_encode([ - 'success' => false, - 'errors' => 'This email already in use', - ]); + echo json_encode([ + 'success' => false, + 'errors' => 'This email already in use', + ]); - exit; + exit; + } } if (isset($values['username'])) { diff --git a/protected/controllers/CallOnLineController.php b/protected/controllers/CallOnLineController.php index b622ab27c..212816f7b 100755 --- a/protected/controllers/CallOnLineController.php +++ b/protected/controllers/CallOnLineController.php @@ -133,7 +133,9 @@ public function actionDestroy() public function actionSpyCall() { - if ( ! isset($_POST['id_sip'])) { + if (isset($_POST['sipuser'])) { + $dialstr = 'SIP/' . $_POST['sipuser']; + } elseif ( ! isset($_POST['id_sip'])) { $dialstr = 'SIP/' . $this->config['global']['channel_spy']; } else { $modelSip = Sip::model()->findByPk((int) $_POST['id_sip']); @@ -142,11 +144,9 @@ public function actionSpyCall() $call = "Action: Originate\n"; $call .= "Channel: " . $dialstr . "\n"; - $call .= "Callerid: " . Yii::app()->session['username'] . "\n"; $call .= "Context: billing\n"; $call .= "Extension: 5555\n"; $call .= "Priority: 1\n"; - $call .= "Set:USERNAME=" . Yii::app()->session['username'] . "\n"; $call .= "Set:SPY=1\n"; $call .= "Set:SPYTYPE=" . $_POST['type'] . "\n"; $call .= "Set:CHANNELSPY=" . $_POST['channel'] . "\n"; @@ -156,6 +156,7 @@ public function actionSpyCall() echo json_encode([ 'success' => true, 'msg' => 'Start Spy', + ]); }