Send busy signal

Could someone enlighten me how I would go about playing a busy signal and sending 486 error? Basically doing the same thing as the Busy function in asterisk but using the ARI node client and Stasis.
Thanks.

You would delete the channel to hang it up, and pass busy as the reason[1].

[1] Channels - Asterisk Documentation

1 Like

I am almost there. How do I pass busy as a reason to hangup in here?
Getting an error, trying something like .hangup({ reason: ‘failure’ })

export const playSoundThenHangupBusy = function (sound: string, channel: ariClient.Channel) {
   const playback = NdtAriService.Client.Playback();
   playback.once('PlaybackFinished', function (event: ariClient.PlaybackFinished, instance: ariClient.Playback) {
      setTimeout(() => {
         channel.hangup(function (err: Error) {
           if (err) {
             Logger.error(`Error on hangup ${channel.name}: ${err.message}`);
           }
         });
      }, 500);
   });

   channel.play({ media: `sound:${sound}` }, playback, function (err, playback) {});
};

I don’t speak Javascript, so I can’t answer that.

1 Like

Busy is hangup code 17, according to this list.

This worked, thanks:

channel.hangup({ reason: ‘busy’ }, function (err: Error) {
if (err) {
Logger.error(Error on hangup ${channel.name}: ${err.message});
}
});

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