Commit b8116f40 authored by Yann Leboulanger's avatar Yann Leboulanger

fix S5B to IBB fallback. Fixes #9692, #9784

parent 5db3dc55
Pipeline #4347 passed with stages
in 2 minutes and 49 seconds
......@@ -88,7 +88,7 @@ class JingleContent:
'session-terminate': [],
'transport-info': [self.__on_transport_info],
'transport-replace': [self.__on_transport_replace],
'transport-accept': [],
'transport-accept': [self.__on_transport_replace],
'transport-reject': [],
'iq-result': [],
'iq-error': [],
......
......@@ -312,7 +312,7 @@ class JingleFileTransfer(JingleContent):
def __on_iq_result(self, stanza, content, error, action):
log.info("__on_iq_result")
if self.state == State.NOT_STARTED:
if self.state in (State.NOT_STARTED, State.CAND_RECEIVED):
self.__state_changed(State.INITIALIZED)
elif self.state == State.CAND_SENT_AND_RECEIVED:
if not self.nominated_cand['our-cand'] and \
......
......@@ -140,7 +140,9 @@ class JingleSession:
'transport-info': [self.__ack, self.__broadcast],
'transport-replace': [self.__ack, self.__broadcast,
self.__on_transport_replace], #TODO
'transport-accept': [self.__ack], #TODO
'transport-accept': [self.__ack, self.__on_session_accept,
self.__on_content_accept,
self.__broadcast],
'transport-reject': [self.__ack], #TODO
'iq-result': [self.__broadcast],
'iq-error': [self.__on_error],
......@@ -244,8 +246,9 @@ class JingleSession:
Currently used for transport replacement
'''
content = self.contents[(creator, name)]
transport.set_sid(content.transport.sid)
transport.set_file_props(content.transport.file_props)
file_props = content.transport.file_props
file_props.transport_sid = transport.sid
transport.set_file_props(file_props)
content.transport = transport
# The content will have to be resend now that it is modified
content.sent = False
......@@ -410,12 +413,13 @@ class JingleSession:
# Anyway, content's transport is not modifiable yet
pass
elif transport_ns == nbxmpp.NS_JINGLE_IBB:
transport = JingleTransportIBB()
transport = JingleTransportIBB(node=content.getTag(
'transport'))
self.modify_content(creator, name, transport)
self.state = JingleStates.PENDING
self.contents[(creator, name)].state = State.TRANSPORT_REPLACE
self.__ack(stanza, jingle, error, action)
self.__session_accept()
self.__transport_accept(transport)
else:
stanza, jingle = self.__make_jingle('transport-reject')
content = jingle.setTag('content', attrs={'creator': creator,
......@@ -834,3 +838,12 @@ class JingleSession:
conn=self.connection,
jingle_session=self,
media=media))
def __transport_accept(self, transport):
assert self.state != JingleStates.ENDED
stanza, jingle = self.__make_jingle('transport-accept')
self.__append_contents(jingle)
self.__broadcast(stanza, jingle, None, 'transport-accept')
self.connection.connection.send(stanza)
self.collect_iq_id(stanza.getID())
self.state = JingleStates.ACTIVE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment