<div dir="ltr">Oopss I referred to a wrong script :) <div>It shoul be the waveplayer example and not the james bond one :)<div><div><a href="https://github.com/saghul/sipsimple-examples/blob/master/sipsimple_waveplayer.py">https://github.com/saghul/sipsimple-examples/blob/master/sipsimple_waveplayer.py</a><br>
</div></div></div><div><br></div><div style>J</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 25 June 2013 16:17, <span dir="ltr"><<a href="mailto:sipbeyondvoip-request@lists.ag-projects.com" target="_blank">sipbeyondvoip-request@lists.ag-projects.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send SIPBeyondVoIP mailing list submissions to<br>
<a href="mailto:sipbeyondvoip@lists.ag-projects.com">sipbeyondvoip@lists.ag-projects.com</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip" target="_blank">http://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:sipbeyondvoip-request@lists.ag-projects.com">sipbeyondvoip-request@lists.ag-projects.com</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:sipbeyondvoip-owner@lists.ag-projects.com">sipbeyondvoip-owner@lists.ag-projects.com</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of SIPBeyondVoIP digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Missing incoming RTP stream (Janusz Kowalczyk)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 25 Jun 2013 15:55:23 +0100<br>
From: Janusz Kowalczyk <<a href="mailto:kowalczykjanusz@gmail.com">kowalczykjanusz@gmail.com</a>><br>
To: <a href="mailto:sipbeyondvoip@lists.ag-projects.com">sipbeyondvoip@lists.ag-projects.com</a><br>
Subject: [SIP Beyond VoIP] Missing incoming RTP stream<br>
Message-ID:<br>
<CAPuP8+OA2LjgrKV6rPzn=<a href="mailto:SyoGSLXQNz_2FanVe-Q-6DmMBatpw@mail.gmail.com">SyoGSLXQNz_2FanVe-Q-6DmMBatpw@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi Guys,<br>
<br>
I'm trying to use SipSimple SDK write test scripts that will be executed<br>
with fabric on a remote machine without a soundcard (ie. Amazon EC2) and<br>
which would dial in to our voice service and play back some wav files<br>
and/or DTMF's.<br>
<br>
<br>
At the moment I'm trying to use modified version of Saul's "jamesbond"<br>
script<br>
<a href="https://github.com/saghul/sipsimple-examples/tree/master/jamesbond" target="_blank">https://github.com/saghul/sipsimple-examples/tree/master/jamesbond</a><br>
to make a call and play a wav file once call is established. Modified<br>
script is at the end of email.<br>
<br>
The problem is that there's no incoming RTP stream. I doubled check<br>
firewall rules and UDP traffic is allowed on all ports. I've attached a<br>
pcap file from an example call.<br>
<br>
I'd be grateful if you could help me to figure out what's the problem.<br>
<br>
btw. Is there a good and simple example script that would make unattended<br>
calls, play wav files and DTMF tones?<br>
<br>
Many thanks,<br>
Janusz<br>
<br>
<br>
*caller.py:*<br>
<br>
#! /usr/bin/env python<br>
<br>
import os<br>
import sys<br>
from datetime import datetime<br>
<br>
from application.notification import NotificationCenter<br>
from optparse import OptionParser<br>
from threading import Event<br>
from select import select<br>
<br>
from sipsimple.account import AccountManager<br>
from sipsimple.application import SIPApplication<br>
from sipsimple.audio import WavePlayer<br>
from sipsimple.configuration.settings import SIPSimpleSettings<br>
from sipsimple.core import SIPURI, SIPCoreError, ToHeader<br>
from sipsimple.lookup import DNSLookup, DNSLookupError<br>
from sipsimple.session import Session<br>
from sipsimple.streams import AudioStream<br>
from sipsimple.threading.green import run_in_green_thread<br>
from sipsimple.storage import FileStorage<br>
<br>
<br>
class SimpleCallApplication(SIPApplication):<br>
<br>
def __init__(self):<br>
SIPApplication.__init__(self)<br>
self.ended = Event()<br>
self.callee = None<br>
self.player = None<br>
self._wave_file = None<br>
self.session = None<br>
self.voice_audio_device = None<br>
self.voice_audio_bridge = None<br>
notification_center = NotificationCenter()<br>
notification_center.add_observer(self)<br>
<br>
def call(self, options):<br>
self.callee = options.target<br>
self._wave_file = options.filename<br>
self.start(FileStorage(os.path.expanduser('~/.sipclient')))<br>
<br>
@run_in_green_thread<br>
def _NH_SIPApplicationDidStart(self, notification):<br>
settings = SIPSimpleSettings()<br>
# We don't need speakers or microphone<br>
settings.audio.input_device = None<br>
settings.audio.output_device = None<br>
settings.rtp.port_range.start=5000<br>
settings.rtp.port_range.end=5500<br>
print 'RTP portRange: %s' % settings.rtp.port_range<br>
settings.save()<br>
self.player = WavePlayer(SIPApplication.voice_audio_mixer,<br>
self._wave_file, loop_count=0, initial_play=False)<br>
try:<br>
self.callee = ToHeader(SIPURI.parse(self.callee))<br>
except SIPCoreError:<br>
print 'Specified SIP URI is not valid'<br>
self.stop()<br>
return<br>
try:<br>
routes = DNSLookup().lookup_sip_proxy(self.callee.uri,<br>
['udp']).wait()<br>
except DNSLookupError, e:<br>
print 'DNS lookup failed: %s' % str(e)<br>
else:<br>
account = AccountManager().default_account<br>
print account<br>
self.session = Session(account)<br>
self.session.connect(self.callee, routes, [AudioStream()])<br>
<br>
def _NH_SIPSessionGotRingIndication(self, notification):<br>
print 'Ringing!'<br>
<br>
def _NH_SIPSessionDidStart(self, notification):<br>
print 'Session started! at: %s' %<br>
(datetime.now().strftime("%Y-%m-%d_-_%H-%M-%S"))<br>
session = notification.sender<br>
audio_stream = session.streams[0]<br>
audio_stream.bridge.add(self.player)<br>
print 'Audio session established using "%s" codec at %sHz' %<br>
(audio_stream.codec, audio_stream.sample_rate)<br>
self.player.play()<br>
<br>
def _NH_SIPSessionDidFail(self, notification):<br>
print 'Failed to connect! %s' %<br>
(datetime.now().strftime("%Y-%m-%d_-_%H-%M-%S"))<br>
self.stop()<br>
<br>
def _NH_SIPSessionWillEnd(self, notification):<br>
session = notification.sender<br>
audio_stream = session.streams[0]<br>
self.player.stop()<br>
audio_stream.bridge.remove(self.player)<br>
<br>
def _NH_SIPSessionDidEnd(self, notification):<br>
print 'Session ended at: %s' %<br>
(datetime.now().strftime("%Y-%m-%d_-_%H-%M-%S"))<br>
self.stop()<br>
<br>
def _NH_SIPApplicationDidEnd(self, notification):<br>
self.ended.set()<br>
<br>
if __name__ == '__main__':<br>
parser = OptionParser()<br>
parser.add_option('-t', '--target', help='Target URI')<br>
parser.add_option('-f', '--file', dest='filename', help='File to play',<br>
metavar='FILE')<br>
options, args = parser.parse_args()<br>
<br>
if not options.filename or not options.target:<br>
print 'Target and filename need to be specified, try --help'<br>
sys.exit(1)<br>
if not os.path.isfile(options.filename):<br>
print "The specified file doesn't exist"<br>
sys.exit(1)<br>
<br>
application = SimpleCallApplication()<br>
application.call(options)<br>
timeout = 30<br>
<br>
print "Placing call, wait %d seconds for call to end automatically or<br>
press Enter to quit the program %s" % (timeout,<br>
datetime.now().strftime("%Y-%m-%d_-_%H-%M-%S"))<br>
rlist, _, _ = select([sys.stdin], [], [], timeout)<br>
if rlist:<br>
s = sys.stdin.readline()<br>
print s<br>
else:<br>
print "No input from the console. Moving on... %s " %<br>
(datetime.now().strftime("%Y-%m-%d_-_%H-%M-%S"))<br>
<br>
if application.session:<br>
application.session.end()<br>
application.ended.wait()<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20130625/06a704ce/attachment.html" target="_blank">http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20130625/06a704ce/attachment.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: caller.pcap<br>
Type: application/octet-stream<br>
Size: 367768 bytes<br>
Desc: not available<br>
URL: <<a href="http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20130625/06a704ce/attachment.obj" target="_blank">http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20130625/06a704ce/attachment.obj</a>><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
SIPBeyondVoIP mailing list<br>
<a href="mailto:SIPBeyondVoIP@lists.ag-projects.com">SIPBeyondVoIP@lists.ag-projects.com</a><br>
<a href="http://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip" target="_blank">http://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip</a><br>
<br>
<br>
End of SIPBeyondVoIP Digest, Vol 49, Issue 3<br>
********************************************<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Zapraszam na swojego foto-bloga: <a href="http://na100procentchyba.wordpress.com/">http://na100procentchyba.wordpress.com/</a><br>Autopodpis: Staraj się używać pola Ukryty do Wiadomości (UDW) przy wysyłaniu wiadomości do wielu odbiorców, ograniczysz przez to rozprzestrzenianie się spamu!<br>
Autosignature: Try to use field BCC (blind carbon copy) when sending message to many recepients, it will restrain spread of spam!
</div>