跳到主要内容

11. 示例消息流

下一节展示呼叫流程和消息示例。这些流程和描述是非规范性的。请注意, 在这些示例中, 组内 UA 发送的所有 INVITE 都会以共享 AOR (本例中为 sip:[email protected]) 作为 From, 而所有发送给组的 INVITE 都会以共享 AOR 作为 Request-URI。其他任何请求都不适用于此功能, 将按常规 SIP 机制处理。

请注意, 前 12 个示例假定外观代理了解对话状态事件。第 11.13 节的示例展示了并非如此的情形, 此时外观代理会发起对共享 AOR 用户的订阅。其他任何呼叫流程示例都可以采用这种运行模式, 因为它同样有效。

11.1. 注册与订阅​

Bob 和 Alice 处于由共享外观 AOR sip:[email protected] 标识的共享外观组中。Bob 使用联系地址 sip:[email protected] 执行 REGISTER。Alice 使用联系地址 sip:[email protected] 执行 REGISTER。

Alice 和 Bob 的 UA 订阅外观 AOR 的对话包, 并向外观代理发布对话状态。注册服务器、外观代理、Alice 和 Bob 之间的消息交换如下所示。下面的呼叫流程示例未展示订阅、发布和通知的认证过程。应当注意, 出于安全考虑, 所有发布和订阅在被接受之前都必须经过授权。

另请注意, 注册和订阅都必须由 Alice 按照注册服务器或外观代理返回的过期时间间隔进行刷新。

Registrar     Appearance Agent          Alice             Bob
| | | |
| | | |
|<--------------------------- REGISTER F1<| |
| | | |
|>F2 200 OK ----------------------------->| |
| | | |
| |<----- SUBSCRIBE F3<| |
| | | |
| |>F4 200 OK -------->| |
| | | |
| |>F5 NOTIFY -------->| |
| | | |
| |<-------- 200 OK F6<| |
| | | |
|<-------------------------------------------- REGISTER F7<|
| | | |
|>F8 200 OK ---------------------------------------------->|
| | | |
| |<---------------------- SUBSCRIBE F9<|
| | | |
| |>F10 200 OK ------------------------>|
| | | |
| |>F11 NOTIFY ------------------------>|
| | | |
| |<------------------------ 200 OK F12<|
| | | |

图 1. 注册与订阅示例

F1-F2: Alice 使用联系地址 <sip:[email protected]> 注册 AOR

F1 Alice ----> Registrar

REGISTER sip:registrar.example.com SIP/2.0
Via: SIP/2.0/UDP ua1.example.com;branch=z9hG4bK527b54da8ACC7B09
From: <sip:[email protected]>;tag=CDF9A668-909E2BDD
To: <sip:[email protected]>
CSeq: 2 REGISTER
Call-ID: d3281184-518783de-cc23d6bb
Contact: <sip:[email protected]>
Max-Forwards: 70
Expires: 3600
Content-Length: 0

F2 Registrar ----> Alice

SIP/2.0 200 OK
Via: SIP/2.0/UDP ua1.example.com;branch=z9hG4bK527b54da8ACC7B09
CSeq: 2 REGISTER
Call-ID: d3281184-518783de-cc23d6bb
From: <sip:[email protected]>;tag=CDF9A668-909E2BDD
To: <sip:[email protected]>;tag=1664573879820199
Contact: <sip:[email protected]>;expires=3600
Content-Length: 0

F3 to F6: Alice 还订阅与外观 AOR 关联的事件。外观代理向 Alice 通知相关状态。

F3 Alice ----> Appearance Agent

SUBSCRIBE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua1.example.com;branch=z9hG4bKf10fac97E7A76D6A
From: <sip:[email protected]>;tag=925A3CAD-CEBB276E
To: <sip:[email protected]>
CSeq: 91 SUBSCRIBE
Call-ID: ef4704d9-bb68aa0b-474c9d94
Contact: <sip:[email protected]>
Event: dialog;shared
Accept: application/dialog-info+xml
Max-Forwards: 70
Expires: 3700
Content-Length: 0

F4 Appearance Agent ----> Alice

SIP/2.0 200 OK
Via: SIP/2.0/UDP ua1.example.com;branch=z9hG4bKf10fac97E7A76D6A
CSeq: 91 SUBSCRIBE
Call-ID: ef4704d9-bb68aa0b-474c9d94
From: <sip:[email protected]>;tag=925A3CAD-CEBB276E
To: <sip:[email protected]>;tag=1636248422222257
Allow-Events: dialog
Expires: 3700
Contact: <sip:appearanceagent.example.com>
Content-Length: 0

F5 Appearance Agent ----> Alice

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=1636248422222257
To: <sip:[email protected]>;tag=925A3CAD-CEBB276E
Call-ID: ef4704d9-bb68aa0b-474c9d94
CSeq: 232 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com;branch=z9hG4bK1846
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=3000
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
version="40"
state="full"
entity="sip:[email protected]">
</dialog-info>

F6 Alice ----> Appearance Agent

SIP/2.0 200 OK
Via: SIP/2.0/UDP appearanceagent.example.com;branch=z9hG4bK1846
From: <sip:[email protected]>;tag=1636248422222257
To: <sip:[email protected]>;tag=925A3CAD-CEBB276E
CSeq: 232 NOTIFY
Call-ID: ef4704d9-bb68aa0b-474c9d94
Contact: <sip:[email protected]>
Content-Length: 0

F7 Bob ----> Registrar

REGISTER sip:registrar.example.com SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4b53b54d87B
From: <sip:[email protected]>;tag=34831131
To: <sip:[email protected]>
CSeq: 72 REGISTER
Call-ID: 139490230230249348
Contact: <sip:[email protected]>
Max-Forwards: 70
Expires: 3600
Content-Length: 0

F8 Registrar ----> Bob

SIP/2.0 200 OK
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4b53b54d87B
From: <sip:[email protected]>;tag=34831131
To: <sip:[email protected]>;tag=fkwlwqi1
CSeq: 72 REGISTER
Call-ID: 139490230230249348
Contact: <sip:[email protected]>;expires=3200
Contact: <sip:[email protected]>;expires=3600
Content-Length: 0

11.2. 来电的外观选择​

在下面的呼叫流程中, Bob 和 Alice 处于同一个共享外观组中。Carol 向共享外观组 AOR 发起呼叫。外观代理向 Alice 和 Bob 发送 NOTIFY, 告知他们该呼叫正在使用哪个外观。Alice 和 Bob 的设备都会收到来电提示。Bob 应答该呼叫。

