Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
understanding-SIP.pdf
Скачиваний:
113
Добавлен:
01.03.2016
Размер:
3.99 Mб
Скачать

16

Call Flow Examples

In this chapter, many of the concepts and details presented in the preceding chapters will be illustrated with examples. Each example includes a call flow diagram and a discussion of the example, followed by the message details. Each message is labeled in the figure with a message number for easy reference. For more examples of the protocol, refer to the SIP specification [1], the SIP call flows [2, 3] documents, and the SIP service examples document [4].

The purpose of the examples in this chapter is to illustrate aspects of the SIP protocol. The interoperation scenarios with the PSTN are not intended to fully define the interworking or show a complete parameter mapping between the protocols. Likewise, simplifications such as minimal authentication and direct client-to-gateway messaging are used to make the examples more clear.

16.1 SIP Call with Authentication, Proxies, and Record-Route

Figure 16.1 shows a basic SIP call between two SIP UAs involving two proxy servers. Rather than perform a DNS query on the SIP URI of the called party, the calling SIP phone sends the INVITE request to a proxy server for address resolution. The proxy server requires authentication to perform this service and replies with a 407 Proxy Authorization Required response. Using the nonce from the challenge, the caller resends the INVITE with the caller’s username and password credentials. The proxy checks the credentials, and finding them to be correct, performs the DNS lookup on the Request-URI. The INVITE is then forwarded to the proxy server listed in the DNS SRV record that handles the language.org domain. That proxy then looks up the Request-URI and locates a registration for the called party. The INVITE is forwarded to the destination UAS, a Record-Route header having been inserted to ensure that the proxy is present in

343

344

 

 

 

 

SIP: Understanding the Session Initiation Protocol

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 16.1 SIP-to-SIP call with authentication, proxies, and Record-Route.

all future requests by either party. This is because a directly routed SIP message to Ada would be blocked by the firewall.

The called party receives the INVITE request and sends 180 Ringing and 200 OK responses, which are routed back to the caller using the Via header chain from the initial INVITE. The ACK sent by the caller includes a Route header built from the Record-Route header field in the 200 OK response. This routing skips the first proxy but includes the firewall proxy. The media session begins with the UAs exchanging RTP and RTCP packets.

The call terminates when the called party, Ada, sends a BYE, which includes a Route header generated from the Record-Route header field in the INVITE. Note that the CSeq for the called user agent is initialized to 1000. The acknowledgment of the BYE with a 200 OK response causes both sides to stop sending media packets.

 

 

Call Flow Examples

345

 

M1

INVITE sip:ada@language.org SIP/2.0

Request-URI

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK454

 

 

Max-Forwards: 70

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

 

 

 

 

Call-ID: f6329a3491e7

CSeq initialized to 1

 

 

CSeq: 1 INVITE

 

 

Contact: <sip:babbage@client.analyticalsoc.org>

 

 

Subject: RE: Software

 

 

 

 

User-Agent: DifferenceEngine/1

 

 

 

 

Content-Type: application/sdp

 

 

 

 

Content-Length: 137

 

 

 

 

v=0

 

 

 

 

o=Babbage 2890844534 2890844534 IN IP4 12.26.17.91

 

 

s=-

 

 

 

 

t=0 0

Babbage’s IP address

 

 

c=IN IP4 12.26.17.91

 

 

m=audio 49170 RTP/AVP 0

Port number

 

 

a=rtpmap:0 PCMU/8000

Codec info

M2 SIP/2.0 407 Proxy Authentication Required

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK454

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=34q4356g

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 1 INVITE

Authentication challenge

 

 

Proxy-Authenticate: Digest

 

 

realm=”language.org”,

 

 

 

 

nonce=”9c8e88df84f1cec4341ae6e5a359”,

 

 

opaque=””, stale=FALSE, algorithm=MD5

M3

ACK sip:ada@language.org SIP/2.0

 

 

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK454

 

 

Max-Forwards: 70

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=34q4356g

 

 

Call-ID: f6329a3491e7

