Exemple #1
0
    def __init__(self, core, request, response, mode):
        gobject.GObject.__init__(self)
        Timer.__init__(self)
        self._core = core
        self._initial_request = request
        self._last_request = request

        self._incoming = False
        self._pending_incoming_requests = set()
        self._pending_outgoing_requests = set()
        self._local_offer = None
        self._pending_local_offer = False
        self._pending_remote_offer = False
        self._pending_accept = False

        self._remote_target = None
        self._route_set = []

        self.__state = None
        self._early = True

        if mode is SIPMode.SERVER:
            self._build_UAS_dialog(request, response)
        elif mode is SIPMode.CLIENT:
            self._build_UAC_dialog(request, response)
Exemple #2
0
    def __init__(self, core, request, response, mode):
        gobject.GObject.__init__(self)
        Timer.__init__(self)
        self._core = core
        self._initial_request = request
        self._last_request = request

        self._incoming = False
        self._pending_incoming_requests = set()
        self._pending_outgoing_requests = set()
        self._local_offer = None
        self._pending_local_offer = False
        self._pending_remote_offer = False
        self._pending_accept = False

        self._remote_target = None
        self._route_set = []

        self.__state = None
        self._early = True

        if mode is SIPMode.SERVER:
            self._build_UAS_dialog(request, response)
        elif mode is SIPMode.CLIENT:
            self._build_UAC_dialog(request, response)
Exemple #3
0
    def __init__(self, session_manager, peer, peer_guid=None, euf_guid="",
            application_id=0, message=None):
        gobject.GObject.__init__(self)
        EventsDispatcher.__init__(self)
        Timer.__init__(self)
        self._session_manager = session_manager
        self._transport_manager = session_manager._transport_manager
        self._client = session_manager._client
        self._peer = peer
        self._peer_guid = peer_guid

        self._euf_guid = euf_guid
        self._application_id = application_id
        self._completed = False

        self._version = 1
        if self._client.profile.client_id.supports_p2pv2 and \
                peer.client_capabilities.supports_p2pv2:
            self._version = 2

        if message is not None:
            self._id = message.body.session_id
            self._call_id = message.call_id
            self._cseq = message.cseq
            self._branch = message.branch
            self._incoming = True
        else:
            self._id =  self._generate_id()
            self._call_id = "{%s}" % uuid.uuid4()
            self._cseq = 0
            self._branch = "{%s}" % uuid.uuid4()
            self._incoming = False

        self._session_manager._register_session(self)
Exemple #4
0
    def __init__(self, client, session, name, direction, created):
        """Initialize the media stream.

           @param client: Papyon client instance
           @type client: L{papyon.Client}
           @param session: Session that contains this stream
           @type session: L{papyon.media.session.MediaSession}
           @param name: Stream name
           @type name: string
           @param direction: Stream direction
           @type direction: L{papyon.media.constants.MediaStreamDirection}
           @param created: Whether or not the stream has been requested by the client
           @type created: bool"""

        gobject.GObject.__init__(self)
        EventsDispatcher.__init__(self)
        Timer.__init__(self)
        self._client = client
        self._session = weakref.ref(session)
        self._name = name
        self._active = False
        self._ready = False
        self._created = created
        self._direction = direction
        self._local_codecs = []
        self._local_codecs_prepared = False
        self._local_candidates = []
        self._local_active_candidates = {}
        self._local_candidates_prepared = False
        self._remote_codecs = []
        self._remote_candidates = []
        self._remote_active_candidates = {}
        self.relays = []
Exemple #5
0
 def __init__(self, transport):
     gobject.GObject.__init__(self)
     Timer.__init__(self)
     self._transport = transport
     self._branch = None
     self._method = None
     self._request = None
     self.__state = None
 def __init__(self, transport):
     gobject.GObject.__init__(self)
     Timer.__init__(self)
     self._transport = transport
     self._branch = None
     self._method = None
     self._request = None
     self.__state = None
Exemple #7
0
    def __init__(self, client, transport, proxies={}, version=15):
        """Initializer

            @param client: the parent instance of L{client.Client}
            @type client: L{client.Client}

            @param transport: The transport to use to speak the protocol
            @type transport: L{transport.BaseTransport}

            @param proxies: a dictonary mapping the proxy type to a
                L{gnet.proxy.ProxyInfos} instance
            @type proxies: {type: string, proxy:L{gnet.proxy.ProxyInfos}}
        """
        BaseProtocol.__init__(self, client, transport, proxies)
        Timer.__init__(self)
        self.__state = ProtocolState.CLOSED
        self._protocol_version = version
        self._callbacks = {} # tr_id=>(callback, errback)
