[SIP SIMPLE client] Streaming WAV files to SIP bridge

Adrian Georgescu ag at ag-projects.com
Wed Sep 1 09:30:44 CEST 2010


You must add the player not only to the voice_audio_bridge, which plays the file locally but also to the audio_stream.bridge that plays it over the RTP stream remotely.

Adrian


On Sep 1, 2010, at 2:09 AM, Manu Sporny wrote:

> Hi all,
> 
> We've been trying to find a solution for streaming audio to and from an
> Asterisk system for a while now. We've implemented Asterisk Manager
> interfaces, AGI and EAGI scripts for getting audio into and out of
> Asterisk. So, we have some experience configuring and using SIP systems.
> 
> What we are attempting to do is have a programmatic way of bridging our
> audio system with Asterisk. The best approach seems to be to have our
> Python code send and receive audio via a SIP client. This is why we've
> been looking at the sipclient source code, examples and software stack.
> 
> I've been trying to hack together a quick demonstration app that reads
> an audio file off of disk, connects to an Asterisk MeetMe conference and
> sends the audio to the Asterisk installation. Recording the audio from
> the Asterisk MeetMe room would be nice too, but that seems pretty
> straight forward with the sipclient API.
> 
> What I haven't been able to figure out is how to stream a WAV file from
> the local machine to the remote Asterisk MeetMe conference room using
> the sipclient API.
> 
> I started out with the example application:
> 
> http://sipsimpleclient.com/wiki/SipSessionExample
> 
> Connecting to the remote machine, sending and receiving audio from the
> microphone device and headset works perfectly. I can watch the SIP
> connection happen on the remote end... everything works well if I want
> to take audio from the microphone and send it to the Asterisk MeetMe
> conference room.
> 
> Unfortunately, when I try to play back an audio file:
> 
>    def _NH_SIPSessionDidStart(self, notification):
>        print 'Session started!'
> 
>        # Start the wave audio playback loop
>        self.audiotest = WavePlayer(self.voice_audio_mixer,
>                                    "test.wav", 100, 10)
>        self.voice_audio_bridge.add(self.audiotest)
>        self.audiotest.start()
> 
> ...the audio plays back through the headset just fine, but nobody that
> is connected to the Asterisk MeetMe conference on the remote server can
> hear the "test.wav" audio file. I'm assuming that the voice_audio_bridge
> doesn't transmit everything that is mixed into it?
> 
> What I really want is to send that audio to the Asterisk MeetMe room via
> the SIP RTP stream, but after many hours of trying to figure out how to
> connect the channels to stream a WaveFile or WavePlayer object out onto
> the network, I'm left frustrated.
> 
> It seems as if the API can do this, but I just can't figure out how to
> make this happen. How does one stream audio from a file instead of the
> microphone input using sipsimple?
> 
> Thanks in advance to anyone that can provide some working code.
> 
> -- manu
> 
> -- 
> Manu Sporny (skype: msporny, twitter: manusporny)
> President/CEO - Digital Bazaar, Inc.
> blog: WebID - Universal Login for the Web
> http://blog.digitalbazaar.com/2010/08/07/webid/2/
> _______________________________________________
> SIPclient mailing list
> SIPclient at lists.ag-projects.com
> http://lists.ag-projects.com/mailman/listinfo/sipclient
> 




More information about the SIPBeyondVoIP mailing list