⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 annexb.html

📁 sipapi 说明文档.用于JAVA的SIP开发及应用.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<BODY bgColor=white>
<center><H1>Annex B: Code examples</H1></center>
<H2>B.1.0 Establishing and stopping session - INVITE, 200 OK, ACK - BYE</H2>
<B>Originating side</B>
<p>
The MIDlet <b>(Listing B.3.1)</b> shows a simplified example of originating side UA in SIP session. The example handles only the SIP signaling in a sequence and does not handle any error cases. The MIDlet implements following things:
<UL>
<LI>Opens a <code>SipConnectionNotifier</code> for incoming requests like BYE and sets itself as a listener
<LI>Opens outbound <code>SipClientConnection</code> to the user specified in the MIDlet UI.
<LI>Initializes and sends INVITE with attached SDP content
<LI>Receives provisional responses 100, 180 until final 200 OK response
<LI>(The INVITE can be cancelled by sending CANCEL before the 200 OK has been received.)
<LI>Reads SDP content from 200 OK response
<LI>Saves the <code>SipDialog</code> information after 200 OK response
<LI>Initializes and sends ACK -> session established
<LI>Gets new <code>SipClientConnection</code> from <code>SipDialog</code> object
<LI>Initializes BYE request and sends it
<LI>Receives 200 OK for BYE -> session terminated
</UL>
</p>
<B>Terminating side</B>
<p>
This MIDlet <b>(Listing B.3.2)</b> shows an example of terminating side UA in SIP session. The example handles only the SIP signaling in a sequence and does not handle any error cases. The MIDlet does following steps:
<UL>
<LI>Opens inbound <code>SipConnectionNotifier</code> for incoming requests on "sip:5070"
<LI>Receives INVITE request and reads the SDP content
<LI>Initializes and sends responses 180 and 200 OK, with own SDP content
<LI>(The INVITE can be rejected by sending 486 Buzy Here after the 180 Ringing has been sent.)
<LI>Waits for other side to send ACK -> session established
<LI>Waits for other side to send BYE -> session terminated
</UL>
<H2>B.2.0 Subscribing for presence information</H2>
<p>
This MIDlet <b>(Listing B.3.3)</b> shows a simplified example of subscribing for presence info. The MIDlet does following things:
<UL>
<LI>Opens inbound <code>SipConnectionNotifier</code> for incoming requests on "sip:5060"
<LI>Sets the MIDlet as a listener for events from <code>SipConnectionNotifier</code>
<LI>Initializes and sends SUBSCRIBE with additional header information: Expires, Event and Accept
<LI>Waits for 200 OK response
<LI>Waits 10 seconds before sending un-SUBSCRIBE with "Expires: 0" header
<LI>Receives 200 OK for un-SUBSCRIBE in <code>notifyResponse()</code> method
<LI>The listener method <code>notifyResponse()</code> handles all NOTIFY requests
</UL>
</p>

<HR>
<H2>Listing B.3.1</H2>

<pre>
<OBJECT DATA="./examples/OriginatingINVITE.java" CODETYPE="text/plain" WIDTH=100% HEIGHT=50%>
</OBJECT>
</pre>


<HR>
<H2>Listing B.3.2</H2>

<pre>
<OBJECT DATA="./examples/TerminatingINVITE.java" CODETYPE="text/plain" WIDTH=100% HEIGHT=50%>
</OBJECT>
</pre>

<HR>
<H2>Listing B.3.3</H2>

<pre>
<OBJECT DATA="./examples/Subscribe.java" CODETYPE="text/plain" WIDTH=100% HEIGHT=50%>
</OBJECT>
</pre>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -