diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py index 98b5dfa0a..2feb5d8de 100644 --- a/src/common/jingle_content.py +++ b/src/common/jingle_content.py @@ -70,6 +70,10 @@ class JingleContent(object): def is_ready(self): return (self.accepted and not self.sent) + def add_remote_candidates(self, candidates): + ''' Add a list of candidates to the list of remote candidates. ''' + pass + def stanzaCB(self, stanza, content, error, action): ''' Called when something related to our content was sent by peer. ''' if action in self.callbacks: @@ -78,7 +82,10 @@ class JingleContent(object): def __transportInfoCB(self, stanza, content, error, action): ''' Got a new transport candidate. ''' - self.transport.transportInfoCB(content.getTag('transport')) + candidates = self.transport.parse_transport_stanza( + content.getTag('transport')) + if candidates: + self.add_remote_candidates(candidates) def __content(self, payload=[]): ''' Build a XML content-wrapper for our data. ''' diff --git a/src/common/jingle_rtp.py b/src/common/jingle_rtp.py index 7fb9c2611..d67b0f465 100644 --- a/src/common/jingle_rtp.py +++ b/src/common/jingle_rtp.py @@ -83,6 +83,13 @@ class JingleRTPContent(JingleContent): return (JingleContent.is_ready(self) and self.candidates_ready and self.p2psession.get_property('codecs-ready')) + def add_remote_candidates(self, candidates): + JingleContent.add_remote_candidates(self, candidates) + #FIXME: connectivity should not be etablished yet + # Instead, it should be etablished after session-accept! + if self.sent: + self.p2pstream.set_remote_candidates(candidates) + def batch_dtmf(self, events): if self._dtmf_running: raise Exception #TODO: Proper exception diff --git a/src/common/jingle_transport.py b/src/common/jingle_transport.py index 83db8c039..487c66d70 100644 --- a/src/common/jingle_transport.py +++ b/src/common/jingle_transport.py @@ -46,13 +46,17 @@ class JingleTransport(object): pass def make_transport(self, candidates=None): - ''' Build a transport stanza with the given candidates (or self.candidates - if candidates is None). ''' + ''' Build a transport stanza with the given candidates (or + self.candidates if candidates is None). ''' if not candidates: candidates = self._iter_candidates() transport = xmpp.Node('transport', payload=candidates) return transport + def parse_transport_stanza(self, transport): + ''' Returns the list of transport candidates from a transport stanza. ''' + return [] + import farsight @@ -93,7 +97,7 @@ class JingleTransportICEUDP(JingleTransport): transport.setAttr('pwd', self.candidates[0].password) return transport - def transportInfoCB(self, transport): + def parse_transport_stanza(self, transport): candidates = [] for candidate in transport.iterTags('candidate'): cand = farsight.Candidate() @@ -124,16 +128,8 @@ class JingleTransportICEUDP(JingleTransport): else: print 'Unknown type %s', candidate['type'] candidates.append(cand) - #FIXME: connectivity should not be etablished yet - # Instead, it should be etablished after session-accept! - #FIXME: - #if len(candidates) > 0: - # if self.sent: - # self.p2pstream.set_remote_candidates(candidates) - # else: self.remote_candidates.extend(candidates) - #self.p2pstream.set_remote_candidates(candidates) - #print self.media, self.creator, self.name, candidates + return candidates transports[xmpp.NS_JINGLE_ICE_UDP] = JingleTransportICEUDP