Exemple #8
0
    def __init__(self, sso, account, host="relay.voice.messenger.msn.com", port=443):
        gobject.GObject.__init__(self)
        Timer.__init__(self)

        self._sso = sso
        self._account = account

        self._signals = []
        self._transport = SSLTCPClient(host, port)
        self._signals.append(self._transport.connect("notify::status",
            self.on_status_changed))
        self._signals.append(self._transport.connect("received",
            self.on_message_received))

        self._tokens = {}
        self._msg_queue = []
        self._transactions = {}  # id => (initial_request)
        self._request_id = 0
        self._requests = {} # id => (callback, errback, count, relays)
Exemple #9
0
    def __init__(self, client, transport, proxies={}, version=15):
        """Initializer

            @param client: the parent instance of L{client.Client}
            @type client: L{client.Client}

            @param transport: The transport to use to speak the protocol
            @type transport: L{transport.BaseTransport}

            @param proxies: a dictonary mapping the proxy type to a
                L{gnet.proxy.ProxyInfos} instance
            @type proxies: {type: string, proxy:L{gnet.proxy.ProxyInfos}}
        """
        BaseProtocol.__init__(self, client, transport, proxies)
        Timer.__init__(self)
        self.__state = ProtocolState.CLOSED
        self._protocol_version = version
        self._callbacks = {}  # tr_id=>(callback, errback)
        self._time_id = 0
        self.tokens = None
Exemple #10
0
    def __init__(self,
                 session_manager,
                 peer,
                 peer_guid=None,
                 euf_guid="",
                 application_id=0,
                 message=None):
        gobject.GObject.__init__(self)
        EventsDispatcher.__init__(self)
        Timer.__init__(self)
        self._session_manager = session_manager
        self._transport_manager = session_manager._transport_manager
        self._client = session_manager._client
        self._peer = peer
        self._peer_guid = peer_guid

        self._euf_guid = euf_guid
        self._application_id = application_id
        self._completed = False
        # data to be send if sending
        self._data = None

        self._version = 1
        if self._client.profile.client_id.supports_p2pv2 and \
                peer.client_capabilities.supports_p2pv2:
            self._version = 2

        if message is not None:
            self._id = message.body.session_id
            self._call_id = message.call_id
            self._cseq = message.cseq
            self._branch = message.branch
            self._incoming = True
        else:
            self._id = self._generate_id()
            self._call_id = "{%s}" % uuid.uuid4()
            self._cseq = 0
            self._branch = "{%s}" % uuid.uuid4()
            self._incoming = False

        self._session_manager._register_session(self)
Exemple #11
0
    def __init__(self, client):
        gobject.GObject.__init__(self)
        Timer.__init__(self)

        self._client = client
        self._transport = SIPTunneledTransport(client._protocol)
        self._transaction_layer = SIPTransactionLayer(self._transport)
        self._transaction_layer.connect("request-received",
                self._on_request_received)
        self._transaction_layer.connect("response-received",
                self._on_response_received)
        self._transaction_layer.connect("error",
                self._on_transaction_layer_error)

        self._supported_methods = set(["INVITE", "ACK", "CANCEL", "BYE",
            "OPTIONS", "INFO", "UPDATE", "REFER", "NOTIFY", "BENOTIFY"])
        self._supported_extensions = set(init_extensions(client, self))
        self._supported_content_types = set(["application/sdp"])

        self._dialogs = {} # (call-id, local-tag, remote-tag) => dialog
        self._dialog_handles = {} # dialog => handle id
Exemple #12
0
    def __init__(self, client, core, id, peer=None, invite=None):
        gobject.GObject.__init__(self)
        MediaCall.__init__(self, client, MediaSessionType.TUNNELED_SIP)
        RTCActivity.__init__(self, client)
        EventsDispatcher.__init__(self)
        Timer.__init__(self)

        self._core = core
        self._id = id
        self._peer = peer
        self._invite = invite

        self._incoming = (invite is not None)
        self._ringing = False
        self._pending_invite = False
        self._pending_cancel = False

        self._dialogs = []
        self._handles = {}

        if self._incoming:
            self._build_from_invite(invite)
Exemple #13
0
    def __init__(self, client):
        gobject.GObject.__init__(self)
        Timer.__init__(self)

        self._client = client
        self._transport = SIPTunneledTransport(client._protocol)
        self._transaction_layer = SIPTransactionLayer(self._transport)
        self._transaction_layer.connect("request-received",
                                        self._on_request_received)
        self._transaction_layer.connect("response-received",
                                        self._on_response_received)
        self._transaction_layer.connect("error",
                                        self._on_transaction_layer_error)

        self._supported_methods = set([
            "INVITE", "ACK", "CANCEL", "BYE", "OPTIONS", "INFO", "UPDATE",
            "REFER", "NOTIFY", "BENOTIFY"
        ])
        self._supported_extensions = set(init_extensions(client, self))
        self._supported_content_types = set(["application/sdp"])

        self._dialogs = {}  # (call-id, local-tag, remote-tag) => dialog
        self._dialog_handles = {}  # dialog => handle id