XMPPでP2Pの音声チャットセッションを確立する方法3
の続き
libjingleでcallサンプル(P2Pの音声電話)を動かしてみて、
ログみてどういうxmpp stanza送りあってるのかなぁ、見てみる。
call.exe に -d オプションをつけて動かすとデバッグ情報がログに出てくる
libjingleではGIPSMediaEngineとlinphoneというのにデフォルト対応していますが
GIPSMediaEngine手に入らないし
linphoneはWindows上でうまくbuildできないので
とりあえず適当なpayload-typeを指定しています。
IPアドレスも適当にしています
XMPPのJIDはこんな感じ
caller: [email protected]/callB3B38FB3
callee: [email protected]/call7DA716D7
ところで悲しいことに、、
libjingle Developer Guide
libjingle was created at about the same time as the Jingle XMPP extension (XEP-0166). The libjingle team created their own protocol to handle session negotiation, and later worked with the XMPP Standards Foundation to standardize Jingle; thus, although the libjingle protocol and Jingle are very similar, they are not the same, and are not interoperable.
libjingleは前回までみてきたjingle specとは非互換だしjingleの方は実装してない、さらにlibjingleの独自実装は(たぶん探しても見つからないので)仕様非公開。
いちいち難所がありますな><
very similarに期待して進みます。
セッション開始
非同期にいろいろ送りあってるので、
req/resの組み合わせがわかる
SEND »»»»»»»»»»»»> : Sun Sep 21 17:30:02 2008
</iq><iq to="[email protected]/call7DA716D7" type="set" id="7">
<session xmlns="http://www.google.com/session" type="initiate" id="2398276180" initiator="[email protected]/callB3B38FB3">
<description xmlns="http://www.google.com/session/phone"><payload -type xmlns="http://www.google.com/session/phone" id="102" name="plain" clockrate="44100"/> </description></p> <transport xmlns="http://www.google.com/transport/p2p"/> </session>
</iq>
続けて自分の候補を送る(emobileでグローバルIP持ってる)
SEND »»»»»»»»»»»»> : Sun Sep 21 17:30:03 2008<iq to="[email protected]/call7DA716D7" type="set" id="8">
<session xmlns="http://www.google.com/session" type="transport-info" id="2398276180" initiator="[email protected]/callB3B38FB3"><transport xmlns="http://www.google.com/transport/p2p"> <candidate name="rtp" address="119.1.2.3" port="3773" preference="1" username="uloaCAVUNxLbDt4w" protocol="udp" generation="0" password="yewpj2tpBCTP9C5u" type="local" network="0"/>
</transport> </session>
</iq>
RECV < «««««««««««« : Sun Sep 21 17:30:03 2008
<iq to="[email protected]/callB3B38FB3" id="7" type="result" from="[email protected]/call7DA716D7"/>
もう1個候補を送る(こっちはhamachiのIP、オフライン)id=”9″
SEND »»»»»»»»»»»»> : Sun Sep 21 17:30:03 2008
<iq to="[email protected]/call7DA716D7" type="set" id="9">
<session xmlns="http://www.google.com/session" type="transport-info" id="2398276180" initiator="[email protected]/callB3B38FB3"><transport xmlns="http://www.google.com/transport/p2p"> <candidate name="rtp" address="5.1.2.3" port="3775" preference="1" username="j7GgUkfbQnyM8npJ" protocol="udp" generation="0" password="lJeNoPmxQhOX/tkp" type="local" network="1"/>
</transport> </session>
</iq>
RECV < «««««««««««« : Sun Sep 21 17:30:03 2008
<iq to="[email protected]/callB3B38FB3" type="set" id="8" from="[email protected]/call7DA716D7">
<session type="transport-accept" id="2398276180" initiator="[email protected]/callB3B38FB3" xmlns="http://www.google.com/session"><transport xmlns="http://www.google.com/transport/p2p"/> </session>
SEND »»»»»»»»»»»»> : Sun Sep 21 17:30:03 2008
<iq to="[email protected]/call7DA716D7" id="8" type="result"/>
こんな感じで続く。。。。
finally…
STUNのところはlibjingleロギングしてくれないのでこれから見ますが、、
つながったら、こんな。
payload-type(カスタムのやつ)を受け入れますよ、ってところでしょうか
RECV < «««««««««««« : Sun Sep 21 17:30:13 2008
<iq to="[email protected]/callB3B38FB3" type="set" id="17" from="[email protected]/call7DA716D7">
<session type="accept" id="2398276180" initiator="[email protected]/callB3B38FB3" xmlns="http://www.google.com/session">
<description xmlns="http://www.google.com/session/phone"><payload -type id="102" name="plain" clockrate="44100"/> </description>
</session>
さて、次はSTUNのやり取りをみてみる