コード例 #1
0
ファイル: dougdemo.py プロジェクト: braams/shtoom
        print "got event", event
        self.endCall(event)

    def endCall(self, event):
        # The media is finished. Drop the call.
        self.leg.hangupCall()
        return ( (CallEndedEvent, self.allDone),
               )

    def allDone(self, event):
        # We're finished. Use the returnResult to pass the result
        # back to the DougApplication that is the parent of this
        # VoiceApp. We could also use returnError if something went
        # wrong.
        self.returnResult('other end closed')

def main():
    global app
    from twisted.internet import reactor

    app = DougApplication(MessageApp)
    app.configFileName = '.shmessagerc'

    app.boot(args=sys.argv[1:])
    app.start()

if __name__ == "__main__":
    from shtoom import i18n
    i18n.install()
    main()
コード例 #2
0
        return self.waitForAKey(event=None)

    def recordingDone(self, event):
        if not isinstance(event, TimeoutEvent):
            self._recordT.cancel()
        self.mediaStop()
        self.mediaPlay(self.testRecordingFile)
        return (
            (CallEndedEvent, self.allDone),
            (MediaDoneEvent, self.waitForAKey),
            (DTMFReceivedEvent, self.gotAKey),
        )

    def allDone(self, event):
        self.returnResult('other end closed')

    def endCall(self, event):
        self.returnResult('done')


from shtoom.doug.service import DougService
from shtoom.i18n import install

install()
global app
srv = DougService(RecordingApp)
srv.startService()
app = srv.app
#app.boot()
#app.start()
コード例 #3
0
def makeAnOutboundCall(uri, room):
    srv.app.startVoiceApp(calluri=uri, room=room)


class ConfXMLRPC(xmlrpc.XMLRPC):
    "Management interface for XMLRPC"

    def xmlrpc_call(self, uri, room=None):
        makeAnOutboundCall(uri, room)
        return "Called %s" % uri

    def xmlrpc_ping(self, x):
        return "OK"


def startXMLRPC():
    from twisted.internet import reactor
    c = ConfXMLRPC()
    reactor.listenTCP(7009, server.Site(c))


if __name__ == "__main__":
    from shtoom import i18n
    i18n.install()
    from twisted.internet import reactor
    reactor.callLater(0, startXMLRPC)
    from shtoom.doug.service import DougService
    srv = DougService(ConferencingApp)
    srv.startService(mainhack=True)
コード例 #4
0
ファイル: testdoug.py プロジェクト: braams/shtoom
    def echoDone(self, event):
        self.mediaStop()
        return self.waitForAKey(event=None)

    def recordingDone(self, event):
        if not isinstance(event, TimeoutEvent):
            self._recordT.cancel()
        self.mediaStop()
        self.mediaPlay(self.testRecordingFile)
        return ( (CallEndedEvent, self.allDone),
                 (MediaDoneEvent, self.waitForAKey),
                 (DTMFReceivedEvent, self.gotAKey),
               )

    def allDone(self, event):
        self.returnResult('other end closed')

    def endCall(self, event):
        self.returnResult('done')



from shtoom.doug.service import DougService
from shtoom.i18n import install ; install()
global app
srv = DougService(RecordingApp)
srv.startService()
app = srv.app
#app.boot()
#app.start()