I was working on something like this until I took the week off to move my in-laws.
The error in your first message is probably an IP ACL problem. Whatever user you are using doesn’t have permission to connect to the AGI from the address it’s running on.
For me, vtiger is running on 192.168.0.3 and FreePBX is running on 192.168.0.5. The “recipe” for the VTiger admin user usually assumes you are running from the Localhost (127.0.0.1) and will error like then when the address is anything else. This is true even when the machine is the local host, but uses the 192.168.x.x address. Check that first and see what happens.
The second looks like it could be the same problem.