请注意, Alice 和 Bob 可能都会应答该呼叫并向 Carol 发送 200 (OK) 响应。如何解决这种情况由 Carol 决定。通常, Carol 会向两个 200 OK 都发送 ACK, 但发送 BYE 来终止其中一个对话。因此, Alice 或 Bob 中的一方会收到 BYE 并发布其对话已结束。然而, 如果 Carol 同时应答 Alice 和 Bob 并保持两个对话都处于活动状态, 那么外观代理就需要通过将 Alice 或 Bob 的对话移动到不同的外观来解决该情况。

下面呼叫流程中的所有 NOTIFY 消息都携带对话事件, 为简便起见仅提及对话状态。为简洁起见, 下面未展示某些消息的细节。请注意, F2 - F5 与 F7 - F8 的顺序可能相反。

           Forking     Appearance
Carol      Proxy         Agent         Alice      Bob
|            |             |             |         |
|>F1 INVITE >|             |             |         |
|            |< - - - - - >|             |         |
|            |             |>F2 NOTIFY ----------->|
|            |             |             |         |
|            |             |<F3 200 OK -----------<|
|            |             |             |         |
|            |             |>F4 NOTIFY ->|         |
|            |             |             |         |
|            |             |<-200 OK F5-<|         |
|<- 100 F6 -<|             |             |         |
|            |>F7 INVITE (appearance=1) ---------->|
|            |             |             |         |
|            |>F8 INVITE (appearance=1) >|         |
|            |             |             |         |
|            |<-------------------- Ringing 180 F9<|
|< 180 F10 -<|             |             |         |
|            |<--------- 180 Ringing F11<|         |
|< 180 F12 -<|             |             |         |
|            |             |             |         |
|            |<------------------------ 200 OK F13<|
|< 200 F14 -<|             |             |         |
|            |             |             |         |
|            |>F15 CANCEL -------------->|         |
|            |             |             |         |
|            |<-------------- 200 OK F16<|         |
|            |             |             |         |
|            |<Request Cancelled 487 F17<|         |
|            |             |             |         |
|            |>F18 ACK ----------------->|         |
|>F19 ACK -->|             |             |         |
|            |>F20 ACK --------------------------->|
|            |             |             |         |
|<=============Both way RTP established===========>|
|            |             |             |         |
|            |< - - - - - >|             |         |
|            |             |             |         |
|            |             |>F21 NOTIFY >|         |
|            |             |             |         |
|            |             |<- 200 F22 -<|         |
|            |             |             |         |
|            |             |>F23 NOTIFY ---------->|
|            |             |             |         |
|            |             |<F24 200 OK ----------<|
|            |             |                       |

图 2. 来电外观选择示例

F4 Appearance Agent ----> Alice

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=151702541050937
To: <sip:[email protected]>;tag=18433323-C3D237CE
Call-ID: 1e361d2f-a9f51109-bafe31d4
CSeq: 12 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com;branch=z9hG4bK1403
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=2800
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="13"
state="partial"
entity="sip:[email protected]">
<dialog id="2a7294823093f5274e3fd2ec54a2d76c"
call-id="14-1541707345"
remote-tag="44BAD75D-E3128D42"
direction="recipient">
<sa:appearance>1</sa:appearance>
<state>trying</state>
<remote>
<identity>sip:[email protected]</identity>
</remote>
</dialog>
</dialog-info>

F7 Proxy ----> Bob

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua3.example.com;branch=z9hG4bK4324ea
Via: SIP/2.0/UDP proxy.example.com;branch=z9hG4bK38432ji
From: <sip:[email protected]>;tag=44BAD75D-E3128D42
To: <sip:[email protected]>
CSeq: 106 INVITE
Call-ID: 14-1541707345
Contact: <sip:[email protected]>
Max-Forwards: 69
Alert-Info: <urn:alert:service:normal>;appearance=1
Content-Type: application/sdp
Content-Length: ...
v=0
o=- 1102980499 1102980499 IN IP4 ua3.example.com
s=
c=IN IP4 ua3.example.com
t=0 0
m=audio 2238 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

F21 Appearance Agent ----> Alice

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=151702541050937
To: <sip:[email protected]>;tag=18433323-C3D237CE
Call-ID: 1e361d2f-a9f51109-bafe31d4
CSeq: 13 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com;branch=z9hG4bK4164F03j
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=2500
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="17"
state="partial"
entity="sip:[email protected]">
<dialog id="2a7294823093f5274e3fd2ec54a2d76c"
call-id="14-1541707345"
remote-tag="44BAD75D-E3128D42"
local-tag="7349dsfjkFD03s"
direction="recipient">
<sa:appearance>1</sa:appearance>
<state>confirmed</state>
<local>
<target>sip:[email protected]</target>
</local>
<remote>
<identity>sip:[email protected]</identity>
</remote>
</dialog>
</dialog-info>

11.3. 未占用外观的出站呼叫​

在此场景中, Bob 的 UA 在未先选择/占用外观编号的情况下发起呼叫。在 Bob 发送 INVITE 之后, 外观代理为其分配一个外观编号, 并通知 Alice 和 Bob。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |               |              |                  |
|              |<------------------------------------- INVITE F1<|
|              |               |              |                  |
|              |>F2 100 Trying --------------------------------->|
|<-- INVITE F3<|               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<-- NOTIFY F4<|                  |
|              |               |              |                  |
|              |               |>F5 200 OK -->|                  |
|              |               |              |------- NOTIFY F6>|
|              |               |              |                  |
|              |               |              |<F7 200 OK ------<|
|>F8 180  ---->|               |              |                  |
|              |>F9 180 Ringing -------------------------------->|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F10<|                  |
|              |               |              |                  |
|              |               |>F11 200 OK ->|                  |
|              |               |              |------ NOTIFY F12>|
|              |               |              |                  |
|              |               |              |<F13 200 OK -----<|
|>F14 200 OK ->|               |              |                  |
|              |>F15 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F16<|
|<---- ACK F17<|               |              |                  |
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F18<|                  |
|              |               |              |                  |
|              |               |>F19 200 OK ->|                  |
|              |               |              |------ NOTIFY F20>|
|              |               |              |                  |
|              |               |              |<F21 200 OK -----<|
|              |               |              |                  |

图 3. 未占用外观的出站呼叫示例

