Skip to content

No support for custom AMI actions? #208

Description

@InterLinked1

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);
        }
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions