ARI, react on DTMF while channels are bridged

HI,

For last few days I’m trying make an ARI application which sould originate a call, bridge it (it works) but I need one more feature. I need listen for DTMF on channel which initiate all. Mixing type bridge looks like dont work because all DTMFs transfer between channels instead to block it and exec logic.

For example. I call from mobilephone to my test number, stasis redirect my call to ARI where new call is established. But when I press digits on mobilephone ARI dont see DTMF and pass it to new channel.

How to force ARI/Bridge to respect DTMF from one side ?

Have you confirmed that DTMF is passing outside of ARI? What DTMF type is in use? There’s nothing special to be done otherwise.

I hear DTMF on another leg. Maybe I don’t know how to catch DTMF?

Below whole script with nodejs

client = require('ari-client');

client.connect('http://ip:8088', 'xxx', 'yyy', function(err, ari){

    //  tutaj wchodze kiedy polaczenie osiagnie Stasis(Originator)
    ari.on('StasisStart', function(event, channel){
        //  jezeli jestem inicjatorem zamieszania
        if (event.args[0] === 'initiator')
        {
            channel.answer(function(err){
                // channel.play({media: 'sound:tt-weasels'});

                channel.originate(
                    {endpoint: 'PJSIP/NUMBER@TRUNK', app: 'Originator', appArgs: ['guest', channel.id]},
                    function (err, channelGuest) {

                        channel.on('ChannelDtmfReceived', function(event, channel){
                            console.log(event.digit);
                        });

                        channel.on('ChannelLeftBridge', function(event, bridge){
                            console.log(channel);
                            ari.channels.setChannelVar({channelId: channel.id, variable: 'testowa', value: 'duzaWartosc'});
                        });

                        channel.on('ChannelDestroyed', function(event, channel){                            
                            channelGuest.hangup(function(err){});
                            console.log(event.cause);
                            console.log(event.cause_txt);
                        });
                    }
                  );
            });
        }

        // tutaj jest logika dla polaczenia zewnetrznego
        if (event.args[0] === 'guest')
        {
            var bridge = ari.Bridge();

            var channelInviting = event.args[1];
            console.log(channelInviting);

            channel.answer(function(err){      
                console.log('Polaczenie odebrane');
                bridge.create({type: 'mixing,dtmf_events'}, function(err, bridge){

                    bridge.addChannel({
                        channel: channelInviting,
                        absorbDTMF: false,
                    });

                    bridge.addChannel({
                        channel: channel.id,
                        absorbDTMF: true,
                    });

                    bridge.on('ChannelDtmfReceived', function(event, channel){                
                        console.log(event.digit);
                    });  

                    channel.on('ChannelDestroyed', function(event, channel){
                        console.log('askdjalksjd');
                        bridge.destroy(function(err){});
                    });
                });
            });
        }
    });

    ari.start('Originator');
});

have you added the DTMF on_event to the channel?

You should pass mixing,dtmf_events to bridge create, I think it works.

I’m doing it

part of code, full code above

channel.answer(function(err){      
                console.log('Polaczenie odebrane');
                bridge.create({type: 'mixing,dtmf_events'}, function(err, bridge){

                    bridge.addChannel({
                        channel: channelInviting,

try the “ChannelDtmfReceived” on the channel instead of the bridge

May be helpful: ari-read - npm

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