F1 Bob ----> Proxy

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK98c87c52123A08BF
From: <sip:[email protected]>;tag=15A3DE7C-9283203B
To: <sip:[email protected]>
CSeq: 1 INVITE
Call-ID: f3b3cbd0-a2c5775e-5df9f8d5
Contact: <sip:[email protected]>
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 223
v=0
o=- 1102980499 1102980499 IN IP4 ua2.example.com
s=IP SIP UA
c=IN IP4 ua2.example.com
t=0 0
a=sendrecv
m=audio 2236 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

F4 Appearance Agent ----> Alice

NOTIFY sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP appearanceagent.example.com;branch=z9hG4bK81d84f62
From: <sip:[email protected]>;tag=1636248422222257
To: <sip:[email protected]>;tag=925A3CAD-CEBB276E
Call-ID: ef4704d9-bb68aa0b-474c9d94
CSeq: 233 NOTIFY
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=2200
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="27"
state="partial"
entity="sip:[email protected]">
<dialog id="fa02538339df3ce597f9e3e3699e28fc"
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
local-tag="15A3DE7C-9283203B" direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
</dialog>
</dialog-info>

F6 Appearance Agent ----> Bob

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=497585728578386
To: <sip:[email protected]>;tag=633618CF-B9C2EDA4
Call-ID: a7d559db-d6d7dcad-311c9e3a
CSeq: 7 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com
;branch=z9hG4bK1711759878512309
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=2000
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="78"
state="partial"
entity="sip:[email protected]">
<dialog id="02538339hfgdf3ce597f9e3egkl3699e28fc"
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
local-tag="15A3DE7C-9283203B" direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
</dialog>
</dialog-info>

11.4. 占用外观的出站呼叫​

在此场景中, Bob 的 UA 在发送 INVITE 之前先发出一个状态为 (trying) 的对话事件 PUBLISH, 以选择/占用外观编号。在收到外观代理确认该外观编号的 200 (OK) 之后, Bob 的 UA 向 Carol 发送 INVITE 并建立会话。为简洁起见, 消息流中未包含某些消息的细节。Bob 的 UA 尽可能把 F7 中能够预先确定的对话信息都包含进去。在这种情况下, 至少包含 Contact URI, 以便外观代理能够将 INVITE 与 PUBLISH 关联起来。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |               |              |<----- PUBLISH F1<|
|              |               |              |                  |
|              |               |              |>F2 200 OK ------>|
|              |               |              |                  |
|              |               |<-- NOTIFY F3<|                  |
|              |               |              |                  |
|              |               |>F4 200 OK -->|                  |
|              |               |              |------- NOTIFY F5>|
|              |               |              |                  |
|              |               |              |<F6 200 OK ------<|
|              |               |              |                  |
|              |<------------------------------------- INVITE F7<|
|              |               |              |                  |
|              |>F8 100 Trying --------------------------------->|
|<-- INVITE F9<|               |              |                  |
|              |               |              |<---- PUBLISH F10<|
|              |               |              |                  |
|              |               |              |>F11 200 OK ----->|
|              |               |              |                  |
|>F12 180  --->|               |              |                  |
|              |>F13 180 Ringing ------------------------------->|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F14<|                  |
|              |               |              |                  |
|              |               |>F15 200 OK ->|                  |
|              |               |              |------ NOTIFY F16>|
|              |               |              |                  |
|              |               |              |<F17 200 OK -----<|
|>F18 200 OK ->|               |              |                  |
|              |>F19 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F20<|
|<---- ACK F21<|               |              |                  |
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F22<|                  |
|              |               |              |                  |
|              |               |>F23 200 OK ->|                  |
|              |               |              |------ NOTIFY F24>|
|              |               |              |                  |
|              |               |              |<F25 200 OK -----<|
|              |               |              |                  |

图 4. 占用外观的出站呼叫示例

F1 to F4: Bob 在其 UA 上使用 Help Desk 的共享外观发起出站呼叫 (例如, 他摘机)。在发送出站 INVITE 请求之前, Bob 向外观代理发布以预留外观编号 1。外观代理通过发送 NOTIFY 向 Alice (以及包括 Bob 在内的所有其他 UA) 通知该事件。

F1 Bob ----> Appearance Agent

PUBLISH sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK61314d6446383E79
From: <sip:[email protected]>;tag=44150CC6-A7B7919D
To: <sip:[email protected]>
CSeq: 7 PUBLISH
Call-ID: 44fwF144-F12893K38424
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="6"
state="full"
entity="sip:[email protected]">
<dialog id="id3d4f9c83" direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
</dialog>
</dialog-info>

F2 Appearance Agent ----> Bob

SIP/2.0 200 OK
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK61314d6446383E79
From: <sip:[email protected]>;tag=44150CC6-A7B7919D
To: <sip:[email protected]>
CSeq: 7 PUBLISH
Call-ID: 44fwF144-F12893K38424
Contact: <sip:[email protected]>
Event: dialog;shared
SIP-Etag: 482943245
Allow-Events: dialog
Expires: 60
Content-Length: 0

F7 Bob ---> Proxy

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK342122
Max-Forwards: 70
From: <sip:[email protected]>;tag=15A3DE7C-9283203B
To: <sip:[email protected]>
Call-ID: f3b3cbd0-a2c5775e-5df9f8d5
CSeq: 31 INVITE
Contact: <sip:[email protected]>
Content-Type: application/sdp
Content-Length: ...

(未显示 SDP)

F10 Bob ----> Appearance Agent

PUBLISH sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK6d644638E7
From: <sip:[email protected]>;tag=0CCf6-A7FdsB79D
To: <sip:[email protected]>
CSeq: 437 PUBLISH
Call-ID: fwF14d4-F1FFF2F2893K38424
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="6"
state="full"
entity="sip:[email protected]">
<dialog id="id3d4f9c83"
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
local-tag="15A3DE7C-9283203B"
direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
<remote>
<identity uri="sip:[email protected]">
</identity>
</remote>
</dialog>
</dialog-info>

11.5. 不使用外观编号的出站呼叫​

