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

No support for custom AMI actions? #208

Open
InterLinked1 opened this issue Aug 20, 2021 · 0 comments
Open

No support for custom AMI actions? #208

InterLinked1 opened this issue Aug 20, 2021 · 0 comments

Comments

@InterLinked1
Copy link

InterLinked1 commented Aug 20, 2021

There does not appear to be any support for custom AMI actions (custom AMI events work fine, obviously).

I looked through all of the files in Actions and did not find anything. The two things I tried:

  1. Using ActionMessage. I get an error that I cannot instantiate an abstract class, since all the other actions simply extend this.
  2. Using the UserEvent action and then doing setKey('Action', $myEventName) afterwards to override. This fails since setKey is a protected method.

In other words, it seems things are set up to prevent users from sending custom AMI actions.

This capability is important, since a) this library is unlikely to keep up with the new AMI actions being added to Asterisk and b) there will always be custom AMI actions that cannot be anticipated in advance.

Can there simply be an action, like "CustomAction" that is similar to UserEvent except it accepts the action name, rather than setting it to "UserEvent", and then an array of keys to set?

Something like this is what we need:

class CustomAction extends ActionMessage
{
    /**
     * Constructor.
     *
     * @param string $userEvent CustomAction
     * @param array $headers
     */
    public function __construct($userEvent, array $headers = [])
    {
        parent::__construct('CustomAction');
        $this->setKey('Action', $userEvent);
        foreach ($headers as $key => $value) {
            $this->setKey((string)$key, (string)$value);
        }
    }
}
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