Page 1 of 1

HOWTO - GOAUTODIAL 4 AND VICIDIAL SAME BOX - SOLVED

PostPosted: Wed Apr 15, 2020 10:42 pm
by pronet
It is assumed you either already have goautodial 4 installed as either new or existing and not a vicidial only install.

Backup everything or run a new install to be safe.

First follow the steps here https://goautodial.net/d/4-goautodial-v ... l-on-linux if needed or doing a new install. If you have an existing install check some of the settings shown there. The instructions will work if you dont do anything on that link, but it is a baseline that works.

Next for the impatient: (Detailed explanation at the bottom)

sudo cd /usr/src/goautodial/astguiclient/

sudo perl install.pl --web-only

Answer n when asked if you did a default install.

If you dont have your real certs installed (not self signed) do the following: - You can skip this step if you dont have certs. It not needed for this to work but some people may find it helpful

sudo cp /etc/letsencrypt/live/--YOUR DOMAIN NAME--/certs.pem /etc/pki/tls/certs/localhost.crt
sudo cp /etc/letsencrypt/live/--YOUR DOMAIN NAME--/privkey.pem /etc/pki/tls/private/localhost.key

(NOTE: These are just your cert files and can come wherever you have them. They may not be in /etc/letsencrypt... but they must replace the localhost.crt and localhost.key)

sudo mv /etc/httpd/conf.d/fpm.conf /etc/httpd/conf.d/fpm.conf.orig

sudo mysql asterisk -A

update vicidial_users set load_leads='1', campaign_detail='1',ast_admin_access='1',modify_users='1',alter_agent_interface_options='1',modify_same_user_level='1' where user = 'goadmin';

sudo cp /var/www/html/agc/bp.pl /var/www/html/agc/bp.pl.old

sudo vi /var/www/html/agc/bp.pl

Replace the contents with:

#!/usr/bin/perl

if (length($ARGV[0])>1)
{
$i=0;

while ($#ARGV >= $i)
{
$args = "$args $ARGV[$i]";
$i++;
}

if ($args =~ /--pass=/i)
{
@data_in = split(/--pass=/,$args);
$pass = $data_in[1];
$pass =~ s/ .*//gi;

$php_script = '
require("dbconnect_mysqli.php");
require("functions.php");

$stmt = "SELECT pass_key,pass_cost FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
$qm_conf_ct = mysqli_num_rows($rslt);

if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$SSpass_key = $row[0];
$SSpass_cost = $row[1];

$pass_options = ["cost" => $SSpass_cost,"salt" => base64_encode($SSpass_key)];
$pass_hash = password_hash($argv[1], PASSWORD_BCRYPT, $pass_options);
$pass_hash = substr($pass_hash, 29, 31);
echo "PHASH: $pass_hash\n";
}
';

open my $sm, "|php -r '$php_script' -- $pass" or die "could not run inline php script";
close $sm;
}
}

Reboot your system

https://--YOUR DOMAIN NAME--/vicidial/welcome.php

You should be able to login with goadmin and its password. If your password contains special characters like \ $ " | ; vicidial will strip them from the password, so if you have trouble logging into vicidial change the password in goautodial and then try to log into vicidial again.

NOTES:

You can use the currenlty created goadmin user as an admin after it has been updated. That is what the SQL does. The existing goadmin is in the ADMIN group but cannot access many admin items. Be mindful of how your changes could affect goautodial since you have new powers now.

It "SEEMS" like goautodial is just installing a normal vicidial install according to goautodials install script. The install script specifically installs vicidial with the --no-web option.
I think the reason for this is 2 fold.

1. goautodial is running with php-fpm which is bad for vicidial Basic Authentication. The PHP_AUTH_USER, PHP_AUTH_PW would not be set so you will get the login prompts but your user/pass are never passed to vicidial.
I could only get it to run without https using a vhost and adding RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
the best solution (at least for me) was to disable php-fpm. Thats is why php-fpm.conf was renamed so it wont run. Maybe vicidial 9.02, 9.1 or 10 can use authentication like the Agent Login screen and not PHP Basic Authentication. Then php-fpm can be used again.

