Hi, I’m using RTP socket for externalMedia in the ARI channel nodejs. Whenever i tried to playback in the channel RTP flow gets stopped. I need RTP flow should continues in playback
kindly share/add more detail about this error. add error logs for knowing more detail about your problem.
Best regard
Danish Hafeez | QA Assistant
ICTInnovations
I’m not getting any specific errors. Whenever I start playback on channel, it’s RTP flow gets stopped. Without playback RTP flow works fine. Please find my simple code below,
async function stasisStart(evt, channel) {
await channel.answer();var bridge = channel._client.Bridge() try { await bridge.create({ type: "mixing" }); } catch (e) { console.log(e); } bridge.addChannel({ channel: channel.id }); var externalChannel = channel._client.Channel(); externalChannel.on('StasisStart', (event, chan) => { bridge.addChannel({ channel: chan.id }); }); channel.on('StasisEnd', (event, chan) => { externalChannel.hangup(); bridge.destroy(); socket.disconnect(); }); try { let resp = await externalChannel.externalMedia({ app: "externalMedia", external_host: '127.0.0.1:9999', format: 'ulaw', direction: 'both' }); } catch (error) { console.log(error); } const playback = await channel.play({ media: `sound:${channelId}_in`, offsetms: 2000, "m": "beep", "mix": true }); if (playback) { playback.once('PlaybackFinished', (event, playback1) => { }); } rtpengineClient.on('message', (msg) => { console.log(msg); try { const pcmData = msg.slice(12); socket.emit('audio', { 'data': pcmData }); } catch (e) { console.log(e) } });
}
function stasisEnd(evt) {
console.log(StasisEnd: Channel ${evt.channel.name} left Stasis
);
}ari.connect(‘http://127.0.0.1:8088’, ‘username’, ‘password’, async (err, client) => {
if (err) {
console.error(‘Error connecting to ARI:’, err);
process.exit(1);
}client.on('StasisStart', stasisStart); client.on('StasisEnd', stasisEnd); await client.start('externalMedia'); console.log('ARI application started');
});
const rtpengineClient = new rtp.RtpUdpServerSocket(
127.0.0.1:9999
);
I have a sense of dejavu as I think I post this every week at this point on this forum…
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.