How to add an application?

Hello, I need your help.
Please let me know how to add an application using Asterisk Rest interface.
Thank you.

The term “application” has two entirely separate and confusing meanings in Asterisk. The original meaning was one of those commands you put in extensions.conf. Now we have another meaning, where it is a name used to filter events received via ARI.

If you want an example of the latter, see the track_call_ari_bridged_async script in this repo. Managing calls in ARI properly does require you to mess around with bridges.

I refered this documentation link below and I tried to run this API through ari-client node module.
https://docs.asterisk.org/Asterisk_18_Documentation/API_Documentation/Asterisk_REST_Interface/Applications_REST_API/#list
But I got an empty array, so I thought I have to add applications to.

I tried to run this node app.

const client = require("ari-client");

client.connect(
  "url",
  "username",
  "password",
  function (err, ari) {
    console.log("Asterisk Object: ", "Connected to Asterisk Package!");
    if (err) console.log("Asterisk Error : ", err);

    const channel = ari.Channel();
    channel.on("StasisStart", function (event, channel) {
      console.log("Asterisk Channel StasisStart: ", channel);
    });
    channel.on("ChannelDtmfReceived", function (event, channel) {
      console.log("Asterisk Channel ChannelDtmfReceived: ", channel);
    });
    channel.originate(
      { endpoint: "PJSIP/1000", app: "track_call", appArgs: "dialed" },
      function (err, channel) {
        console.log("Asterisk Channel Dialed: ", channel);
        if (err) console.log("Asterisk Error : ", err);
      }
    );
});

Here is the result I got:

Asterisk Object:  Connected to Asterisk Package!
Asterisk Channel Dialed:  undefined
Asterisk Error :  Error: {
  "message": "Write access denied"
}

What’s wrong?

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