[SIP SIMPLE client] Streaming WAV files to SIP bridge
msporny at digitalbazaar.com
Wed Sep 1 02:09:43 CEST 2010
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:
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
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)
...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 Sporny (skype: msporny, twitter: manusporny)
President/CEO - Digital Bazaar, Inc.
blog: WebID - Universal Login for the Web
More information about the SIPBeyondVoIP