Ari-client help

i dont know if am doing something wrong to make call to external numbers

const Ari = require('ari-client');

const outboundCalll = async () => {
try {
const url = 'http://xxx.xxx.xxx.xxx:8088/ari/';
const username = '*********';
const password = '*********';

    const client = await Ari.connect(url, username, password);
    console.log(`Connected to ${url}`);

    client.on('StasisStart', async (event, channel) => {
        console.log('call answered:', JSON.stringify(event));

        // Ignore other channels entering the application (e.g. snoop channels).
        if (event.args[0] !== 'dialed') return;

        channel.once('ChannelHangupRequest', () => {
            console.log('ChannelHangupRequest');
        });

        // Your code here
    });

    const endpoint = 'PJSIP/sip:14695549709@provider';
    const app = 'channel-dump';

    client.start(app, async err => {
        if (err) return console.log('application start error:', err);

        console.log('application started!');

        try {
            const outChannel = client.Channel();

            outChannel.on('ChannelDestroyed', (event, channel) => {
                console.log('channel destroyed', channel.id);
            });

            await outChannel.originate({
                endpoint,
                app,
                context: 'default',
                appArgs: 'dialed',
            });

            console.log('channel created:', outChannel.id);
        } catch (error) {
            console.log('error while creating channel:', error);
        }
    });
} catch (err) {
    console.log(err);
}};

outboundCalll();

the moment i run it i get
Connected to http://161.35.165.85:8088/ari/
application started!
channel created: c99a6e8b-2c1c-4aeb-8615-3f3042121d4a
channel destroyed c99a6e8b-2c1c-4aeb-8615-3f3042121d4a
but don’t receive any call

[default]
exten => _X.,1,NoOp(Outgoing call to ${EXTEN})
 same => n,Dial(PJSIP/provider/${EXTEN})
 same => n,Hangup()

This code doesn’t really do anything… I assume you’re trying to originate a call. There is an example in the library for this.

Thank you soooooo much but i want to know where i will the external phone number?

i want to originate call to external phone numbers

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