欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

SIP Presence and Instant Message Example

系統 1690 0

This example shows how SIP is used in a presence and instant messaging application. Presence information can be thought of as the state of a user or device at a particular instant. It can be as simple as whether a particular user is signed in or not, whether they are active at their station, or idle or away. For a mobile device, presence information can include the actual location in terms of coordinates, or in general terms such as "in the office", "on travel", or "in the lab". Presence information can even include information about the status or mood of the user, whether they are working, relaxing, or socializing. For all these examples, a presence protocol is mainly concerned about establishing subscriptions or long-term relationships between devices about transferring status information, and the delivery of that information. The actual information transferred, and how that information is presented to the user is application dependent. In terms of the SIP protocol, SUBSCRIBE is used to request status or presence updates from the presence server (or "presentity"), and NOTIFY is used to deliver that information to the requestor or presence "watcher". SIP presence uses the SIP Events extensions [4] and instant message extensions [5].

In this example, Chebychev wishes to communicate with Poisson. The message flow is shown in Figure 2.4 . To find out the status of Poisson, Chebychev subscribes to Poisson's presence information by sending a SUBSCRIBE message to Poisson. The request looks like:

           SUBSCRIBE sip:poisson@probability.org SIP/2.0
     Via SIP/2.0/TCP lecturehall21.academy.ru:5060
      ;branch=z9hG4bK348471123
     Max-Forwards: 70
     To: M. Poisson <sip:poisson@probability.org>
     From: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 3412 SUBSCRIBE
     Allow-Events: presence
      
      
      
      
      
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Contact: <sip:pafnuty@lecturehall21.academy.ru;transport=tcp>
     Event: presence
     Content-Length: 0

    

Figure 2.4: SIP presence and instant message example.

In this example, TCP is used as the transport for the SIP messages as indicated in the Via header field and in the transport=tcp parameter in the Contact URI. This request also contains Allow and Allow-Events header fields, which are used to advertise capabilities. In this example, Chebychev is indicating support for receiving seven methods listed in the Allow header field, and also presence subscriptions in the Allow-Event header field. As this SUBSCRIBE is creating a dialog (in an analogous way that an INVITE created a dialog in the earlier examples), the From contains a tag but the To header field does not yet contain a tag.

Poisson accepts the subscription request by sending a 202 Accepted response back to Chebychev:

           SIP/2.0 202 Accepted
     Via SIP/2.0/TCP lecturehall21.academy.ru:5060
      ;branch=z9hG4bK348471123;received=19.34.3.1
     To: M. Poisson <sip:poisson@probability.org>;tag=25140
     From: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 3412 SUBSCRIBE
     Allow-Events: presence
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Contact: <sip:s.possion@dist.probability.org;transport=tcp>
     Event: presence
     Expires: 3600
     Content-Length: 0

    

In this example, there are no proxy servers between Chebychev's watcher and Poisson's presence server, although there could be any number. The Expires header field indicates that the subscription expires in 1 hour. The actual subscription is begun by Poisson sending the first NOTIFY back to Chebychev:

           NOTIFY sip:pafnuty@lecturehall21.academy.ru SIP/2.0
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK4321
     Max-Forwards: 70
     To: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     From: M. Poisson <sip:poisson@probability.org>;tag=25140
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 1026 NOTIFY
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Allow-Events: dialog
     Contact: <sip:s.possion@dist.probability.org;transport=tcp>
     Subscription-State: active;expires=3600
     Event: presence
     Content-Type: application/cpim-pidf+xml
     Content-Length: 244

     <?xml version="1.0" encoding="UTF-8"?>
     <presence xmlns="urn:ietf:params:xml:ns:cpim-pidf"
       entity="sip:poisson@probability.org">
      <tuple id="452426775">
       <status>
       <basic>closed</basic>
       </status>
      </tuple>
     </presence>

    

Note that this NOTIFY is sent within the dialog established with the SUBSCRIBE -it uses the same dialog identifier ( Call-ID , local and remote tag s)-and the request is sent to the Contact URI provided by Chebychev in the subscription request. The Subscription-State header field indicates that the subscription has been authorized and activate and that it will expire in 1 hour unless refreshed by Chebychev (using another SUBSCRIBE request).

The Common Presence and Instant Message Presence Information Data Format (CPIM PIDF) [6] XML message body contains the status information that Poisson is currently off-line ( closed ).

Chebychev sends a 200 OK response to the NOTIFY to confirm that it has been received:

           SIP/2.0 200 OK
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK4321;received=24.32.1.3
     To: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     From: M. Poisson <sip:poisson@probability.org>;tag=25140
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 1026 NOTIFY
     Content-Length: 0

    

Later, when Poisson does sign in, this information is provided in a second NOTIFY containing the change in status:

           NOTIFY sip:pafnuty@lecturehall21.academy.ru SIP/2.0
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK334241
     Max-Forwards: 70
     To: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     From: M. Poisson <sip:poisson@probability.org>;tag=25140
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 1027 NOTIFY
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Allow-Events: presence
     Contact: <sip:s.possion@dist.probability.org;transport=tcp>
     Subscription-State: active;expires=1800
     Event: presence
     Content-Type: application/cpim-pidf+xml
     Content-Length: 325

     <?xml version="1.0" encoding="UTF-8"?>
     <presence xmlns="urn:ietf:params:xml:ns:cpim-pidf"
       entity="sip:poisson@probability.org">
      <tuple id="452426775">
       <status>
        <basic>open</basic>
       </status>
        <contact>sip:s.possion@dist.probability.org;transport=tcp
        </contact>
      
      
      
      
      
      </tuple>
     </presence>

    

