コード例 #1
0
ファイル: eventsocket.py プロジェクト: zombob/YouPBX
 def _disconnect_notice(self, event):
     '''
     Receives text/disconnect-notice callback.
     '''
     self._closing_state = True
     # Gets raw data for this event
     raw = self.read_raw(event)
     if raw:
         event = Event(raw)
         # Gets raw response from Event Content-Length header
         # and raw buffer
         raw_response = self.read_raw_response(event, raw)
         # If rawresponse was found, this is our Event body
         if raw_response:
             event.set_body(raw_response)
     return None
コード例 #2
0
ファイル: eventsocket.py プロジェクト: zombob/YouPBX
 def _api_response(self, event):
     '''
     Receives api/response callback.
     '''
     # Gets raw data for this event.
     raw = self.read_raw(event)
     # If raw was found, this is our Event body.
     if raw:
         event.set_body(raw)
     # Wake up waiting command.
     try:
         _cmd_uuid, _async_res = self._commands_pool.pop(0)
     except (IndexError, ValueError):
         raise InternalSyncError("Cannot wakeup command !")
     _async_res.set((_cmd_uuid, event))
     return None
コード例 #3
0
ファイル: eventsocket.py プロジェクト: pubyun/plivoframework
 def _disconnect_notice(self, event):
     '''
     Receives text/disconnect-notice callback.
     '''
     self._closing_state = True
     # Gets raw data for this event
     raw = self.read_raw(event)
     if raw:
         event = Event(raw)
         # Gets raw response from Event Content-Length header
         # and raw buffer
         raw_response = self.read_raw_response(event, raw)
         # If rawresponse was found, this is our Event body
         if raw_response:
             event.set_body(raw_response)
     return None
コード例 #4
0
ファイル: eventsocket.py プロジェクト: pubyun/plivoframework
 def _api_response(self, event):
     '''
     Receives api/response callback.
     '''
     # Gets raw data for this event.
     raw = self.read_raw(event)
     # If raw was found, this is our Event body.
     if raw:
         event.set_body(raw)
     # Wake up waiting command.
     try:
         _cmd_uuid, _async_res = self._commands_pool.pop(0)
     except (IndexError, ValueError):
         raise InternalSyncError("Cannot wakeup command !")
     _async_res.set((_cmd_uuid, event))
     return None
コード例 #5
0
ファイル: eventsocket.py プロジェクト: zombob/YouPBX
 def _event_plain(self, event):
     '''
     Receives text/event-plain callback.
     '''
     # Gets raw data for this event
     raw = self.read_raw(event)
     # If raw was found drops current event
     # and replaces with Event created from raw
     if raw:
         event = Event(raw)
         # Gets raw response from Event Content-Length header
         # and raw buffer
         raw_response = self.read_raw_response(event, raw)
         # If rawresponse was found, this is our Event body
         if raw_response:
             event.set_body(raw_response)
     # Returns Event
     return event
コード例 #6
0
ファイル: eventsocket.py プロジェクト: pubyun/plivoframework
 def _event_plain(self, event):
     '''
     Receives text/event-plain callback.
     '''
     # Gets raw data for this event
     raw = self.read_raw(event)
     # If raw was found drops current event
     # and replaces with Event created from raw
     if raw:
         event = Event(raw)
         # Gets raw response from Event Content-Length header
         # and raw buffer
         raw_response = self.read_raw_response(event, raw)
         # If rawresponse was found, this is our Event body
         if raw_response:
             event.set_body(raw_response)
     # Returns Event
     return event