CSeq not incremented Method set to ACK

 

 

CSeq: 1 ACK

M4

INVITE sip:ada@language.org SIP/2.0

INVITE resent with credentials

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

Max-Forwards: 70

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

Call-ID unchanged

 

 

Call-ID:f6329a3491e7

 

 

CSeq: 2 INVITE

CSeq incremented

 

 

Proxy-Authorization: Digest

Credentials

 

 

username=”Babbage”,

 

 

realm=”language.org”,

 

 

nonce=”9c8e88df84f1cec4341ae6e5a359”, opaque=””, response=”e56131d19580cd833064787ecc”

Contact: <sip:babbage@client.analyticalsoc.org> Subject: RE: Software

User-Agent: DifferenceEngine/1 Content-Type: application/sdp Content-Length: 137

v=0

346

SIP: Understanding the Session Initiation Protocol

 

 

 

 

o=Babbage 2890844534 2890844534 IN IP4 12.26.17.91

 

 

 

 

s=-

 

 

 

 

t=0 0

 

 

 

 

c=IN IP4 12.26.17.91

 

 

 

 

m=audio 49170 RTP/AVP 0

 

 

 

 

a=rtpmap:0 PCMU/8000

 

 

M5

SIP/2.0 100 Trying

Credentials accepted

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

 

 

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 2 INVITE

 

 

M6

DNS Query:

 

 

 

 

SRV lookup on _udp._sip.language.org

 

 

M7

DNS Response:

 

 

 

 

_sip._udp.language.org. 300 IN SRV 0 100 5060 proxy.languagel.org.

 

 

proxy.language.org. 3600 IN A 10.14.92.1

 

 

M8

INVITE sip:ada@language.org SIP/2.0

 

 

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

 

 

Max-Forwards: 69

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

 

 

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 2 INVITE

 

 

 

 

Contact: <sip:babbage@client.analyticalsoc.org>

 

 

 

 

Subject: RE: Software

 

 

 

 

User-Agent: DifferenceEngine/1

 

 

 

 

Content-Type: application/sdp

 

 

 

 

Content-Length: 137

 

 

 

 

v=0

 

 

 

 

o=Babbage 2890844534 2890844534 IN IP4 12.26.17.91

 

 

 

 

s=-

 

 

 

 

t=0 0

 

 

 

 

c=IN IP4 12.26.17.91

 

 

 

 

m=audio 49170 RTP/AVP 0

 

 

 

 

a=rtpmap:0 PCMU/8000

 

 

M9

SIP/2.0 100 Trying

Not Forwarded

 

 

Via:SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

 

 

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 2 INVITE

 

 

M10

Location Service Query: ada?

 

 

M11

Location Service Response: sip:ada@1.2.3.4

 

 

M12 INVITE sip:ada@1.2.3.4 SIP/2.0

 

 

Call Flow Examples

347

 

 

Via: SIP/2.0/UDP proxy.language.org:5060;branch=z9hG4bK24105.1

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

Max-Forwards: 68

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: sip:ada@language.org

 

 

 

Call-ID: f6329a3491e7

 

 

 

CSeq: 2 INVITE

 

 

 

Contact: <sip:babbage@client.analyticalsoc.org>

 

 

Subject: RE: Software

 

 

 

User-Agent: DifferenceEngine/1

 

 

 

Record-Route: <sip:10.14.92.1;lr>

Record-Route added by proxy

 

 

Content-Type: application/sdp

 

 

 

Content-Length: 137

 

 

 

v=0

 

 

 

o=Babbage 2890844534 2890844534 IN IP4 12.26.17.91

 

 

s=-

 

 

 

t=0 0

 

 

 

c=IN IP4 12.26.17.91

 

 

 

m=audio 49170 RTP/AVP 0

 

 

 

a=rtpmap:0 PCMU/8000

 

M13

SIP/2.0 180 Ringing

 

 

 

Via : SIP/2.0/UDP proxy.language.org:5060;branch=z9hG4bK24105.1

 

 