The expiration time indicated in the Subscription-State header field indicates that 30 minutes have passed since the subscription was established. The CPIM PIDF XML message body now indicates that Poisson is on-line ( open ) and can be reached via the URI sip:s.possion@dist.probability.org;transport=tcp .

Chebychev confirms receipt of the NOTIFY with a 200 OK response:

           SIP/2.0 200 OK
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK334241;received=24.32.1.3
     To: P. L. Chebychev <sip:chebychev@academy.ru>;tag=21171
     From: M. Poisson <sip:poisson@probability.org>;tag=25140
     Call-ID: 58dkfj34924lk34452k592520
     CSeq: 1027 NOTIFY
     Content-Length: 0

    

Now that Chebychev knows that Poisson is on-line, he sends an instant message to him using the Contact URI from the NOTIFY :

           MESSAGE sip:s.possion@dist.probability.org SIP/2.0
     Via SIP/2.0/TCP lecturehall21.academy.ru:5060
      ;branch=z9hG4bK3gtr2
     Max-Forwards: 70
     To: M. Poisson <sip:s.possion@dist.probability.org>
     From: P. L. Chebychev <sip:chebychev@academy.ru>;tag=4542
     Call-ID: 9dkei93vjq1ei3
     CSeq: 15 MESSAGE
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Content-Type: text/plain
     Content-Length: 9

     Hi There!

    

Notice that this MESSAGE is sent outside the dialog. Instant messages sent using the MESSAGE method in SIP are like page messages-they are not part of any dialog. As a result, each message contains a new Call-ID and From tag. The 200 OK response is used to acknowledge receipt of the instant message:

           SIP/2.0 200 OK
     Via SIP/2.0/TCP lecturehall21.academy.ru:5060
      ;branch=z9hG4bK3gtr2;received=19.34.3.1
     To: M. Poisson <sip:s.possion@dist.probability.org>;tag=2321
     From: P. L. Chebychev <sip:chebychev@academy.ru>;tag=4542
     Call-ID: 9dkei93vjq1ei3
     CSeq: 15 MESSAGE
     Content-Length: 0

    

Poison answers with a reply, which is also sent outside of any dialog, with a new Call-ID and From tag (an instant message response is never sent in a 200 OK reply to a MESSAGE request):

           MESSAGE sip:chebychev@academy.ru SIP/2.0
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK4526245
     Max-Forwards: 70
     To: P. L. Chebychev <sip:chebychev@academy.ru>
     From: M. Poisson <sip:s.possion@dist.probability.org>;tag=14083
     Call-ID: lk34452k592520
     CSeq: 2321 MESSAGE
     Allow: ACK, INVITE, CANCEL, BYE, NOTIFY, SUBSCRIBE, MESSAGE
     Content-Type: text/plain
     Content-Length: 30

     Well, hello there to you, too!

    

which receives a 200 OK reply:

           SIP/2.0 200 OK
     Via SIP/2.0/TCP dist.probablilty.org:5060
      ;branch=z9hG4bK4526245;received=24.32.1.3
     To: P. L. Chebychev <sip:chebychev@academy.ru>;tag=mc3bg5q77wms
     From: M. Poisson <sip:s.possion@dist.probability.org>;tag=14083
     Call-ID: lk34452k592520
     CSeq: 2321 MESSAGE
     Content-Length: 0

    

Other presence packages define other sets of information that can be requested by watchers from presence servers.

SIP Presence and Instant Message Example


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 久久99精品久久 | 日韩欧美一区二区三区不卡在线 | 亚洲香蕉久久一区二区三区四区 | 男女在线网站 | 国产69精品久久久久99尤物 | 成人午夜精品视频在线观看 | 色屁屁www影院免费观看软件 | 一区二区三区四区在线观看视频 | 古代级a毛片免费观看 | 欧美成人私人视频88在线观看 | 特色特色大片在线 | 国内外一级毛片 | 三级免费网址 | 波多野结衣一区二区三区在线观看 | 日本大黄视频 | 一级毛片一级毛片一级毛片 | 91久久久久久久久 | 在线观看亚洲网站 | 亚洲精品久久久久一区二区 | 高清久久 | 久久精品久久精品国产大片 | 国产日产精品久久久久快鸭 | 天天操天天射天天舔 | 国产中文字幕在线观看 | 狠狠操夜夜操 | 99r精品在线 | 国产999精品久久久久久 | 欧美专区在线视频 | 欧美黑人激情 | 久久精品成人 | 亚洲伊人网站 | 在线一区免费视频播放 | 国产精品蜜臂在线观看 | 国产大片免费观看中文字幕 | 欧美专区在线 | 国产精品免费观看 | 正在播放国产精品 | 伊人色综合97| 成人精品综合免费视频 | 精品一卡2卡三卡四卡二卡 欧美不卡一区二区三区在线观看 | 国产成人黄网址在线视频 |