How can I call an AGI command via AMI [SOLVED]

I do not understand why he tells me I do not have permissions ???

Action: AGI
ActionID: 76975
Channel: SIP/10
Command: EXEC Playback custom/ringraziamento-sul-richiamo
CommandID: 25488

Response: Error
ActionID: 76975
Message: Permission denied

I checked the file manager.conf and it seems ok for the permissions you think about it?

; AMI - Asterisk Manager interface
; FreePBX needs this to be enabled. Note that if you enable it on a different IP, you need
; to assure that this can’t be reached from un-authorized hosts with the ACL settings (permit/deny).
; Also, remember to configure non-default port or IP-addresses in amportal.conf.
; The AMI connection is used both by the portal and the operator’s panel in FreePBX.
; FreePBX assumes an AMI connection to localhost:5038 by default.
enabled = yes
port = 5038
bindaddr =
displayconnects=no ;only effects 1.6+

secret = **********
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
writetimeout = 5000

#include manager_additional.conf
#include manager_custom.conf

You do not call AGI commands via AMI they are completely different. You call AMI commands via AMI. AGI and AMI have totally different ways of dealing with calls.

Are you sure?

I have found many examples

The knot would seem to be allowed to work together, look at this too:

That’s a 10 year old post that uses AEI not standard dialplan. It also has one big glaring thing in it:

So, my patch, allow users to execute AGI commands using “Action: AGI” and get the response reading “Event: AsyncAGI”. The manager header “CommandID” can be specified to match up the responses. Let’s see an example

You are not only referencing a 10 year old post that uses a specific (and not widely used) dialplan alternative that was also PATCHED by the user.

So this is not a standard Asterisk thing and I highly doubt that patch is maintained for the current versions of Asterisk. Where you able to find any examples that are using current versions of Asterisk like 13 or 15?

I left here:

Good. Now add agi in the list of the Read/Write permissions. You need to give permissions for AGI.

Yes but where? I apologize for my ignorance but I’m disoriented

maybe I need to add some sorts of read reading rights in the file manager.conf within admin field

and then reboot to reread the rights?

You will probably need to do this in the manager_custom.conf file since the FreePBX GUI only offers a limited set of AMI permissions that can be granted.

knowing it well is simple :slight_smile:

vi /etc/asterisk/manager.conf

add to reading writing rights: agi, all

1 Like

manager.conf will be overwritten by FreePBX. This should be in the manager_custom.conf to avoid that from happening.

Of course, you did well to specify
I gave it for granted but it is not always so obvious to everyone, thank you