;received=10.14.92.1

 

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=65a3547e3

Tag added by called party

 

 

Call-ID: f6329a3491e7

 

 

 

CSeq: 2 INVITE

 

 

 

Contact: sip:ada@drawingroom.language.org

 

 

 

Record-Route: <sip:10.14.92.1;lr>

 

M14

SIP/2.0 180 Ringing

 

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=65a3547e3

 

 

 

Call-ID: f6329a3491e7

 

 

 

CSeq: 2 INVITE

 

 

 

Contact: sip:ada@drawingroom.language.org

 

 

 

Record-Route: <sip:10.14.92.1;lr>

 

M15

SIP/2.0 180 Ringing

 

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=65a3547e3

 

 

 

Call-ID: f6329a3491e7

 

 

 

CSeq: 2 INVITE

 

M16

SIP/2.0 200 OK

Call accepted

 

 

Via: SIP/2.0/UDP 10.14.92.1:5060;branch=z9hG4bK24105.1

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382 To: <sip:ada@language.org>;tag=65a3547e3

Call-ID: f6329a3491e7

348

SIP: Understanding the Session Initiation Protocol

 

 

 

 

CSeq: 2 INVITE

 

 

 

 

Contact: sip:ada@drawingroom.language.org

 

 

 

 

Record-Route: <sip:10.14.92.1;lr>

 

 

 

 

Content-Type: application/sdp

 

 

 

 

Content-Length: 126

 

 

 

 

v=0

 

 

 

 

o=Ada 2890844536 2890844536 IN IP4 1.2.3.4

 

 

 

 

s=-

 

 

 

 

t=0 0

Ada’s IP address

 

 

c=IN IP4 1.2.3.4

 

 

m=audio 52310 RTP/AVP 0

Port number

 

 

a=rtpmap:0 PCMU/8000

Codec information

M17

SIP/2.0 200 OK

 

 

 

 

Via: SIP/2.0/UDP 15.16.17.18:5060;branch=z9hG4bK3f31049.1

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=65a3547e3

 

 

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 2 INVITE

 

 

 

 

Contact: sip:ada@drawingroom.language.org

 

 

 

 

Record-Route: <sip:10.14.92.1;lr>

 

 

 

 

Content-Type: application/sdp

 

 

 

 

Content-Length: 126

 

 

 

 

v=0

 

 

 

 

o=Ada 2890844536 2890844536 IN IP4 1.2.3.4

 

 

 

 

s=-

 

 

 

 

t=0 0

 

 

 

 

c=IN IP4 1.2.3.4

 

 

 

 

m=audio 52310 RTP/AVP 0

 

 

 

 

a=rtpmap:0 PCMU/8000

 

 

M18

SIP/2.0 200 OK

 

 

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK221

 

 

 

 

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

 

 

To: <sip:ada@language.org>;tag=65a3547e3

 

 

 

 

Call-ID: f6329a3491e7

 

 

 

 

CSeq: 2 INVITE

 

 

 

 

Contact: sip:ada@drawingroom.language.org

 

 

 

 

Record-Route: <sip:10.14.92.1;lr>

 

 

 

 

Content-Type: application/sdp

 

 

 

 

Content-Length: 126

 

 

 

 

v=0

 

 

 

 

o=Ada 2890844536 2890844536 IN IP4 1.2.3.4

 

 

 

 

s=-

 

 

 

 

t=0 0

 

 

 

 

c=IN IP4 1.2.3.4

 

 

 

 

m=audio 52310 RTP/AVP 0

 

 

 

 

a=rtpmap:0 PCMU/8000

 

 

M19

ACK sip:ada@drawingroom.language.org SIP/2.0

Sent to ALG

 

 

Via: SIP/2.0/UDP 12.26.17.91:5060;branch=z9hG4bK789

 

 

Max-Forwards: 70

From: Charles Babbage <sip:babbage@analyticalsoc.org>;tag=9382

To: <sip:ada@language.org>;tag=65a3547e3

Call-ID: f6329a3491e7