Message Details:
F1 INVITE Alice -> Bob
INVITE sips:bob@biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf9
Max-Forwards: 70
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>
Call-ID: 12345600@atlanta.example.com
CSeq: 1 INVITE
Contact: <sips:alice@client.atlanta.example.com>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: ...
v=0
o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com
s=Session SDP
c=IN IP4 client.atlanta.example.com
t=3034423619 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F2 180 Ringing Bob -> Alice
SIP/2.0 180 Ringing
Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf9
;received=192.0.2.103
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>;tag=23431
Call-ID: 12345600@atlanta.example.com
CSeq: 1 INVITE
Contact: <sips:bob@client.biloxi.example.com>
Content-Length: 0
F3 200 OK Bob -> Alice
SIP/2.0 200 OK
Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf9
;received=192.0.2.103
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>;tag=23431
Call-ID: 12345600@atlanta.example.com
CSeq: 1 INVITE
Contact: <sips:bob@client.biloxi.example.com>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces, join, gruu
Content-Type: application/sdp
Content-Length: ...
v=0
o=bob 2890844527 2890844527 IN IP4 client.biloxi.example.com
s=Session SDP
c=IN IP4 client.biloxi.example.com
t=3034423619 0
m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F4 ACK Alice -> Bob
ACK sips:bob@client.biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf6
Max-Forwards: 70
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>;tag=23431
Call-ID: 12345600@atlanta.example.com
CSeq: 1 ACK
Content-Length: 0
/* Alice and Bob have established a session. Carol requests to join the session */
F5 INVITE Carol -> Bob
INVITE sips:bob@biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS chicago.example.com:5061;branch=z9hG4bKnashds7
Max-Forwards: 70
From: Carol <sips:carol@chicago.example.com>;tag=8675309
To: Bob <sips:bob@biloxi.example.com>
Call-ID: 452k499sk@chicago.example.com
CSeq: 99 INVITE
Contact: <sips:carol@client.chicago.example.com>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces, join
Join: 12345600@atlanta.example.com;from-tag=1234567;to-tag=23431
Content-Type: application/sdp
Content-Length: ...
v=0
o=carol 2890844922 2890844922 IN IP4 client.chicago.example.com
s=Session SDP
c=IN IP4 client.chicago.example.com
t=3034423619 0
m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F6 180 Ringing Carol -> Bob
SIP/2.0 200 OK
Via: SIP/2.0/TLS chicago.example.com:5061;branch=z9hG4bKnashds7
;received=120.
From: Carol <sips:carol@chicago.example.com>;tag=8675309
To: Bob <sips:bob@biloxi.example.com>;tag=0982
Call-ID: 452k499sk@chicago.example.com
CSeq: 99 INVITE
Contact: <sips:bob-Mixer@client.biloxi.example.com>;isfocus
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces
Content-Length: 0
F7 re-INVITE Bob -> Alice
INVITE sips:alice@client.atlanta.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:5061;branch=z9hG4bKnashdyKL
Max-Forwards: 70
From: Bob <sips:bob@biloxi.example.com>;tag=23431
To: Alice <sips:alice@atlanta.example.com>;tag=1234567
Call-ID: 12345600@atlanta.example.com
CSeq: 1024 INVITE
Contact: <sips:bob-Mixer@client.biloxi.example.com>;isfocus
Content-Type: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces, join, gruu
Content-Length: ...
v=0
o=bob 2890844527 2890844528 IN IP4 client.biloxi.example.com
s=Session SDP
c=IN IP4 client.biloxi.example.com
t=3034423619 0
m=audio 49172 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F8 200 OK Alice -> Bob
SIP/2.0 200 OK
Via: SIP/2.0/TLS client.biloxi.example.com:5061;branch=z9hG4bKnashdyKL
;received=192.0.2.113
From: Bob <sips:bob@biloxi.example.com>;tag=23431
To: Alice <sips:alice@atlanta.example.com>;tag=1234567
Call-ID: 12345600@atlanta.example.com
CSeq: 1024 INVITE
Contact: <sips:alice@client.atlanta.example.com>;isfocus
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: ...
v=0
o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com
s=Session SDP
c=IN IP4 client.atlanta.example.com
t=3034423619 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F9 ACK Bob -> Alice
ACK sips:alice@client.atlanta.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:5061;branch=z9hG4bKnash3g
Max-Forwards: 70
From: Bob <sips:bob@biloxi.example.com>;tag=23431
To: Alice <sips:alice@atlanta.example.com>;tag=1234567
Call-ID: 12345600@atlanta.example.com
CSeq: 1024 ACK
Content-Length: 0
F10 200 OK Bob -> Carol
SIP/2.0 200 OK
Via: SIP/2.0/TLS chicago.example.com:5061;branch=z9hG4bKnashds7
;received=120.
From: Carol <sips:carol@chicago.example.com>;tag=8675309
To: Bob <sips:bob@biloxi.example.com>;tag=0982
Call-ID: 452k499sk@chicago.example.com
CSeq: 99 INVITE
Contact: <sips:bob-Mixer@client.biloxi.example.com>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces, join, gruu
Content-Type: application/sdp
Content-Length: ...
v=0
o=bob 28908445834 2890844834 IN IP4 client.biloxi.example.com
s=Session SDP
c=IN IP4 client.biloxi.example.com
t=3034423645 0
m=audio 48174 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F11 ACK OK Carol -> Bob
ACK sips:bob@biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS chicago.example.com:5061;branch=z9hG4bKnash4Gf
Max-Forwards: 70
From: Carol <sips:carol@chicago.example.com>;tag=8675309
To: Bob <sips:bob@biloxi.example.com>;tag=0982
Call-ID: 452k499sk@chicago.example.com
CSeq: 99 ACK
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces, join
Content-Length:0
1.1.1. 会议加入
例1 Join accepted for local mixing
A B C
| | |
| callid: 4@A | callid: 7@c |
| | |
| |<============>|
| | |
|INVITE------>| |
|Join: 7@c | |
| | |
|<----200-----| |
|-----ACK---->| |
| | |
| .. begins mixing .. |
| | |
|<===========>|<============>|
|<::::::::::::::::::::::::::>|
| | |
After accepting a Join from A, the conversation space which contained B and C,
now has added A as well:
[ B , C ] --> [ A , B , C ]
例2 Join accepted and transitioned to central mixer
A B C conf
| | callid: 7@c | |
| | | |
| |<-INVITE------| | *1
| |-----200----->| | *2
| |<----ACK------| | *3
| |<============>| |
| | | |
|INVITE------>| | | *4
|Join: 7@c |--INVITE-------------------->| *5
| |<----200---------------------| *6
| |-----ACK-------------------->|
|<----302-----| | | *7
|-----ACK---->| | |
|INVITE------------------------------------>| *8
|<--200-------------------------------------| *9
|---ACK------------------------------------>|
| |--REFER------>| | *10
| |<---202-------| |
| |<--NOTIFY-----|--INVITE-*11->|
| |------200---->|<----200-*12--|
| |<--NOTIFY-----|-----ACK----->|
| |------200---->| |
| |---BYE------->| |
| |<--200--------| |
| | | |
|<=========================================>| mixes the
| |<===========================>| three sessions
| | |<============>| together
The conversation space now looks identical to the previous example.
Details of how the Join are implemented are transparent to A. B
could have also used 3rd party call control to move the necessary
sessions.
[ B , C ] --> [ A , B , C ]
Message Details:
Message *1: C -> B
INVITE sip:bob@example.org SIP/2.0
To: <bob@example.org>
From: <carol@example.org>;tag=xyz
Call-Id: 7@c.example.org
CSeq 1 INVITE
Contact: <sip:carol@c.example.org>
Message *2: B -> C
SIP/2.0 200 OK
To: <bob@example.org>;tag=pdq
From: <carol@example.org>;tag=xyz
Call-Id: 7@c.example.org
CSeq 1 INVITE
Contact: <sip:bob@b.example.org>
Message *3: C -> B
ACK sip:carol@c.example.org SIP/2.0
To: <bob@example.org>;tag=pdq
From: <carol@example.org>;tag=xyz
Call-Id: 7@c.example.org
CSeq 1 INVITE
Message *4: A -> B
INVITE sip:bob@b.example.org SIP/2.0
To: <sip:bob@example.org>
From: <sip:alice@example.org>;tag=iii
Call-Id: 777@a.example.org
CSeq: 1 INVITE
Contact: <sip:alice@a.example.org>
Join: 7@c.example.org;to-tag=xyz;from-tag=pdq
Message *5: B -> conf
INVITE sip:conf-factory@example.org SIP/2.0
To: <sip:conf-factory@example.org>
From: <sip:bob@example.org>;tag=abc
Call-Id: 999@b.example.org
CSeq: 1INVITE
Contact: <sip:bob@b.example.org>
Message *6: conf -> B
SIP/2.0 200 OK
To: <sip:conf-factory@example.org>;tag=def
From: <sip:bob@example.org>;tag=abc
Call-Id: 999@b.example.org
CSeq: 1INVITE
Contact: <sip:conf456@conf-srv2.example.org>;isFocus
Message *7: B -> A
SIP/2.0 302 Moved Temporarily
To: <sip:bob@example.org>
From: <sip:alice@example.org>;tag=iii
Call-Id: 777@a.example.org
CSeq: 1 INVITE
Contact: <sip:conf456@conf-srv2.example.org>;isFocus
Message *8: A -> conf
INVITE sip:conf456@conf-srv2.example.org SIP/2.0
To: <sip:bob@example.org>
From: <sip:alice@example.org>;tag=iii
Call-Id: 777@a.example.org
CSeq: 2 INVITE
Contact: <sip:alice@a.example.org>
Join: 7@c.example.org;to-tag=xyz;from-tag=pdq
Message *9: conf ->A
SIP/2.0 200 OK
To: <sip:bob@example.org>;tag=jjj
From: <sip:alice@example.org>;tag=iii
Call-Id: 777@a.example.org
CSeq: 2 INVITE
Contact: <sip:conf456@conf-srv2.example.org>;isFocus
Message *10: B -> C
REFER sip:carol@c.example.org SIP/2.0
To: <carol@example.org>;tag=xyz
From: <bob@example.org>;tag=pdq
Call-Id: 7@c.example.org
CSeq: 1 REFER
Contact: <sip:bob@b.example.org>
Refer-To: <sip:conf456@conf-srv2.example.org>
Referred-By: <sip:bob@b.example.org>
Message *11: C -> conf
INVITE sip:conf456@conf-srv2.example.org SIP/2.0
To: <sip:conf456@conf-srv2.example.org>
From: <carol@example.org>;tag=mmm
Call-Id: 34343@c.example.com
CSeq: 1 INVITE
Contact: <sip:carol@c.example.com>
Referred-By: <sip:bob@b.example.org>
Message *12: C -> conf
SIP/2.0 200 OK
To: <sip:conf456@conf-srv2.example.org>
From: <carol@example.org>;tag=mmm
Call-Id: 34343@c.example.com
CSeq: 1 INVITE
Contact: <sip:conf456@conf-srv2.example.org>;isFocus
Referred-By: <sip:bob@b.example.org>
1.1.1. Call Forward
呼叫传送/网络跟随:Call Forwarding is a service that allows you to divert incoming calls to another phone number. You are offered four divert options and the number towards which the calls are diverted can be either a cellular or a fixed telephone number.
呼叫传送常用在以下情况:
l Unconditional
All calls received will be forwarded to the number you have previously chosen. In this case, you will not receive any calls on your phone.
l No Answer
All unanswered calls are forwarded to the number you have previously chosen.
l Unreachable
All calls towards a customer who has his phone turned off or is out of the coverage area will be diverted to the number you have previously chosen.
l Busy
All calls received when already engaged in a call will be forwarded to the number you have previously chosen.
例:Call Forward On Busy
In this scenario User B1 wants calls forwarded to another destination if the original line is busy. It is assumed that the proxy knows where to forward the call.
F1 INVITE A -> Proxy
INVITE sip:UserB1@ss1.wcom.com SIP/2.0
Via: SIP/2.0/UDP here.com:5060
From: BigGuy
To: LittleGuy
Call-ID: 12345600@here.com
CSeq: 1 INVITE
Contact: BigGuy
Proxy-Authorization: DIGEST username="UserA", realm="MCI WorldCom
SIP", nonce="9137d175c20a0d6eadd7be1c863302ae", opaque="",
uri="sip:ss1.wcom.com", response="cf25aad811c806bde46a369220158cec"
Content-Type: application/sdp
Content-Length: ...
v=0
o=UserA 2890844526 2890844526 IN IP4 client.here.com
s=Session SDP
c=IN IP4 100.101.102.103
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
F4 486 Busy Here B1 -> Proxy
User B's phone responds back with a busy message ( 486 )
SIP/2.0 486 Busy Here
Via: SIP/2.0/UDP ss1.wcom.com:5060;branch=1
Via: SIP/2.0/UDP here.com:5060
From: BigGuy
To: LittleGuy ;tag=123456
Call-ID: 12345600@here.com
CSeq: 1 INVITE
Content-Length: 0
F6 INVITE Proxy -> B2
The call is then forwarded to a new location at "THERE.COM." Since the call is going to a new location, a new INVITE and session description is sent.
INVITE sip:UserB2@ there.com SIP/2.0
Via: SIP/2.0/UDP ss1.wcom.com:5060;branch=2
Via: SIP/2.0/UDP here.com:5060
Record-Route:
From: BigGuy
To: LittleGuy
Call-ID: 12345600@here.com
CSeq: 1 INVITE
Contact: BigGuy
Content-Type: application/sdp
Content-Length: ...
v=0
o=UserA 2890844526 2890844526 IN IP4 client.here.com
s=Session SDP
c=IN IP4 100.101.102.103
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
1.1.1. 能力查询
SIP IP电话系统还提供了一种让用户在不打扰对方用户的情况下查询对方通信能力的手段。可查询的内容包括:对方支持的请求方法(methods)、支持的内容类型、支持的扩展项、支持的编码等等。
能力查询通过OPTION请求消息来实现。当用户代理想要查询对方的能力时,它构造一个OPTION请求消息,发送给对方。对方收到该请求消息后,将自己支持的能力通过响应消息回送给查询者。如果此时自己可以接收呼叫,就发送成功响应(状态码为200),如果此时自己忙,就发送自身忙响应(状态码为486)。因此,能力查询过程也可以用于查询对方的忙闲状态,看是否能够接受呼叫。
例
Example OPTIONS request:
OPTIONS sip:carol@chicago.com SIP/2.0
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877
Max-Forwards: 70
To: <sip:carol@chicago.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 63104 OPTIONS
Contact: <sip:alice@pc33.atlanta.com>
Accept: application/sdp
Content-Length: 0
Example OPTIONS response generated by a UAS
SIP/2.0 200 OK
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bKhjhs8ass877
;received=192.0.2.4
To: <sip:carol@chicago.com>;tag=93810874
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710
CSeq: 63104 OPTIONS
Contact: <sip:carol@chicago.com>
Contact: <mailto:carol@chicago.com>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE
Accept: application/sdp
Accept-Encoding: gzip
Accept-Language: en
Supported: foo
Content-Type: application/sdp
Content-Length: 274
(SDP not shown)
1.1.2. SUBSCRIBE/NOTIFY
SUBSCRIBE:该方法用来向远端端点预订其状态变化的通知;
NOTIFY:该方法发送消息以通知预订者它所预定的状态的变化。
比如:
l SUBSCRIBE “I would like to monitor your presence.”
l NOTIFY “Hi! I’m online now and available to communicate”
l MESSAGE “I’m sending you an instant message.”
Presentity - The entity that is projecting its presence information. More often this is a user identified with a SIP address.
Watcher - The entity that is receiving presence information. More often this is a user identified with a SIP address.
Presentity & Watchers
l Presence Agent (PA) receives SUBSCRIBE request and gets authorization from target
l if authorized, a positive response gets back (i.e. 200 OK)
l target changes state
l PA sends changed state as presence information (in body) via NOTIFY request to subscribers
Basic Presence Features
Communications Services
例1
EndPoint Packet8
| |
| F1 SUBSCRIBE |
|----------------------->|
| F2 200 OK |
|<-----------------------|
| F3 NOTIFY |
|<-----------------------|
| F4 200 OK |
|----------------------->|
| |
| |
| F5 NOTIFY |
|<-----------------------|
| F6 200 OK |
|----------------------->|
| |
F1:
SUBSCRIBE sip:02104412@packet8.net SIP/2.0
Via: SIP/2.0/UDP 10.1.28.247;branch=z9hG4bK.28c3c.192e;rport
From: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
To: test<sip:02104412@packet8.net>
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 100 SUBSCRIBE
Contact: sip:02104412@10.1.28.247
Expires: 1800
Max-Forwards: 70
Event: message-summary
User-Agent: DTA SIP/0.11.8 NNOS/VR30
Content-Length: 0
F2:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.28.247;branch=z9hG4bK.28c3c.192e
;rport=5060;received=12.234.8.147
From: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
To: test<sip:02104412@packet8.net>;tag=dimn9pu1sxelbix6kr4xsl5s4
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 100 SUBSCRIBE
Record-Route: <sip:02104412@192.84.18.251:5060;lr>
Contact: <sip:02104412@192.84.18.252:5066>
Server: eSLEE/0.8.7 Packet8-MWINotifier (StVallier)
Content-Length: 0
Expires: 1800
F3:
NOTIFY sip:02104412@10.1.28.247 SIP/2.0
Via: SIP/2.0/UDP 192.84.18.251:5060
;branch=z9hG4bK9rp493qfntaagovhw7t0qixro
Via: SIP/2.0/UDP 192.84.18.252:5066
;branch=z9hG4bKbnsrkh0lc50bhwp8tv5qoe4s0
From: test<sip:02104412@packet8.net>;tag=dimn9pu1sxelbix6kr4xsl5s4
To: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 1964223776 NOTIFY
Contact: <sip:02104412@192.84.18.252:5066>
Max-Forwards: 69
Event: message-summary
Subscription-State: active
Content-Length: 44
Content-Type: application/simple-message-summary
User-Agent: eSLEE/0.8.7 Packet8-MWINotifier (StVallier)
Record-Route: <sip:02104412@192.84.18.251:5060;lr>
Message-Waiting: yes
Voicemail: 9/9 (0/0)
F4:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.84.18.251:5060
;branch=z9hG4bK9rp493qfntaagovhw7t0qixro
Via: SIP/2.0/UDP 192.84.18.252:5066
;branch=z9hG4bKbnsrkh0lc50bhwp8tv5qoe4s0
From: test<sip:02104412@packet8.net>;tag=dimn9pu1sxelbix6kr4xsl5s4
To: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 1964223776 NOTIFY
Record-Route: <sip:02104412@192.84.18.251:5060;lr>
Server: DTA SIP/0.11.8 NNOS/VR30
Content-Length: 0
F5:
NOTIFY sip:02104412@10.1.28.247 SIP/2.0
Via: SIP/2.0/UDP 192.84.18.251:5060
;branch=z9hG4bK9rp493qfntaagovhw7t0qixro
Via: SIP/2.0/UDP 192.84.18.252:5066
;branch=z9hG4bKbnsrkh0lc50bhwp8tv5qoe4s0
From: test<sip:02104412@packet8.net>;tag=dimn9pu1sxelbix6kr4xsl5s4
To: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 1964223777 NOTIFY
Contact: <sip:02104412@192.84.18.252:5066>
Max-Forwards: 69
Event: message-summary
Subscription-State: active
Content-Length: 44
Content-Type: application/simple-message-summary
User-Agent: eSLEE/0.8.7 Packet8-MWINotifier (StVallier)
Record-Route: <sip:02104412@192.84.18.251:5060;lr>
Message-Waiting: yes
Voicemail: 10/10 (0/0)
F6:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.84.18.251:5060
;branch=z9hG4bK9rp493qfntaagovhw7t0qixro
Via: SIP/2.0/UDP 192.84.18.252:5066
;branch=z9hG4bKbnsrkh0lc50bhwp8tv5qoe4s0
From: test<sip:02104412@packet8.net>;tag=dimn9pu1sxelbix6kr4xsl5s4
To: test<sip:02104412@packet8.net>;tag=t28e6ca192eg41a7
Call-ID: 4b678-192d-a2f420-a0130bb@packet8.net
CSeq: 1964223777 NOTIFY
Record-Route: <sip:02104412@192.84.18.251:5060;lr>
Server: DTA SIP/0.11.8 NNOS/VR30
Content-Length: 0
例2
Subscriber(Watcher) Notifier(Resource List Server)
| |
| A1: SUBSCRIBE (new) |
|---------------------->|
| A2: 200 OK |
|<----------------------|
| |
| A3: NOTIFY (sync) |
|<----------------------|
| A4: 200 OK |
|---------------------->|
| | A5: UPDATE
| |<--------------| Resource(Presence User Agent)
| A6: NOTIFY (change) |
|<----------------------|
| A7: 200 OK |
|---------------------->|
| |
| |
| A8: (re)SUBSCRIBE |
|---------------------->|
| A9: 200 OK |
|<----------------------|
| |
| A10: NOTIFY (sync) |
|<----------------------|
| A11: 200 OK |
|---------------------->|
| |
| |
| A12: (un)SUBSCRIBE |
|---------------------->|
| A13: 200 OK |
|<----------------------|
| |
| A14: NOTIFY (sync) |
|<----------------------|
| A15: 200 OK |
|---------------------->|
A1: Subscriber (Alice's phone) -> Notifier (Alice's voicemail gateway)
(Subscribe to Alice's message summary status for 1 day.)
SUBSCRIBE sip:alice@vmail.example.com SIP/2.0
To: <sip:alice@example.com>
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 03:55:06 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 4 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Event: message-summary
Expires: 86400
Accept: application/simple-message-summary
Content-Length: 0
A2: Notifier -> Subscriber
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 03:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 4 SUBSCRIBE
Expires: 86400
Content-Length: 0
A3: Notifier -> Subscriber
(immediate synchronization of current state:2 new and 8 old [2 urgent] messages)
NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 03:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 20 NOTIFY
Contact: <sip:alice@vmail.example.com>
Event: message-summary
Subscription-State: active
Content-Type: application/simple-message-summary
Content-Length: 99
Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 2/8 (0/2)
A4: Subscriber -> Notifier
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 03:55:08 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 20 NOTIFY
Content-Length: 0
A5: Resource -> Notifier
(information on the Resource List Server is being updated by SIP or non-SIP means.)
A6: Notifier -> Subscriber
(This is a notification of new messages.Some headers from each of the new messages are appended.)
NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 04:28:53 GMT
Contact: <sip:alice@vmail.example.com>
Call-ID: 1349882@alice-phone.example.com
CSeq: 31 NOTIFY
Event: message-summary
Subscription-State: active
Content-Type: application/simple-message-summary
Content-Length: 503
Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 4/8 (1/2)
To: <alice@atlanta.com>
From: <bob@biloxi.com>
Subject: carpool tomorrow?
Date: Sun, 09 Jul 2000 21:23:01 -0700
Priority: normal
Message-ID: 13784434989@vmail.example.com
To: <alice@example.com>
From: <cathy-the-bob@example.com>
Subject: HELP! at home ill, present for me please
Date: Sun, 09 Jul 2000 21:25:12 -0700
Priority: urgent
Message-ID: 13684434990@vmail.example.com
A7: Subscriber -> Notifier
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 04:28:53 GMT
Call-ID: 1349882@alice-phone.example.com
CSeq: 31 NOTIFY
Content-Length: 0
A8: Subscriber -> Notifier
(Refresh subscription.)
SUBSCRIBE sip:alice@vmail.example.com SIP/2.0
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 15:55:06 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 8 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Event: message-summary
Expires: 86400
Accept: application/simple-message-summary
Content-Length: 0
A9: Notifier -> Subscriber
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 15:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 8 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Expires: 86400
Content-Length: 0
A10: Notifier -> Subscriber
(immediate synchronization of current state)
NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 15:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 47 NOTIFY
Contact: <sip:alice@vmail.example.com>
Event: message-summary
Subscription-State: active
Content-Type: application/simple-message-summary
Content-Length: 99
Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 4/8 (1/2)
A11: Subscriber -> Notifier
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 15:55:08 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 47 NOTIFY
Contact: <sip:alice@vmail.example.com>
A12: Subscriber -> Notifier
(Un-subscribe after "alice" logs out.)
SUBSCRIBE sip:alice@vmail.example.com SIP/2.0
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 19:35:06 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 17 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Event: message-summary
Expires: 0
Accept: application/simple-message-summary
Content-Length: 0
A13: Notifier -> Subscriber
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 19:35:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 17 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Expires: 0
Content-Length: 0
A14: Notifier -> Subscriber
(immediate synchronization of current state,which the subscriber can now ignore)
NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 19:35:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 56 NOTIFY
Contact: <sip:alice@vmail.example.com>
Event: message-summary
Subscription-State: terminated;reason=timeout
Content-Type: application/simple-message-summary
Content-Length: 99
Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 4/8 (1/2)
A15: Subscriber -> Notifier
SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 19:35:08 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 56 NOTIFY
Event: message-summary
Content-Length: 0
MESSAGE
MESSAGE:通过在其请求体中承载即时消息内容实现即时消息。
SIP client(sender) SIP client (Instant Inbox)
| |
| MESSAGE |
|----------------------->|
| 202 Accepted/200 OK |
|<-----------------------|
| |
例:
请求:
MESSAGE sip:user@inbox.example.com SIP/2.0
Via: SIP/2.0/TCP server.example.com;branch=z9hG4bKnk
From: <sip:resource@example.com>;tag=ffd2
To: <sip:user@example.com>;tag=xfg9
Call-ID: 2010@sender.example.com
Max-Forwards: 70
CSeq: 1 MESSAGE
Content-Type: text/plain
Content-Length: 18
Watson, come here.
响应:
SIP/2.0 202 Accepted
Via: SIP/2.0/TCP server.example.com;branch=z9hG4bKnk
From: <sip:resource@example.com>;tag=ffd2
To: <sip:user@example.com>;tag=xfg9
Call-ID: 2010@sender.example.com
Max-Forwards: 70
CSeq: 1 MESSAGE
Content-Length: 0
1.1.1. ALLOCATE
例:
In the following example, the gateway gw58.ca.pstn-gws.example binds, for 180 seconds, the TSGN +13235554258 to the Contact addresses in the request.
ALLOCATE sip:gw58.ca.pstn-gws.example SIP/2.0
Via: SIP/2.0/UDP nj.mobility-manager.example:5060
From: <sip:nwelem47.nj.mobility-manager.example>
To: <sip:gw58.ca.pstn-gws.example>
Call-ID: 1234567890@nwelem47.nj.mobility-manager.example
CSeq: 1 ALLOCATE
Max-Forwards: 70
Contact: "Alice at work" <sip:alice@office.work.com>; expires=180
Contact: "Alice in the lab" <sip:alice@lab.work.com>; expires=180
Allocate-For: <tel:+18475550000>
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP nj.mobility-manager.example:5060
From: <sip:nwelem47.nj.mobility-manager.example>
To: <sip:gw58.ca.pstn-gws.example>
Call-ID: 1234567890@nwelem47.nj.mobility-manager.example
CSeq: 1 ALLOCATE
Contact: <tel:+13235554258>; expires=180
Content-Length: 0
1.1.2. CANCLE
cancels a pending INVITE.
Case 1: CANCEL and 200 OK DO NOT "cross each other on the wire":
UAC
INVITE------->
<----------- 100 Trying
<----------- 180 Ringing
CANCEL ------>
<----------- 487 Request Terminated
ACK---------->
<------------ 200 OK (CSeq: xxx CANCEL)
As far as I can see, no need to send BYE here. (Last 4 exchanges are
as per the behavior of a UAS when it gets a CANCEL and has NOT send a
final response -- "CANCEL")
Case 2: CANCEL and 200 OK DO "cross each other on the wire":
UAC
INVITE------->
<----------- 100 Trying
<----------- 180 Ringing
CANCEL----->
<------ 200 OK (CSeq: xxx INVITE)
ACK --------->
BYE --------->
<------------- 200 OK (CSeq: xxx BYE)
Clearly, here, the CANCEL has no effect on the state machine of the
UAS since it has already sent out the final response. The UAC, on
receiving the 200 OK notes that this is OK'ing an INVITE, thus the
CANCEL it send out has no meaning. It ACKs the 200 OK and THEN sends
1.1.1. INFO
INFO方法 并不是用来改变SIP呼叫的状态,或会议 SIP的初始化状态参数。它仅是用于发送通常与会议有关的应用层的可选信息。
The INFO method is used for transferring information during a session, such as user activity.
For example:
Windows Messenger 5.0 uses the INFO method to inform the called user that Bob, the calling user, is typing on the keyboard. As a result, in the conversation UI, the called user sees a dialog, “bob is typing.”
INFO sip:10.0.220.41:14223 SIP/2.0
Via: SIP/2.0/UDP 10.10.1.11:5060
From: <sip:incoming@10.10.1.11>
To:<sip:client1@10.0.220.35>;tag=4046504f-32bd-43a7-bcb8-e9703aeec414
Call-ID: static-call-id@10.10.1.11
CSeq: 2 INFO
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.1.11:5060
From: <sip:incoming@10.10.1.11>
To:<sip:client1@10.0.220.35>;tag=4046504f-32bd-43a7-bcb8-e9703aeec414
Call-ID: static-call-id@10.10.1.11
CSeq: 2 INFO
User-Agent: Windows RTC/1.0
Allow: INVITE, BYE, OPTIONS, MESSAGE, ACK, CANCEL,NOTIFY, SUBSCRIBE, INFO
Content-Length: 14
bob is typing.
1.1.2. UPDATE/ PRACK
UPDATE:允许客户更新一个会话的参数而不影响该会话的当前状态;
PRACK:与ACK作用相同,但是用于临时响应。
例:
Alice Controller Bob
|(1) INVITE offer1 | |
|no media | |
|<----------------------| |
|(2) 200 answer1 | |
|no media | |
|---------------------->| |
|(3) ACK | |
|<----------------------| |
| |(4) INVITE no SDP |
| |---------------------->|
| |(5) 180 Ringing offer2 |
| |<----------------------|
|(6) UPDATE offer2' | |
| and ringback tone | |
|<----------------------| |
|(7) 200 answer2' | |
|---------------------->|(8) PRACK answer2 |
| |---------------------->|
| |(9) 200 OK (PRACK) |
| |<----------------------|
| | |
UPDATE sip:alice@a.example.com SIP/2.0
...
Reason: SIP;cause=180
Content-Type: multipart/mixed;boundary=gorilla
Content-Length: xxx
--gorilla
Content-Type: audio/tone-info+xml
Content-Disposition: render;handling=optional
Content-Length: yyy
(tone description file from the previous example)
--gorilla
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: zzz
(SDP contents of offer 2')
--gorilla
In the following flow, Alice receives an invitiation from a Third-Party Call Control(3pcc) controller. Alice may have been invited due to a click-to-dial service or some type of scheduled callback or reminder service. Alice answers immediately, but when the Controller invites Bob, he does not answer immediately. It is desirable for Alice to receive an indication that her call to Bob is ringing. The Controller could negotiate a session with Alice to just provide a stream of RTP media to provide ringback, but this requires that the Controller be able to provide such media and deal with all the security and middlebox traversal issues associated with RTP for a simple tone which is transient in nature. Worse yet, in this flow Bob is willing to negotiate session details before answer which ordinarily would minimize or eliminate clipping of Bob's initial "Hello". However, if the Controller negotiates a session with Alice to send early media, the Controller must setup a session with Bob and discard or relay Bob's media which is likely to introduce clipping.
Instead, the Controller sends an UPDATE request to Alice which contains the tone description file from the previous example. (It could have been a more traditional audio file instead, such as a wave file.) The UPDATE also contains a Reason header which provides additional information about the cause of the UPDATE request. Alice's UA plays the tone until media is received from Bob. After the successful offer/answer exchange with Alice, the controller sends a PRACK request to acknowledge Bob's reliable 180 response.
1.1.1. Callback
有两个人, 张三中在中国,李四美在美国。张三中要给李四美打电话。张三中一拨号,李四美的电话铃就响了。李四美说,挂了吧,我给你打回去,你打过来太贵了。回拨原理就这么简单:李四美知道张三中要给他打电话,就立即给张三中拨回去,因为从中国打国际长途太贵了!
您拨打接入电话号码,系统响铃三次后会自动挂断,请您放下电话机。拨打这个号码是不需要付钱的,因为只响三声,并没有接通。几秒种后您的电话铃会响起。系统已经识别了您所拨打的电话号码,从美国打电话给您,传递给您美国的拨号音,再提示您输入对方电话号码,几秒钟后您的国际长途就接通了。您在中国打国际长途电话,但其实是在使用美国国内的电话系统。从技术上讲,您是接电话,不是打电话。电话不从中国电信系统打出来,而是从美国打出来,美国的系统是主叫方,你拿起电话接听,是被叫方。 美国打往中国的国际长途非常便宜,最便宜的每分钟可以低到1.5美分左右,人民币每分钟0.15元左右。
1.1.2. 同域呼叫
1.1.1. 不同域呼叫
1.1.1. Parallel Forking
1.1.1. Sequential Forking
1.1.1. Loop detection
A proxy can optionally check for loops by employing a special loop detection algorithm. The algorithm affects the way the proxy builds the Via-branch field and mandates the proxy to do certain validations of the Via list in incoming requests.
1.1.1. Transaction
在Client、Server的消息交互过程中,从Client发送请求消息开始,到接收到该请求消息的最终响应,属于同一个Transaction。
UAC发送INVITE消息后,可能收到多个1**消息,都属于临时响应,Transaction没有结束,只有接收到2**,3**,4**,5**,6**消息后该Transaction才结束。
1.1.1.1. Client Transaction
1.1.1.1. Server Transaction