def acceptedFakeCall(self, cookie): from shtoom.sdp import SDP, MediaDescription s = SDP() s.setServerIP('127.0.0.1') md = MediaDescription() s.addMediaDescription(md) md.setLocalPort(9876) if TDEBUG: print "accepted, got %r"%(cookie,) self.cookie = cookie d, self.d = self.d, None self.sip.app.startCall(self.cookie, s, d.callback)
def getSDP(self, rtp, extrartp=None): from shtoom.sdp import SDP, MediaDescription if extrartp: raise ValueError("can't handle multiple RTP streams in a call yet") s = SDP() addr = rtp.getVisibleAddress() s.setServerIP(addr[0]) md = MediaDescription() # defaults to type 'audio' s.addMediaDescription(md) md.setServerIP(addr[0]) md.setLocalPort(addr[1]) for pt, test in TryCodecs.items(): if test is not None: md.addRtpMap(pt) md.addRtpMap(PT_PCMU) md.addRtpMap(PT_CN) md.addRtpMap(PT_NTE) return s
def testSDPCreation(self): from shtoom.sdp import SDP, MediaDescription from shtoom.rtp.formats import PT_PCMU, PT_SPEEX, PT_NTE, PT_CN ae = self.assertEquals s = SDP() md = MediaDescription() s.addMediaDescription(md) s.setServerIP('127.0.0.1') md.setServerIP('127.0.0.1') md.setLocalPort(45678) md.addRtpMap(PT_PCMU) md.addRtpMap(PT_SPEEX) md.addRtpMap(PT_CN) md.addRtpMap(PT_NTE) pts = [ x[1] for x in md.rtpmap.values() ] ae(pts, [PT_PCMU, PT_SPEEX, PT_CN, PT_NTE])
def testSDPCreation(self): from shtoom.sdp import SDP, MediaDescription from shtoom.rtp.formats import PT_PCMU, PT_SPEEX, PT_NTE, PT_CN ae = self.assertEquals s = SDP() md = MediaDescription() s.addMediaDescription(md) s.setServerIP('127.0.0.1') md.setServerIP('127.0.0.1') md.setLocalPort(45678) md.addRtpMap(PT_PCMU) md.addRtpMap(PT_SPEEX) md.addRtpMap(PT_CN) md.addRtpMap(PT_NTE) pts = [x[1] for x in md.rtpmap.values()] ae(pts, [PT_PCMU, PT_SPEEX, PT_CN, PT_NTE])