在此场景中, Bob 的 UA 发出一个状态为 (trying) 的对话事件 PUBLISH, 表明他不希望为该对话使用外观编号。该 PUBLISH 不包含 appearance 元素, 但包含 'shared' Event 头字段参数。因此, 外观代理知道该 UA 不希望为此呼叫使用外观编号。如果外观代理不允许这样做, 它会以 400 (Bad Request) 响应拒绝该 PUBLISH, 而 UA 就会知道需要重新 PUBLISH 以选择/占用一个外观编号。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |               |              |<----- PUBLISH F1<|
|              |               |              |                  |
|              |               |              |>F2 200 OK ------>|
|              |               |              |                  |
|              |               |<-- NOTIFY F3<|                  |
|              |               |              |                  |
|              |               |>F4 200 OK -->|                  |
|              |               |              |------- NOTIFY F5>|
|              |               |              |                  |
|              |               |              |<F6 200 OK ------<|
|              |               |              |                  |
|              |<------------------------------------- INVITE F7<|
|              |               |              |                  |
|              |>F8 100 Trying --------------------------------->|
|<-- INVITE F9<|               |              |                  |
|              |               |              |<---- PUBLISH F10<|
|              |               |              |                  |
|              |               |              |>F11 200 OK ----->|
|              |               |              |                  |
|>F12 180  --->|               |              |                  |
|              |>F13 180 Ringing ------------------------------->|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F14<|                  |
|              |               |              |                  |
|              |               |>F15 200 OK ->|                  |
|              |               |              |------ NOTIFY F16>|
|              |               |              |                  |
|              |               |              |<F17 200 OK -----<|
|>F18 200 OK ->|               |              |                  |
|              |>F19 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F20<|
|<---- ACK F21<|               |              |                  |
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F22<|                  |
|              |               |              |                  |
|              |               |>F23 200 OK ->|                  |
|              |               |              |------ NOTIFY F24>|
|              |               |              |                  |
|              |               |              |<F25 200 OK -----<|
|              |               |              |                  |

图 5. 不使用外观编号的出站呼叫示例

F1 Bob ----> Appearance Agent

PUBLISH sip:appearanceagent.example.com SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bK61314d6446383E79
From: <sip:[email protected]>;tag=4415df82k39sf
To: <sip:[email protected]>
CSeq: 7 PUBLISH
Call-ID: 44fwF144-F12893K38424
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="6"
state="full"
entity="sip:[email protected]">
<dialog id="id3d4f9c83" direction="initiator">
<sa:exclusive>false</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
</dialog>
</dialog-info>

请注意, F7 与前一个示例相同。

11.6. 外观释放​

Bob 和 Carol 处于一个对话中, 例如按第 11.3 节所述创建。Carol 向 Bob 发送 BYE 以终止该对话, 外观代理释放所用的外观编号, 并向共享组中的 UA 发送通知。

Carol        Proxy           Alice     Appearance Agent         Bob
| | | | |
| | | | |
|<================= Both way RTP established ===================>|
| | | | |
|>F22 BYE ---->| | | |
| |>F23 BYE --------------------------------------->|
| | | | |
| |<------------------------------------ 200 OK F24<|
|<--200 OK F25<| | | |
| |< - - - - - - - - - - - - - ->| |
| | | | |
| | |<- NOTIFY F26<| |
| | | | |
| | |>F27 200 OK ->| |
| | | |------ NOTIFY F28>|
| | | | |
| | | |<F29 200 OK -----<|

图 6. 外观释放示例

F28 Appearance Agent ----> Bob

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=497585728578386
To: <sip:[email protected]>
Call-ID: a7d559db-d6d7dcad-311c9e3a
CSeq: 7 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com
;branch=z9hG4bK759878512309
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=1800
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="27"
state="partial"
entity="sip:[email protected]">
<dialog id="fa02538339df3ce597f9e3e3699e28fc"
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
local-tag="15A3DE7C-9283203B"
remote-tag="65a98f7c-1dd2-11b2-88c6-b0316298f7c"
direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>terminated</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
</dialog>
</dialog-info>

11.7. 外观接听​

在此场景中, Bob 与 Carol 已按图 1 或图 2 的呼叫流程建立了对话。随后 Bob 将 Carol 置于保持状态。Alice 收到此通知并在 Alice 的 UI 上呈现。Alice 随后接听该保持中的呼叫, 并与 Carol 建立会话。最后, Carol 挂断。Alice 必须发送 PUBLISH F32 以表明 INVITE F38 将是接听 Carol 与 Bob 之间对话的一次尝试, 因此可以使用相同的外观编号。此示例还展示了使用安全 SIP (sips)。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |<------------------------------(hold) INVITE F22<|
|<- INVITE F23<|               |              |                  |
|              |               |              |                  |
|>F24 200 OK ->|               |              |                  |
|              |>F25 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F26<|
|<---- ACK F27<|               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F28<|                  |
|              |               |              |                  |
|              |               |>F29 200 OK ->|                  |
|              |               |              |>F30 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F31<|
|              |               |              |                  |
|              |  Alice decides to pick up the call              |
|              |               |              |                  |
|              |               |>F32 PUBLISH->|                  |
|              |               |              |                  |
|              |               |<- 200 OK F33<|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F34<|                  |
|              |               |              |                  |
|              |               |>F35 200 OK ->|                  |
|              |               |              |>F36 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F37<|
|              |<-- INVITE F38<|              |                  |
|<- INVITE F39<|(w/ Replaces)  |              |                  |
|( w/ Replaces)|               |              |                  |
|>F40 200 OK ->|               |              |                  |
|              |>F41 200 OK -->|              |                  |
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |              |>F42 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F43<|
|              |               |<- NOTIFY F44<|                  |
|              |               |              |                  |
|              |               |>F45 200 OK ->|                  |
|              |               |              |                  |
|              |<----- ACK F46<|              |                  |
|<---- ACK F47<|               |              |                  |
|              |               |              |                  |
|<= Both way RTP established =>|              |                  |
|              |               |              |                  |
|>F48 BYE ---->|               |              |                  |
|              |>F49 BYE --------------------------------------->|
|              |               |              |                  |
|              |<------------------------------------ OK 200 F50<|
|<- 200 OK F51<|               |              |                  |
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F52<|                  |
|              |               |              |                  |
|              |               |>F53 200 OK ->|                  |
|              |               |              |                  |
|              |               |              |>F54 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F55<|

图 7. 外观接听示例

F28 Appearance ----> Alice

NOTIFY sips:[email protected] SIP/2.0
From: <sips:[email protected]>;tag=151702541050937
To: <sips:[email protected]>;tag=18433323-C3D237CE
Call-ID: 1e361d2f-a9f51109-bafe31d4
CSeq: 12 NOTIFY
Via: SIP/2.0/TLS appearanceagent.example.com
;branch=z9hG4bK1403
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=1800
Contact: <sips:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="partial"
entity="sips:[email protected]">
<dialog id="id3d4f9c83"
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
local-tag="15A3DE7C-9283203B"
remote-tag="65a98f7c-1dd2-11b2-88c6-b0316298f7c"
direction="initiator">
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<state>active</state>
<local>
<target uri="sips:[email protected]">
<param pname="+sip.rendering" pval="no"/>
</target>
</local>
<remote>
<identity>sips:[email protected]</identity>
<target uri="sips:[email protected]" />
</remote>
</dialog>
</dialog-info>

