interfaces.py :  » Web-Services » Shtoom » shtoom-0.2 » shtoom » app » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Web Services » Shtoom 
Shtoom » shtoom 0.2 » shtoom » app » interfaces.py
# Copyright (C) 2004 Anthony Baxter
# This file is necessary to make this directory a package

from twisted.python.components import Interface

class ApplicationSIPInterface(Interface):
    """This interface describes the interface to the Application that 
       the SIP layer uses.
    """

    def acceptCall(self, **calldesc):
        """ Setup a new call. 
            calldesc describes the new call, it's a dictionary with the 
            following entries:
                calltype : 'outbound' or 'inbound'

            Returns  (callcookie,deferred) - .callback() will be invoked if 
            the call is to be accepted, or .errback() if the call is to be 
            rejected.  'callcookie' is a unique identifier used for all 
            dealings with the Application in the future about this call.
        """

    def startCall(self, callcookie, cb):
        """ Call setup is complete, the call is now live. Accepts a callback 
            which is invoked when the application wishes to terminate the call. 
            The callback is passed a reason for the call teardown.
        """

    def endCall(self, callcookie, reason):
        """ Other end has terminated the call.
        """

class ApplicationRTPInterface(Interface):
    """This interface describes the interface that an RTP implementation
       uses to talk to the Application instance
    """

    def receiveRTP(self, callcookie, payloadType, payloadData):
        """ Pass an RTP packet that was received from the network to the
            application. This might be audio, comfort noise (CN), an NTE
            packet, or something else.
        """

    def giveRTP(self, callcookie):
        """ The network layer wants an RTP packet to send. Return a 2-tuple
            of (payloadType, payloadData)
        """

class ApplicationUIInterface(Interface):
    """ This interface describes the interface that the UI can use
        to communicate with the Application.
    """

    def placeCall(self, sipURL):
        """ Place a call. returns a a deferred. The deferred's callback
            will be passed a call cookie when the call is setup. The 
            UI should use the call cookie in all future communications 
            with the Application to indicate which call it is handling.
            The deferred's errback will be called if the call setup fails.
        """

    def dropCall(self, cookie):
        """ Drop call identified by the call cookie. """

    def startDTMF(self, cookie, digit):
        """ Start sending DTMF digit 'digit' """

    def stopDTMF(self, cookie, digit):
        """ Stop sending DTMF digit 'digit' """


class Application(ApplicationSIPInterface, 
                  ApplicationRTPInterface, 
                  ApplicationUIInterface):

    def __init__(self):
        """ Create the application. The application should create the SIP
            listener and any user interface that's needed.
        """


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.