magnussolution / magnusbilling7

MagnusBilling is a fast, secure, efficient, high availability, VOIP Billing.
https://www.magnusbilling.org
GNU Lesser General Public License v3.0
182 stars 106 forks source link

Regarding Issue #575 and #576 #577

Open Khaled-IamZ opened 2 years ago

Khaled-IamZ commented 2 years ago

Dear @magnussolution This is the solution for import audio file at campaigns section by root user its work for me and sending the call without issues using Centos 7 Solution : form line 102 to 136 at CampaignController.php must change to


   if (isset($_FILES["audio"]) && strlen($_FILES["audio"]["name"]) > 1) {
            $typefile        = explode('.', $_FILES["audio"]["name"]);
            $values['audio'] = "idCampaign_" . $values['id'] . '.' . $typefile[1];
        }

        if (isset($_FILES["audio_2"]) && strlen($_FILES["audio_2"]["name"]) > 1) {
            $typefile          = explode('.', $_FILES["audio_2"]["name"]);
            $values['audio_2'] = "idCampaign_" . $values['id'] . '_2.' . $typefile[1];
        }

        return $values;
    }

    public function afterSave($model, $values)
    {
        if (isset($_FILES["audio"]) && strlen($_FILES["audio"]["name"]) > 1) {
            if (file_exists($this->uploaddir . 'idCampaign_' . $model->id . '.wav')) {
                unlink($this->uploaddir . 'idCampaign_' . $model->id . '.wav');
            }
            $typefile       = explode('.', $_FILES["audio"]["name"]);
            $uploadfile = $this->uploaddir . 'idCampaign_' . $model->id . '.' . $typefile[1];
            move_uploaded_file($_FILES["audio"]["tmp_name"], $uploadfile);
        }
        if (isset($_FILES["audio_2"]) && strlen($_FILES["audio_2"]["name"]) > 1) {
            if (file_exists($this->uploaddir . 'idCampaign_' . $model->id . '_2.wav')) {
                unlink($this->uploaddir . 'idCampaign_' . $model->id . '_2.wav');
            }
            $typefile       = explode('.', $_FILES["audio_2"]["name"]);
            $uploadfile = $this->uploaddir . 'idCampaign_' . $model->id . '_2.' . $typefile[1];
            move_uploaded_file($_FILES["audio_2"]["tmp_name"], $uploadfile);
        }

    }

and for quick campaigns for client user

from line 270 to 273 at the same file and line from 269 to 272 at MagnusBilling-current.tar.gz must change to

 $typefile       = explode('.', $_FILES["audio_path"]["name"]);
            $uploadfile = $this->uploaddir . 'idCampaign_' . $id_campaign . '.' . $typefile[1];
            move_uploaded_file($_FILES["audio_path"]["tmp_name"], $uploadfile);

the solution for import audio file at periodic announce line from 67 to 69 at QueueController.php must change to


 $typefile   = explode('.', $_FILES["periodic-announce"]["name"]);
            $uploadfile = $uploaddir . 'queue-periodic-announce-' . $model->id . '.' . $typefile[1];

and change dir from sounds to moh to save upload file at line 66 to /var/lib/asterisk/moh/ and line 75 to $files = glob('/var/lib/asterisk/moh/queue-periodic-announce-' . $model->id . '*');

magnussolution commented 2 years ago

hello, you can propose a pull request when you found a BUG solution, or a new feature.

Thanks

Khaled-IamZ commented 2 years ago

@magnussolution Fixed.. Thanks