Asterisk & Chan_AudioSocket

Hi there,

I’m looking for a way to easily get a stream from and to Asterisk (I need to be able to exchange audio between our asterisks and between our asterisks and other servers for like ASR).

I first looked at the ExternalMedia with ARI ( ), that exactly what I wanted except that currently it is only allowing to create an outgoing stream (only act as a client).
So, at the current state, externalMedia is not able to solve my issue.

Then after digging through the documentation, I found AudioSockets, and it promises easy bidirectionnal audio, that’s great, but I wasn’t able to find much more documentation :

I guess that there is a chan_audiosocket but it is nowhere to be found in the documentation nor asterisk (v16.10.0, nothing in menuselect) , any thoughts on how to use it ? is it stable?


The chan_audiosocket module is only present in master, which will become 18.

I’m not sure what you mean by “only allowing to create an outgoing stream”. It allows both incoming and outgoing audio, using UDP RTP.

My guess is that the confusion is caused by the fact that the example usage block diagram only shows one direction and that the client/server signalling is described before the bidirectional audio.

Incidentally, as I found it whilst looking, the audio sockets documentation is in

It looks to me to be community supported, but I suppose it might be in the process of being adopted as a core channel type.

Hi @Jcolp, @david551,

Thanks for the informations, Indeed I read too fast the message on github “2020-01-15, AudioSocket has been included in the upstream Asterisk system.” => for somewhat reason I thought that it was already released.

As for ExternalMedia, I tried to send audio from one asterisk to another, without luck.

On asterisk A (sender) i have a channel inside a holding bridge, with MOH.
Using node-ari I created another ExternalMedia channel (ari.channels.externalMedia()), and I have set external_host to B_IP:30001, then put this channel in the holding bridge.

And I have no idea on how to create the externalMedia channel on host B (Tried to use host B IP with port 30001, no audio).
Using tcpdump I’m not seeing UDP packets on my host B, port 30001 when my externalMedia channel is created on host A.

So maybe I am doing something wrong.

It wasn’t really designed for going between Asterisk instances but to an application that you control. In order to have it go between Asterisk instances it would need to be able to specify the allocation port, and not just where to send media. That’s not currently available. The same applies for Audiosocket in a different way.

Ok, I have the two usecases, from Asterisk to App, and from Asterisk to Asterisk.

Using externalMedia to send media from Asterisk to my App should not be an issue at all, but my main concern is to be able to exchange audio betweek Asterisks.

I thought that externalMedia would do both in a simple & effective maner.

Any ideas of what I can use in conjunction with ARI to let two asterisks exchange their medias?
I know that a simple solution would be a SIP trunk but my environment is dynamic with lot of boxes, it would be a nightmare to have a sip trunk between each of my boxes so everyone can talk to everyone.

SIP trunks are something of an artificial construct. The SIP RFC doesn’t use the term “trunk” anywhere!

chan_sip allows you to set up a SIP session to any simple SIP URI (and some more complex ones) prepared to accept it, just by including the URI information in the dial string. You can use allowguest to allow chan_sip to accept such sessions with no prior knowledge. I believe something similar exists in chan_pjsip.

Hi @david551,

Thanks for the hint, I’m not using chan_sip as chan_pjsip is now the way to go, there is indeed an option to enable anonymous calls with chan_pjsip.

On the downside, this solution seems not very secure ^^

With chan_sip you can provide authentication data, and I think you can match based on authuser, rather than From: user or IP. I don’t know about pjsip, and I haven’t tried it on chan_sip.

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