Click to call AMI manager

Hey All,

I use this template to realise ClickToCall https://gist.github.com/anpel/a6cdffea7dc9d85bfe1885f1fb40f980

In CLI its works fine.
Command: originate SIP/inter-data_fon@inter-data_fon extension 00491757880111@inter-data

But in PHP I have an Error: “Could not initiate call.”
My log:

Connected to socket, sending authentication request
Authenticated to Asterisk Manager Inteface. Initiating call.
Originate-Request: 
Action: Originate
Channel: SIP/inter-data_fon
Callerid: inter-data_fon
Exten: 00491757880111
Context: inter-data
Priority: 1
Async: true
Could not initiate call.

What can I do??

Thanks for your help.

Best regards

Ronny

You’ve supplied dialled digits in the CLI version, but not the AMI one.

Sorry, I new at asterisk.
I thought I have the number in Extern: 00491757880111.
How exactly do I have to pass the number.

Thanks for your help.
Ronny

In the same way for both CLI and AMI. If you need to dial inter-data_fon with CLI, you need to dial it with AMI.

(Of course, if the CLI was wrong, that would mean you would need to look elsewhere.)

Also you need to turn up the logging level until you see where it is going wrong.

How I can turn up the logging level.
I start CLI with asterisk -vvvvvvvvvvvvvr but if I use AMI
CMI shows only

== Manager 'clickadmin' logged on from 127.0.0.1
== Manager 'clickadmin' logged off from 127.0.0.1

Have AMI a special logfile or how I can debug this??

I narrowed down the error

//php
if( $originate > 0 ){
  // Wait for server response
  usleep(200000);
  // Read server response
  $originateResponse = fread( $socket, 4096 );
   // Check if originate was successful
   if( strpos( $originateResponse, 'Success' ) !== false ){
     if( $debug ) writeLog( "Call initiated, dialing." );
   }
   else{
     if( $debug ) writeLog(  "Could not initiate call.".$originateResponse );
   }

Says: “Response: Error
Message: Permission denied”

Therefore, nothing is displayed in the CLI.

Do you have an idea why “Permission denied”

Best Regards

Ronny

I found the error.

The code you quote isn’t part of Asterisk, so wouldn’t be putting anything in the logs, and is destroying information.

The actual Asterisk code would log this in the security log, which would need enabling in logger.conf.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.