Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting to ami: php_network_getaddresses: getaddrinfo failed: Name or service not known #176

Open
douglasroos opened this issue Nov 5, 2018 · 0 comments

Comments

@douglasroos
Copy link

I'm trying to connect to AMI from a remote server, via telnet the connection works fine but with the PAMI it always gives the same error: Error connecting to ami: php_network_getaddresses: getaddrinfo failed: Name or service not known.

$pamiClientOptions = array(
            'host' => env('ASTERISK_HOST'),
            'scheme' => 'tcp://',
            'port' => env('ASTERISK_AMI_PORT'),
            'username' => env('ASTERISK_AMI_USER'),
            'secret' => env('ASTERISK_AMI_SECRET'),
            'connect_timeout' => 10000,
            'read_timeout' => 10000,
        );

        $pamiClient = new PamiClient($pamiClientOptions);

        $pamiClient->open();

        $originateMsg = new OriginateAction();
        $originateMsg->setContext('automated-call');
        $originateMsg->setPriority('1');
        $originateMsg->setExtension('s');
        $originateMsg->setCallerId('4122479501');
        $originateMsg->setTimeout(60000);
        $originateMsg->setAsync(true);
        $originateMsg->setActionID(1);
        $originateMsg->setVar('file=archivo.wav');
        $originateMsg->setVar('agi_callerid=4123089501');
        $pamiClient->send($originateMsg);

Already tried placing the host and credentials manually but same response. The server is Asterisk vanilla 16. As I say connection via telnet from the same server where the code is located works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant