Esempio n. 1
0
 def testInboundRemoteBye(self):
     from shtoom.app.phone import Phone
     ui = TestUI()
     au = TestAudio()
     p = Phone(ui=ui, audio=au)
     p._startReactor = False
     TestRTP.actions = []
     p._rtpProtocolClass = TestRTP
     ui.connectApplication(p)
     testdef = ui.compdef = defer.Deferred()
     p.connectSIP = lambda x=None: None
     p.boot(args=[])
     p.sip = TestSip(p)
     d =  p.sip.fakeInbound()
     d.addCallback(p.sip.dropFakeInbound)
     p.start()
     twisted.trial.util.wait(testdef)
     self.assertEquals(au.actions, ['wave', 'close', 'select', 'reopen', 'close'])
     self.assertEquals(TestRTP.actions, ['create', 'start', 'stop'])
     actions = ui.actions
     cookie = actions[0][1]
     if TDEBUG: print actions
     for a,c in actions[1:]:
         self.assertEquals(cookie,c)
     actions = [x[0] for x in actions]
     # XXX no connected??
     self.assertEquals(actions, ['incoming', 'connected', 'start', 'disconnected'])
Esempio n. 2
0
 def testOutboundRemoteBye(self):
     from shtoom.app.phone import Phone
     ui = TestUI()
     au = TestAudio()
     p = Phone(ui=ui, audio=au)
     p._startReactor = False
     TestRTP.actions = []
     p._rtpProtocolClass = TestRTP
     ui.connectApplication(p)
     testdef = ui.compdef = defer.Deferred()
     reactor.callLater(0, ui.fakeCall)
     p.connectSIP = lambda x=None: None
     p.boot(args=[])
     p.sip = TestSip(p)
     reactor.callLater(0.3, lambda : p.sip.dropCall(ui.cookie))
     p.start()
     twisted.trial.util.wait(testdef)
     self.assertEquals(au.actions, ['close', 'select', 'reopen', 'close'])
     self.assertEquals(TestRTP.actions, ['create', 'start', 'stop'])
     actions = ui.actions
     cookie = actions[0][1]
     for a,c in actions[1:]:
         self.assertEquals(cookie,c)
     actions = [x[0] for x in actions]
     self.assertEquals(actions, ['start', 'connected', 'disconnected'])
     if TDEBUG: print actions
Esempio n. 3
0
def main():
    from shtoom.app.phone import Phone
    import sys
    global app
    app = Phone()
    app._NATMapping = False
    app._rtpProtocolClass = EchoRTP
    app.boot(args=sys.argv[1:])
    app.sipListener.stopListening()
    del app.sip, app.sipListener
    app.sip = TestSip(app)
    app.start()
    sys.exit(0)
Esempio n. 4
0
def main():
    from shtoom.app.phone import Phone
    import sys
    global app
    app = Phone()
    app._NATMapping = False
    app._rtpProtocolClass = EchoRTP
    app.boot(args=sys.argv[1:])
    app.sipListener.stopListening()
    del app.sip, app.sipListener
    app.sip = TestSip(app)
    app.start()
    sys.exit(0)