頭を整理するためのMemo
GoogleTalkで使われているというjingle
XEP-0166: Jingle
XMPP protocol extension for initiating and managing peer-to-peer media sessions between two XMPP entities in a way that is interoperable with existing Internet standards
既存のInternet標準と共存できる方法で、2つのXMPPentities間でP2Pメディアセッションを確立、管理するためのXMPPプロトコルの拡張。
In essence, Jingle enables two XMPP entities (e.g., [email protected] and [email protected]) to set up, manage, and tear down a multimedia session. The negotiation takes place over XMPP, and the media transfer takes place outside of XMPP. The simplest session flow is as follows:
セッションのnegotiationはXMPPで、メディアはXMPP外で。
Initiator Responder
| |
| session-initiate |
|\---\---\---\---\---\---\---\---\---->|
| ack |
|< \---\---\---\---\---\---\---\---\----|
| [transport negotiation] |
|<\---\---\---\---\---\---\---\---\--->|
| session-accept |
|< \---\---\---\---\---\---\---\---\----|
| ack |
|\---\---\---\---\---\---\---\---\---->|
| AUDIO (RTP) |
|< ===========================>|
| |
Example 1. Initiator sends session-initiate
<iq from='[email protected]/orchard'
id='jingle1'
to='[email protected]/balcony'
type='set'>
<jingle xmlns='urn:xmpp:tmp:jingle'>
action='session-initiate'
initiator='[email protected]/orchard'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='voice'>
<description xmlns='urn:xmpp:tmp:jingle:apps:rtp' media='audio'><payload -type id='96' name='speex' clockrate='16000'/> <payload -type id='97' name='speex' clockrate='8000'/> <payload -type id='18' name='G729'/> <payload -type id='0' name='PCMU' /> <payload -type id='103' name='L16' clockrate='16000' channels='2'/> <payload -type id='98' name='x-ISAC' clockrate='8000'/> </description></p> <transport xmlns='urn:xmpp:tmp:jingle:transports:ice-udp'/> </content>
</jingle>
</iq>
After successful transport negotiation (not shown here), the responder accepts the session by sending a session-accept action to the initiator.
Example 3. Responder definitively accepts the session
<iq from='[email protected]/balcony'
id='accept1'
to='[email protected]/orchard'
type='set'>
<jingle xmlns='urn:xmpp:tmp:jingle'
action='session-accept'
initiator='[email protected]/orchard'
responder='[email protected]/balcony'
sid='a73sjjvkla37jfea'>
<content creator='initiator' name='voice'>
<description xmlns='urn:xmpp:tmp:jingle:apps:rtp' media='audio'><payload -type id='97' name='speex' clockrate='8000'/> <payload -type id='18' name='G729'/> </description></p> <transport xmlns='urn:xmpp:tmp:jingle:transports:ice-udp'> <candidate component='1'
foundation='1'
generation='0'
ip='192.0.2.3'
network='1'
port='45664'
priority='1678246398'
protocol='udp'
pwd='asd88fgpdd777uzjYhagZg'
type='srflx'
ufrag='8hhy'/>
</transport> </content>
</jingle>
</iq>
IPアドレスとポートはどうやって取得してるんだろ。
この例では192..ってローカルのIPだけどNAT超えの時は、NATの外側のグローバルIPとポートが必要でしょう。
XEP-0166: Jingleでは省略されてる transport negotiation について調べる。