How I can send media to 3rd party wss voice BOT

I am using asterisk version 16 and my application written over ari-client NPM library over nodejs.

I have come across a requirement that I have to send call media to 3rd party over in a specific JSON format like

“event”: “media”,
“sequenceNumber”: “1”,

“media”: {
“track”: “inbound”,
“chunk”: “1”,
“timestamp”: “5”,
“payload”: “payload is here the actual media”
},

I have tried the external media also like

call.channel.externalMedia(
{app: cfg.asterisk.stasisApp, external_host: “3rd_party_domain:443”, format: “ulaw”},
function (err, channel_webrtc) {
if(err){ logger.log('err: ',err); }else { logger.log(“success”);
}
}
);

Here are the CLI trace of the call with this code.

*-- Executing [+91172350xxx@root:1] Verbose("SIP/JIO_SIP-00000022", "1, Incoming did of 89 Server Call on MM CLI: +911723xxxxxx rom ani: +9177xxxxxxx") in new stack*
  • Incoming did of 89 Server Call on MM CLI: +9117xxxxxx from ani: +917740xxxxx*
  • – Executing [+9117235xxxx@root:2] Answer(“SIP/JIO_SIP-00000022”, “”) in new stack*
  • – Executing [+9117235xxxx@root:3] Stasis(“SIP/JIO_SIP-00000022”, “cloud_pbx_dev_bot”) in new stack*
  • – Channel Recorder/ARI-0000001d;2 joined ‘simple_bridge’ stasis-bridge *
  • – x=0, open writing: /var/spool/asterisk/AIBOT_1689688317.170_1689ds688317867 format: wav, 0x7fdeb0000df0*
  • – Channel SIP/JIO_SIP-00000022 joined ‘simple_bridge’ stasis-bridge *
  • – Called 3rd_party_domain:443*
  • – UnicastRTP/3rd_party_domain-0x7fdea804a0a0 answered*
  •   > Launching Stasis(cloud_pbx_dev_bot) on UnicastRTP/3rd_party_domain-0x7fdea804a0a0*
    

any help is appreciated , I have not found anything related to this online and so far I come cross this like:-

https://wiki.asterisk.org/wiki/display/AST/External+Media+and+ARI

You will need to write your own process that takes the external media stream and reformats it into the required JSON code, and forwards it to the final destination.

Asterisk 16 is no longer supported, and about 3 months from final end of life.

Thanks for reverting to my query.
I will update the asterisk version to latest.

I do have a separate “NEW” process that can send the media in the desired format to 3rd party in the required custom JSON format, but I don’t understand how asterisk will send the media to my “NEW” process from there I can manage the custom requirement.

example, in my case if asterisk can send me only media to my internal NEW wss process and from there I can send to 3rd party.

My BIG problem how will my NEW process gets the media, and what the function/API at asterisk which can send out the media to my NEW process.

https://wiki.asterisk.org/wiki/display/AST/External+Media+and+ARI

Thanks david551, I am able to receive media to my external now, is there any way I can identify this media is associated to which call.
I am looking the mapping of call id or session id with media so on my app I can identify which packets need to process for which call.

Any such mapping is up to you to do.

Hi Jcolp, I am able to see the media The issue is it’s not playable, when I am playing it plays with disturbance and lots of nice.

Here is what I am setting up on my application side:-

{ app: cfg.asterisk.stasisApp, external_host: “192.168.100.88:8082”, format: “slin16”, encapsulation: “rtp”, transport: “udp”, connection_type: “server”, direction: “both” },

Here is my application where I am writing to wav file:-

const writer = new wav.FileWriter(outputFilePath, {
channels: 1,
sampleRate: 16000,
bitDepth: 16, // 16-bit audio
});
writer.write(new Buffer(chunkdata.slice(12)));

Please let me know who can it be playable, I am listening disturbance and I can event listen to.

please help

I have nothing to add to that, perhaps someone else can provide input.

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