Again some recaps on SIP call setup..
SIP Call Flow
Basic SIP session setup involves a SIP UA client sending a request to the SIP URL of the called endpoint (UAS), inviting it to a session. If the UAC knows the IP address of the UAS, it can send the request. Otherwise, the UAC sends the request to a proxy or redirect server to locate the user. That server might forward the request to other servers until the user is located. After the SIP address is resolved to an IP address, the request is sent to the UAS. If the user takes the call, capabilities are negotiated and the call commences. If the user does not take the call, it can be forwarded to voice mail or another number. The following sections outline various scenarios in more detail.
Call Flow Between Two SIP Gateways
Cisco routers, including CME routers, can act as SIP gateways for calls that originate from non-SIP phones. The gateways function as SIP UAs and set up a SIP session between them for each call. Figure 4-1 shows two routers handling analog phones, using SIP between them. In this example, SIP GW-A originates the calls and acts as a UAC, and SIP GW-B acts as a UAS. The signaling from the PBX to the gateway is just normal analog call signaling. Only the two gateways exchange SIP messages.
Figure 4-1 Call Flow Between Two SIP Gateways
In Figure 4-1, the analog phone on the left initiates a call to the analog phone on the right.
After the first phone initiates the call, the call flow proceeds as follows:
- The PBX sends a call setup signal to GW-A, which then sends a SIP INVITE message to GW-B. This INVITE contains SDP information for capabilities negotiation. GW-A also sends a Call Proceeding message to the PBX.
- GW-B exchanges call setup message with its PBX and sends SIP responses 100 (Trying) and 180 (Ringing) to GW-A.
- GW-A translates these messages into analog signaling messages for its PBX.
- When the user on the right picks up the call, his PBX sends a Connect message to GW-B, which then forwards a SIP 200 (OK) response to GW-A. This OK response contains SDP information with the capabilities that both devices support.
- GW-A delivers a Connect message to its PBX. When the PBX acknowledges that with a Connect ACK, it sends a SIP ACK message to GW-B.
- GW-B sends a Connect acknowledgement to its PBX, and the call is active. At this point, normal voice steams exist between the two phones and the gateways, and RTP voice streams exist between the two gateways.
- The user on the left hangs up the phone. His PBX sends a Call Disconnect message to GW-A. GW-A then sends a SIP BYE message to GW-B and a Release message to the PBX. The PBX responds with a Release Complete message.
- GW-B sends a Call Disconnect message to its PBX, which responds with a Release message.
- GW-B forwards a SIP 200 (OK) response to GW-A and a Release Complete message to its PBX. The call is now completely terminated.
Call Flow Using a Proxy Server
SIP UAs register with a proxy server or a registrar. Proxy servers then act as an intermediary for SIP calls. Cisco routers that are acting as SIP gateways can use the services of a SIP proxy server, either contacting the server or receiving requests from it. They can additionally register E.164 numbers with a proxy server or a registrar.
Proxy servers can either leave the signaling path when the call is connected or can enable “Record-route” to stay in the signaling path. If Record-route is disabled, the proxy server does not know of any changes to the call or when the call is disconnected. Figure 4-2 shows call flow when Record-route is disabled.
In Figure 4-2, a SIP endpoint places a call using a proxy server. The figure shows several types of endpoints:
- A PC and a PDA running a SIP application
- A SIP phone
- A cell phone that uses SIP
In Figure 4-2, one of these endpoints places a call to an analog phone behind SIP gateway GW-B. The call flow proceeds as follows:
- The UAC sends an INVITE to its proxy server. In this INVITE, the Request-URI field contains the address of the called phone number as part of the SIP address. SDP information is included with this INVITE.
- The proxy server creates a new INVITE, copying the information from the old INVITE, but replacing the Request-URI with the address of GW-B—the UAS.
- When GW-B receives the INVITE, it initiates a call setup with the PBX. It sends a SIP response 100 (Trying) to the proxy server which, in this example, sends a 100 response to the SIP UAC. The proxy server is not required to send this response.
- The PBX sets up an analog call with the end user and sends call progress messages to GW-B. When GW-B receives the Alerting message, it sends a SIP 180 (Ringing) message to the proxy server. The proxy server sends the same message to the UAC.
- When the end user picks up the phone, the PBX sends a Connect message to GW-B. GW-B then sends a SIP 200 (OK) response to the proxy server, which sends it to the UAC. SDP information for the remote end is included in this OK response. The proxy server is not configured to be stateful—that is, Record Route is disabled. Therefore, the proxy server leaves the signaling path, and all further SIP signaling is directly between the UAC and GW-B.
- The SIP UAC acknowledges the OK response, and a two-way RTP stream is established between the UAC and GW-B, the UAS. A two-way voice stream is established between GW-B and the PBX.
- When the UAC hangs up, it exchanges SIP BYE and OK signals with GW-B. GW-B terminates the call with the PBX.
Call Flow Using Multiple Servers
SIP UAs and SIP proxy servers can contact a redirect server to determine where to send an INVITE. They typically do this when the called number is outside the local domain. The redirect server returns the most detailed information it has—either endpoint location(s) or the location of the next-hop server. Then it relies on the proxy server or UAC to route its INVITE appropriately.
Figure 4-3 shows the call flow in a more complex network with registrar, redirect, and proxy servers. (Recall that these are functional units and can all reside in the same device.) The figure shows the messages that are necessary to route the initial INVITE method to the UAS. After GW-B, the UAS, receives the INVITE, call flow is similar to the previous examples.
In Figure 4-3, one of the SIP endpoints in Network A calls an analog phone behind gateway GW-B in Network B. The following steps take place:
- The gateway, GW-B, registers the E.164 phone numbers of its analog phones with the registrar server.
- The registrar server replies with a 200 (OK) response.
- The UAC sends an INVITE method to its proxy server, Proxy-A.
- The proxy server recognizes that the destination number is outside its domain. It sends the INVITE to the redirect server.
- The redirect server replies with a 300-series message listing the SIP address of the next-hop proxy server, Proxy-B.
- Proxy-A sends an INVITE message to Proxy-B.
- Proxy-B requests the location of the called number from its registrar server.
- The registrar server responds with the SIP address of GW-B.
- Proxy-B sends an INVITE to GW-B.
Following these steps, GW-B sets up the call with the PBX. It sends responses to Proxy-B, which forwards them through Proxy-A to the calling endpoint. If Record-route is enabled, all further signaling goes through the proxies. If not, call signaling proceeds as shown in Figure 4-2.
Call Flow Using Cisco CallManager 5.x
CallManager 5.x supports SIP phones and is an integral part of a SIP network. It can play different roles, such as registrar server and B2BUA.
Figure 4-4 illustrates a call flow scenario with CallManager acting as a B2BUA.
In Figure 4-4, a SIP phone is registered to a CallManager. The SIP phone places a call to an analog phone off a PBX behind the router/gateway GW-B. A SIP trunk exists between CallManager and the gateway. CallManager acts as a B2BUA—it terminates each leg of the call during the signaling phases, yet it allows the RTP stream to go directly between the two endpoints. This is accomplished by the way SDP information is sent.
- A SIP phone that is registered to CallManager calls the analog phone. It sends an INVITE containing standard SDP information to CallManager. CallManager responds with a 100 Trying message. In this step, CallManager is acting as a UAS.
- CallManager sends an INVITE over its SIP trunk to the remote SIP gateway, GW-B. This INVITE has a different Call-ID number than the one from the phone. In addition, this INVITE does not contain SDP fields. CallManager acts as a UAC in this step.
- GW-B answers with a 100 Trying message and initiates a call to the PBX. (That signaling is not shown.) GW-B sends its SDP parameters in a 183 Session Progress message to CallManager. Included in this are the session parameters that the gateway supports.
- CallManager sends a 183 Session Progress message to the SIP phone. This message contains an SDP portion with the capabilities that both endpoints support. For instance, suppose that the original SDP message of the phone indicated that it supported G.711 and G.729 codecs, but the gateway SDP message said that it supported only G.729. In that case, the 183 message from CallManager to the phone would list only G.729. It would also list the IP address of GW-B as the originator address in SDP field ‘c.’
- When the analog phone picks up, GW-B sends a 200 OK message containing its SDP information. CallManager acknowledges it with an ACK that contains the SDP information that both endpoints support. The IP address of the SIP phone is also included as the originator address in the SDP field ‘c.’
- CallManager sends a 200 OK message with SDP information to the phone. The phone acknowledges that message. Now that each endpoint has the IP address of the other, the two can establish an RTP stream between them for the duration of the call.
- In Figure 4-4, the analog phone hangs up, so GW-B sends a SIP BYE method to CallManager.
- CallManager replies with a 200 OK response and then sends a BYE to the SIP phone. The phone responds with a 200 OK message.