F32 Alice ----> Appearance Agent

PUBLISH sips:[email protected] SIP/2.0
Via: SIP/2.0/TLS ua2.example.com;branch=z9hG4bKa5d6cf61F5FBC05A
From: <sips:[email protected]>;tag=44150CC6-A7B7919D
To: <sips:[email protected]>;tag=428765950880801
CSeq: 11 PUBLISH
Call-ID: 87837Fkw87asfds
Contact: <sips:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="full"
entity="sips:[email protected]">
<dialog id="id3d4f9c83"
call-id="3d57cd17-47deb849-dca8b6c6"
local-tag="8C4183CB-BCEAB710" >
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<sa:replaced-dialog
call-id="f3b3cbd0-a2c5775e-5df9f8d5"
from-tag="15A3DE7C-9283203B"
to-tag="65a98f7c-1dd2-11b2-88c6-b03162323164+65a98f7c" />
<state>trying</state>
<local>
<target uri="sips:[email protected]">
<param pname="+sip.rendering" pval="yes"/>
</target>
</local>
<remote>
<target uri="sips:[email protected]" />
</remote>
</dialog>
</dialog-info>

F38 Alice ----> Proxy

INVITE sips:[email protected] SIP/2.0
Via: SIP/2.0/TLS ua1.example.com;branch=z9hG4bK4ea695b5B376A60C
From: <sips:[email protected]>;tag=8C4183CB-BCEAB710
To: <sips:[email protected]:5075>
CSeq: 1 INVITE
Call-ID: 3d57cd17-47deb849-dca8b6c6
Contact: <sips:[email protected]>
<all-one-line>
Replaces: f3b3cbd0-a2c5775e-5df9f8d5;to-tag=65a98f7c
-1dd2-11b2-88c6-b03162323164+65a98f7c;from-tag=15A3DE7C-9283203B
</all-one-line>
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 223
v=0
o=- 1102980497 1102980497 IN IP4 ua1.example.com
s=IP SIP UA
c=IN IP4 ua1.example.com
t=0 0
a=sendrecv
m=audio 2238 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

11.8. 组内 UA 之间的呼叫​