2. goautodial is using php for the password hash and not perl. Any passwords saved to vicidial from goautodial would not be able to be used by the vicidial web app.
That is what the new bp.pl is doing by using the same password algorithm. There are some detailed explanations to disable password hashing but then all the password would need to be decoded and updated in vicidial_users. But I believe most people are not programming or SQL experts so the new bp.pl may not be elegant, but its a simple solution to help most people get things running it a few minutes. It also now gives vicidial users secure passwords without having to install additional perl encryption libraries.

That being said, it "SEEMS" like you can just pull the latest svn vicidial version and put it into /usr/src/goautodial/astguiclient/ then do a regular vicidial upgrade and then update the database.

Possible caveats to test. Enabling the web option in the current version of goautodial "should not" cause any problems since goautodial understands the current database structure, vicidial program options/output etc. Although it is now possible to "change" things in vicidial admin that could possibly break goautodial, but is seems unlikely, but if think you did something, you can change it back.

You could upgrade to the latest version of vicidial and it could "possibly" be something that goautodial doesn't understand, doesn't update, or loses it value that vicidial admin set. Look at the feature, upgrade list of vicidial if you are thinking of upgrading. If is just bug fixes it should be fine. If its new features test the new features with goautodial (have a restore plan). If the database is updated with new columns it may not matter to goautodial depending on what it does, so test,test,test. Backup first though :D

Re: HOWTO - GOAUTODIAL 4 WITH VICIDIAL AND CERTS - SOLVED

PostPosted: Thu Apr 16, 2020 5:25 am
by bbakirtas
vicidial > goautodial :)

Re: HOWTO - GOAUTODIAL 4 AND VICIDIAL SAME BOX - SOLVED

PostPosted: Thu Apr 23, 2020 10:13 pm
by pronet
BTW if you want to keep using php-fpm for goautodial you can.

If you know how to setup a virtual domain you can have that point to the vicidial site and the other to the goautodial site.

To go to the bullet points on what to do its like this.

One virtual domain go.yoursite.com would point to /var/www/goautodial as the document root etc..

The other domain vici.yoursite.com would point to /var/www/goautodial/vicidial as the document root.

The current php-fpm.conf will enable php-fpm for all sites on your server, you dont want this. Dont use it. You can make it site specific. Google for How to run different versions of php.
For your apache httpd.conf file you want to load the php module.

LoadModule php7_module modules/libphp72.so
AddHandler php7-script php

For your vicidial site you want to include the php7_module.conf which will say something like:

<IfModule dir_module>
<IfModule php7_module>
DirectoryIndex index.php index.html
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
</IfModule>


For your goautodial site you want to include somthing like:

<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php70-fpm/php-fpm.sock|fcgi://localhost/"
</FilesMatch>

What this does is allow standard php to be run by apache, which is used for vicidial.
And use the php-fpm process socket to run goautodial.

This is not a comprehensive guide (mostly there) but will point you in the right direction.

NOTE: You still need to keep using the bp.pl to get the passwords correct.

Goautodial works best with php 7.0. Currently the latest is 7.4. Some things wont work with 7.1 - 7.4. Especially 7.4. Some of the warnings in prior versions are errors in 7.4. Use php-fpm for 7.0 with goautodial.
I would recommend using php 7.2 for vicidial since that is what is being used in Vicidial 9 servers. I would not recommend running any version of php 7 prior to Vicidial 9 since it is based on php 5 and will give you lots of errors with php 7.
You can install multiple versions of php on a single machine. They will be named php70, php72, etc. php (will be the latest version)
So you can have goautodial running php70 as php-fpm and vicidial running php72 as a module from the same apache server. You can only have 1 php module running on a server but can running many versions of php-fpm while running with the php module on the same server.

Re: HOWTO - GOAUTODIAL 4 AND VICIDIAL SAME BOX - SOLVED

PostPosted: Thu Mar 11, 2021 8:29 am
by GenXOutsourcing
Has anyone tried to update to the latest SVN?

Maybe have tried to use the Vicidial APIs?