在此场景中, Bob 呼叫同样处于共享外观组中的 Alice。此对话只使用一个外观编号。此示例还展示了使用 'exclusive' 标签来表明组内其他 UA 不能加入或接管该对话。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |<--------------------  INVITE (to Alice's UA) F1<|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |              |                  |
|              |               |<-- NOTIFY F2<|                  |
|              |               |              |                  |
|              |               |>F3 200 OK -->|                  |
|              |               |              |>F4 NOTIFY ------>|
|              |               |              |                  |
|              |               |              |<------ 200 OK F5<|
|              |>F6 INVITE --->|              |                  |
|              | (appearance=1)|              |                  |
|              |               |              |                  |
|              |<------ 180 F7<|              |                  |
|              |               |              |                  |
|              |>F8 180  --------------------------------------->|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<-- NOTIFY F9<|                  |
|              |               |              |                  |
|              |               |>F10 200 OK ->|                  |
|              |               |              |>F11 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F12<|
|              |<-- 200 OK F13<|              |                  |
|              |               |              |                  |
|              |>F14 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F15<|
|              |               |              |                  |
|              |>F16 ACK ----->|              |                  |
|              |               |              |                  |
|              |               |<======= RTP established =======>|
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F17<|                  |
|              |               |              |                  |
|              |               |>F18 200 OK ->|                  |
|              |               |              |>F19 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F24<|
|              |               |              |                  |

图 8. 组内 UA 之间的呼叫示例

F19 Appearance Agent ----> Bob

NOTIFY sip:[email protected] SIP/2.0
From: <sip:[email protected]>;tag=497585728578386
To: <sip:[email protected]>;tag=633618CF-B9C2EDA4
Call-ID: a7d559db-d6d7dcad-311c9e3a
CSeq: 7 NOTIFY
Via: SIP/2.0/UDP appearanceagent.example.com
;branch=z9hG4bK1711759878512309
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Event: dialog;shared
Subscription-State: active;expires=1500
Contact: <sip:appearanceagent.example.com>
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="partial"
entity="sip:[email protected]">
<dialog id="3xdsd4f9c83"
call-id="b3cbd0-ad2c5775e-5df9f8d5"
local-tag="34322kdfr234f"
remote-tag="3153DE7C-928203B"
direction="initiator">
<sa:exclusive>true</sa:exclusive>
<sa:appearance>1</sa:appearance>
<state>confirmed</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
<remote>
<identity>sip:[email protected]</identity>
<target uri="sip:[email protected]" />
</remote>
</dialog>
<dialog id="4839589"
call-id="b3cbd0-ad2c5775e-5df9f8d5"
local-tag="3153DE7C-928203B"
remote-tag="34322kdfr234f"
direction="responder">
<sa:exclusive>true</sa:exclusive>
<sa:appearance>1</sa:appearance>
<state>confirmed</state>
<local>
<target uri="sip:[email protected]" />
</local>
<remote>
<identity>sip:[email protected]</identity>
<target uri="sip:[email protected]" />
</remote>
</dialog>
</dialog-info>

11.9. 带外观的咨询保持​

在此场景中, Bob 与 Carol 正在通话。Bob 通过将 Carol 置于保持并呼叫 Alice 来发起对 Alice 的咨询呼叫。Bob 的 UA 选择不为对 Alice 的呼叫使用外观编号, 因为它将该呼叫视为与 Carol 通话的一部分。他在 PUBLISH F32 中表明了这一点, 该 PUBLISH 包含 'shared' Event 头字段参数但不包含 <appearance> 元素。该 PUBLISH 在对 Alice 的 INVITE 之前发送, 以确保外观代理不会分配外观编号。最后, Bob 挂断与 Alice 的通话并恢复与 Carol 的通话。咨询呼叫的对话通知未展示, 因为它们未被使用。

请注意, 如果在 Bob 与 Alice 咨询期间 Carol 挂断, Bob 可以决定是否要为与 Alice 的通话复用与 Carol 通话时所用的外观编号。如果不复用, Bob 发布与 Carol 对话的终止, 外观代理将重新分配该外观。如果他想保留该外观, Bob 将发布与 Carol 对话的终止, 同时发布与 Alice 对话的外观。这将使 Bob 保留该外观编号, 直到他报告与 Alice 的对话已终止。

请注意, 如果 Bob 呼叫的是音乐保持服务器而不是 Alice, 以实现 [RFC7088] 所述的音乐保持服务, 呼叫流程也将类似。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |<------------------------------(hold) INVITE F22<|
|<- INVITE F23<|               |              |                  |
|              |               |              |                  |
|>F24 200 OK ->|               |              |                  |
|              |>F25 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F26<|
|<---- ACK F27<|               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F28<|                  |
|              |               |              |                  |
|              |               |>F29 200 OK ->|                  |
|              |               |              |>F30 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F31<|
|              |               |              |                  |
|              |  Bob makes a consultation call to Alice         |
|              |               |              |                  |
|              |               |              |<---- PUBLISH F32<|
|              |               |              |                  |
|              |               |              |>F33 200 OK ----->|
|              |               |              |                  |
|              |<------------------------------------ INVITE F34<|
|              |               |              |                  |
|              |>F35 INVITE -->|              |                  |
|              |               |              |                  |
|              |<-- 200 OK F36<|              |                  |
|              |               |              |                  |
|              |>F37 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F38<|
|              |               |              |                  |
|              |>F39 ACK ----->|              |                  |
|              |               |              |                  |
|              |               |<======= RTP established =======>|
|              |               |              |                  |
|              |            Bob hangs up with Alice              |
|              |               |              |                  |
|              |<--------------------------------------- BYE F40<|
|              |               |              |                  |
|              |>F41 BYE ----->|              |                  |
|              |               |              |                  |
|              |<-- 200 OK F42<|              |                  |
|              |               |              |                  |
|              |>F43 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<----------------------------(unhold) INVITE F44<|
|<- INVITE F45<|               |              |                  |
|              |               |              |                  |
|>F46 200 OK ->|               |              |                  |
|              |>F47 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F48<|
|<---- ACK F49<|               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F50<|                  |
|              |               |              |                  |
|              |               |>F51 200 OK ->|                  |
|              |               |              |>F52 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F53<|
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |

图 9. 带外观的咨询保持示例

F32 Bob ----> Appearance Agent

PUBLISH sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bKa5d6cf61F5FBC05A
From: <sip:[email protected]>;tag=44150CC6-A7B7919D
To: <sip:[email protected]>;tag=428765950880801
CSeq: 11 PUBLISH
Call-ID: 44fwF144-F12893K38424
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="full"
entity="sip:[email protected]">
<dialog id="id3d4f9c83"
call-id="b3cbd0-ad2c5775e-5df9f8d5"
local-tag="3153DE7C-928203B"
direction="initiator">
<sa:exclusive>true</sa:exclusive>
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
<remote>
<identity>sip:[email protected]</identity>
<target uri="sip:[email protected]" />
</remote>
</dialog>
</dialog-info>

11.10. 加入或桥接外观​

在此呼叫流程中, 由 Bob 应答的呼叫被 Alice 加入或 "桥接"。Alice 使用 Join 头字段请求此桥接。如果 Bob 不支持媒体混音, Bob 可以按 [RFC4579] 所述获取会议资源。

Carol    Forking Proxy Appearance Agent  Alice      Bob
  |            |             |             |         |
  |<=============Both way RTP established===========>|
  |            |             |             |         |
  |            |             |< PUBLISH F22|         |
  |            |             |             |         |
  |            |             |>F23 200 OK >|         |
  |            |             |             |         |
  |            |<---- INVITE (w/ Join) F24<|         |
  |            |             |             |         |
  |            |>F25 INVITE (w/Join)---------------->|
  |            |             |             |         |
  |            |<---- OK 200 Contact:Bob;isfocus F26<|
  |            |             |             |         |
  |            |< - - - - - >|             |         |
  |            |             |             |         |
  |            |             |>F27 NOTIFY >|         |
  |            |             |             |         |
  |            |             |< 200 OK F28<|         |
  |            |             |             |         |
  |            |             |>F29 NOTIFY ---------->|
  |            |             |             |         |
  |            |             |<F30 200 OK ----------<|
  |            |             |             |         |
  |            |>F31 200 OK Contact:B----->|         |
  |            |             |             |         |
  |            |<----------------- ACK F32<|         |
  |            |             |             |         |
  |            |>ACK F33---------------------------->|
  |            |             |             |         |
  |            |<-----INVITE Contact:Bob;isfocus F34<|
  |<-INVITE F35|             |             |         |
  |            |             |             |         |
  |>F26 200 -->|             |             |         |
  |            |>F37 200 OK ------------------------>|
  |            |             |             |         |
  |            |<--------------------------- ACK F38<|
  |<--- ACK F39|             |             |         |
  |            |             |             |<==RTP==>|
  |<=============Both way RTP established===========>|
  |            |             |             |         |
  |            |< - - - - - >|             |         |
  |            |             |             |         |
  |            |             |>F40 NOTIFY >|         |
  |            |             |             |         |
  |            |             |< 200 OK F41<|         |
  |            |             |             |         |
  |            |             |>F42 NOTIFY ---------->|
  |            |             |             |         |
  |            |             |<F43 200 OK ----------<|
  |            |             |             |         |

图 10. 加入或桥接外观示例

F22 Alice ----> Appearance Agent

PUBLISH sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bKa5d6cf61F5FBC05A
From: <sip:[email protected]>;tag=44150CC6-A7B7919D
To: <sip:[email protected]>;tag=428765950880801
CSeq: 11 PUBLISH
Call-ID: 87837Fkw87asfds
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="full"
entity="sip:[email protected]:5060">
<dialog id="id3d4f9c83"
call-id="dc95da63-60db1abd-d5a74b48"
local-tag="605AD957-1F6305C2" >
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<sa:joined-dialog
call-id="14-1541707345"
from-tag="44BAD75D-E3128D42"
to-tag="d3b06488-1dd1-11b2-88c5-b03162323164+d3e48f4c" />
<state>trying</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
<remote>
<target uri="sip:[email protected]" />
</remote>
</dialog>
</dialog-info>

F24 Alice ----> Proxy

INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua1.example.com;branch=z9hG4bKcc9d727c2C29BE31
From: <sip:[email protected]>;tag=605AD957-1F6305C2
To: <sip:[email protected]>
CSeq: 2 INVITE
Call-ID: dc95da63-60db1abd-d5a74b48
Contact: <sip:[email protected]>
<all-one-line>
Join: 14-1541707345;to-tag=d3b06488-1dd1-11b2-88c5
-b03162323164+d3e48f4c;from-tag=44BAD75D-E3128D42
</all-one-line>
Max-Forwards: 70
Content-Type: application/sdp
Content-Length: 223
v=0
o=- 1103061265 1103061265 IN IP4 ua1.example.com
s=IP SIP UA
c=IN IP4 ua1.example.com
t=0 0
a=sendrecv
m=audio 2236 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000

11.11. 分配过程中外观丢失​

Bob 通过 PUBLISH 预留一个外观, 向 Carol 发送 INVITE, 随后变得不可达。当他未能刷新对外观代理的发布时, 外观代理宣布该对话终止, 并通过 NOTIFY F14 和 F16 释放该外观。在向 Bob 重传 NOTIFY (未展示的消息 F17、F18 等) 之后, 订阅被终止。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |               |              |<----- PUBLISH F1<|
|              |               |              |                  |
|              |               |              |>F2 200 OK ------>|
|              |               |              |                  |
|              |               |<-- NOTIFY F3<|                  |
|              |               |              |                  |
|              |               |>F4 200 OK -->|                  |
|              |               |              |------- NOTIFY F5>|
|              |               |              |                  |
|              |               |              |<F6 200 OK ------<|
|              |               |              |                  |
|              |<------------------------------------- INVITE F7<|
|              |               |              |                  |
|              |>F8 100 Trying --------------------------------->|
|<-- INVITE F9<|               |              |                  |
|              |               |              |<---- PUBLISH F10<|
|              |               |              |                  |
|              |               |              |>F11 200 OK ----->|
|              |               |              |                  |
|>F12 180  --->|               |              |                  |
|              |>F13 180 Ringing ------------------------------->|
|              |               |              |                  |
|              |               |              | Bob goes offline |
|              |               |              |                  |
|              |               | Appearance selection times out  |
|              |               |              |                  |
|              |               |<- NOTIFY F14<|                  |
|              |               |              |                  |
|              |               |>F15 200 OK ->|                  |
|              |               |              |------ NOTIFY F16>|
|              |               |              |                  |
|              |               |   NOTIFY is retransmitted       |

图 11. 分配过程中外观丢失示例

11.12. 外观占用争用竞态条件​

Bob 和 Alice 同时通过发布尝试预留外观 2。外观代理通过发送 200 OK 将该外观分配给 Bob, 并通过发送 400 (Bad Request) 响应拒绝 Alice。在 NOTIFY F5 之后, Alice 得知 Bob 正在使用外观 2。Alice 随后通过发布尝试预留外观 3, 该请求随即被接受。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |               |              |<----- PUBLISH F1<|
|              |               |              |        (appearance=2)
|              |               |>F2 PUBLISH ->|                  |
|              |               |     (appearance=2)              |
|              |               |              |                  |
|              |               |              |>F3 200 OK ------>|
|              |               |<---- F4 400 <|                  |
|              |               |              |                  |
|              |               |<-- NOTIFY F5<|                  |
|              |               |              |                  |
|              |               |>F6 200 OK -->|                  |
|              |               |              |------- NOTIFY F7>|
|              |               |              |                  |
|              |               |              |<F8 200 OK ------<|
|              |               |              |                  |
|              |<------------------------------------- INVITE F9<|
|              |               |              |                  |
|              |>F10 100 Trying -------------------------------->|
|<- INVITE F11<|               |              |                  |
|              |               |              |<---- PUBLISH F12<|
|              |               |              |        (appearance=2)
|              |               |              |>F13 200 OK ----->|
|              |               |>F14 PUBLISH->|                  |
|              |               |     (appearance=3)              |
|              |               |              |                  |
|              |               |<--- F15 200 <|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F16<|                  |
|              |               |              |                  |
|              |               |>F17 200 OK ->|                  |
Dave           |               |              |------ NOTIFY F18>|
|              |               |              |                  |
|              |               |              |<F19 200 OK -----<|
|              |<-- INVITE F20<|              |                  |
|              |               |              |                  |
|              |>F21 100 ----->|              |                  |
|<- INVITE F22<|               |              |                  |

图 12. 外观占用争用竞态条件示例

11.13. 外观代理对 UA 的订阅​

在此场景中, 外观代理除了通过 Bob 之外无法获知 Bob 的对话状态信息。这可能是因为外观代理不属于 B2BUA, 或者 Bob 是远程注册的。当 Bob 注册时, 外观代理会从注册服务器收到注册事件包通知。外观代理随后使用 SUBSCRIBE 中的 Event:dialog 订阅 Bob 的对话事件状态。每当 Bob 的对话状态发生变化时, Bob 的 UA 都会向外观代理发送 NOTIFY, 外观代理再通知组内其他 UA。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|              |<----------------------------------- REGISTER F1<|
|              |               |              |                  |
|              |>F2 200 OK ------------------------------------->|
|              |               |              |                  |
|              |>F3 NOTIFY ------------------>|                  |
|              |               |              |                  |
|              |<------------------ 200 OK F4<|                  |
|              |               |              |---- SUBSCRIBE F5>|
|              |               |              |                  |
|              |               |              |<F6 200 OK ------<|
|              |               |              |                  |
|              |               |              |<------ NOTIFY F7<|
|              |               |              |                  |
|              |               |              |>F8 200 OK ------>|
|              |               |              |                  |
|              |               |              |<--- SUBSCRIBE F9<|
|              |               |              |                  |
|              |               |              |>F10 200 OK ----->|
|              |               |              |                  |
|              |               |              |------ NOTIFY F11>|
|              |               |              |                  |
|              |               |              |<F12 200 OK -----<|
|              |               |              |                  |
|              |<------------------------------------ INVITE F13<|
|              |               |              |                  |
|              |>F14 100 Trying -------------------------------->|
|<- INVITE F15<|               |              |                  |
|              |               |              |<----- NOTIFY F16<|
|              |               |              |                  |
|              |               |              |>F17 200 OK ----->|
|              |               |<- NOTIFY F18<|                  |
|              |               |              |                  |
|              |               |>F19 200 OK ->|                  |
|              |               |              |------ NOTIFY F20>|
|              |               |              |                  |
|              |               |              |<F21 200 OK -----<|
|>F22 180  --->|               |              |                  |
|              |>F23 180 Ringing ------------------------------->|
|              |               |              |                  |
|              |               |              |<----- NOTIFY F24<|
|              |               |              |                  |
|              |               |              |>F25 200 OK ----->|
|              |               |<- NOTIFY F26<|                  |
|              |               |              |                  |
|              |               |>F27 200 OK ->|                  |
|              |               |              |------ NOTIFY F28>|
|              |               |              |                  |
|              |               |              |<F29 200 OK -----<|
|>F30 200 OK ->|               |              |                  |
|              |>F31 200 OK ------------------------------------>|
|              |               |              |                  |
|              |               |              |<----- NOTIFY F32<|
|              |               |              |                  |
|              |               |              |>F33 200 OK ----->|
|              |               |              |                  |
|              |<--------------------------------------- ACK F34<|
|<---- ACK F35<|               |              |                  |
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |               |<- NOTIFY F36<|                  |
|              |               |              |                  |
|              |               |>F37 200 OK ->|                  |
|              |               |              |------ NOTIFY F38>|
|              |               |              |                  |
|              |               |              |<F39 200 OK -----<|
|              |               |              |                  |

图 13. 外观代理对 UA 的订阅示例

11.14. 外观接听竞态条件失败​

在此场景中, Bob 与 Carol 已按图 1 或图 2 的呼叫流程建立了对话。随后 Bob 将 Carol 置于保持状态。Alice 收到此通知并在 Alice 的 UI 上呈现。Alice 尝试接听该呼叫, 但 Carol 在接听完成之前挂断。Alice 通过 PUBLISH F48 取消接听尝试。请注意, Join 失败的呼叫流程几乎完全相同。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|<================= Both way RTP established ===================>|
|              |               |              |                  |
|              |<------------------------------(hold) INVITE F22<|
|<- INVITE F23<|               |              |                  |
|              |               |              |                  |
|>F24 200 OK ->|               |              |                  |
|              |>F25 200 OK ------------------------------------>|
|              |               |              |                  |
|              |<--------------------------------------- ACK F26<|
|<---- ACK F27<|               |              |                  |
|              |               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F28<|                  |
|              |               |              |                  |
|              |               |>F29 200 OK ->|                  |
|              |               |              |>F30 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F31<|
|              |               |              |                  |
|              |  Alice decides to pick up the call              |
|              |               |              |                  |
|              |               |>F32 PUBLISH->|                  |
|              |               |              |                  |
|              |               |<- 200 OK F33<|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F34<|                  |
|              |               |              |                  |
|              |               |>F35 200 OK ->|                  |
|              |               |              |>F36 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F37<|
|>F38 BYE ---->|               |              |                  |
|              |>F39 BYE --------------------------------------->|
|              |               |              |                  |
|              |<------------------------------------ OK 200 F40<|
|<- 200 OK F41<|               |              |                  |
|              |<-- INVITE F42<|              |                  |
|<- INVITE F43<|(w/ Replaces)  |              |                  |
|( w/ Replaces)|               |              |                  |
|              |               |              |                  |
|>F44 481 ---->|               |              |                  |
|              |>F45 481 ----->|              |                  |
|<---- ACK F46<|               |              |                  |
|              |<----- ACK F47<|              |                  |
|              |               |>F48 PUBLISH->|                  |
|              |               |              |                  |
|              |               |<- 200 OK F49<|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F50<|                  |
|              |               |              |                  |
|              |               |>F51 200 OK ->|                  |
|              |               |              |>F52 NOTIFY ----->|
|              |               |              |                  |
|              |               |              |<----- 200 OK F53<|

图 14. 外观接听竞态条件失败示例

F48 Alice ----> Appearance Agent

PUBLISH sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP ua2.example.com;branch=z9hG4bKa5d6cf61F5FBC05A
From: <sip:[email protected]>;tag=44150CC6-A7B7919D
To: <sip:[email protected]>;tag=428765950880801
CSeq: 11 PUBLISH
Call-ID: 87837Fkw87asfds
Contact: <sip:[email protected]>
Event: dialog;shared
Max-Forwards: 70
Content-Type: application/dialog-info+xml
Content-Length: ...
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
xmlns:sa="urn:ietf:params:xml:ns:sa-dialog-info"
version="10"
state="full"
entity="sip:[email protected]">
<dialog id="id3d4f9c83"
call-id="dc95da63-60db1abd-d5a74b48"
local-tag="605AD957-1F6305C2" >
<sa:appearance>1</sa:appearance>
<sa:exclusive>false</sa:exclusive>
<sa:replaced-dialog
call-id="14-1541707345"
from-tag="44BAD75D-E3128D42"
to-tag="d3b06488-1dd1-11b2-88c5-b03162323164+d3e48f4c" />
<state>terminated</state>
<local>
<target uri="sip:[email protected]">
</target>
</local>
<remote>
<target uri="sip:[email protected]" />
</remote>
</dialog>
</dialog-info>

11.15. 外观占用来电/去电争用竞态条件​

Alice 尝试占用外观 2, 与此同时外观 2 被分配给一个来电。外观代理通过向 Alice 发送 400 (Bad Request) 解决该冲突。在 NOTIFY F6 之后, Alice 得知该来电正在使用外观 2。Alice 重新发布以使用外观 3, 该请求被接受。请注意, 此示例展示的是 INVITE 在来自外观代理的 NOTIFY 之前被接收。

Carol        Proxy           Alice     Appearance Agent         Bob
|              |               |              |                  |
|>-- INVITE F1>|               |              |                  |
|              |< - - - - - - - - - - - - - ->|                  |
|              |               |              |                  |
|              |               |>F2 PUBLISH ->|                  |
|              |               |     (appearance=2)              |
|              |               |              |                  |
|              |>F3 INVITE (appearance=2) ---------------------->|
|              |               |              |                  |
|              |>F4 INVITE     |              |                  |
|              |(appearance=2)>|              |                  |
|              |               |<---- F5 400 <|                  |
|              |               |              |                  |
|              |               |<-- NOTIFY F6<|                  |
|              |               |              |                  |
|              |               |>F7 200 OK -->|                  |
|              |               |              |------- NOTIFY F8>|
|              |               |              |                  |
|              |               |              |<F9 200 OK ------<|
|              |               |              |                  |
|              |               |>F10 PUBLISH->|                  |
|              |               |     (appearance=3)              |
|              |               |              |                  |
|              |               |< F11 200 OK <|                  |
|              |               |              |                  |
|              |               |<- NOTIFY F12<|                  |
|              |               |              |                  |
               |               |>F13 200 OK ->|                  |
Dave           |               |              |------ NOTIFY F14>|
|              |               |              |                  |
|              |               |              |<F15 200 OK -----<|
|              |<-- INVITE F16<|              |                  |
|              |               |              |                  |
|              |>F17 100 ----->|              |                  |
|<- INVITE F18<|               |              |                  |

图 15. 外观占用来电/去电争用竞态条件示例