Introduction to VoIP using SIP


Published on

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Internet telephony or Voice over IP involves transport of telephone calls over the Internet. Most of the interest in Internet telephony is motivated by cost savings and ease of integrating new services. In a way, Internet telephony is closer to the Internet services such as email and web, than to traditional telephony. It employs a variety of protocols, including RTP (Real-time Transport Protocol) for transport of multimedia data and SIP (Session Initiation Protocol) for signaling, i.e., establishing and controlling sessions. SIP is designed to integrate with other Internet services such as email, web, voice mail, instant messaging, presence, multi-party conferencing and multimedia collaboration. In this presentation, I give a brief tutorial of Internet telephony services using SIP.
  • Introduction to VoIP using SIP

    1. 1. Introduction to Internet telephony (VoIP) Kundan Singh Columbia University
    2. 2. Agenda <ul><li>Introducing VoIP </li></ul><ul><ul><li>What does it take to build simple audio telephony? </li></ul></ul><ul><li>Inside Session Initiation Protocol (SIP) </li></ul><ul><ul><li>What are the main features of SIP </li></ul></ul><ul><li>VoIP services using SIP </li></ul><ul><ul><li>How do we implement various services like call transfer, auto-attendant, voicemail? </li></ul></ul>
    3. 3. <ul><li>Digitization (e.g., sampling at 8kHz, 16 bits per sample, i.e, 128 kb/s or 320 bytes per 20 ms) </li></ul><ul><li>Real-time compression/ encoding (e.g., G.729A at 8 kb/s) </li></ul><ul><li>Transport to remote IP address and port number over UDP (Why not TCP?) </li></ul><ul><li>Processing on receiver side is the reverse </li></ul>Audio Packet Transfer …
    4. 4. Sampling, Quantization, Encoding 10101111…01101101 Sample at twice the highest voice frequency 2 x 4000=8000 Hz (interval of 125 µ sec) Round off samples to one of 256 levels (introduces noise) Encode each quantized sample into 8 bit code word PCM: 8000 x 8 bits = 64 kb/s Other techniques (differential coding, linear prediction) 2.4 kb/s to 64 kb/s +127 +0 -127
    5. 5. Problems with UDP <ul><li>Unreliable UDP </li></ul><ul><li>Packet loss </li></ul><ul><li>Out-of-order (very rarely) </li></ul><ul><li>Jitter (delay variation) </li></ul>1 2 3 5 7 6 1 2 3 4 5 6 7 timeline Sender Receiver (a) (b)
    6. 6. Receive buffer (playout buffer or circular buffer) playout buffer while (true) { buf = read (au,20ms); //blocks if (!silence) sendto (remote, buf); … buf = get (20 ms); write (au, buf); } while (true) { buf = recvfrom(...); // blocks put(buf); } 20 ms packet microphone sendto(remote IP:port) read speaker 20 ms packet write get Received packet recvfrom() put
    7. 7. Receive buffer (playout buffer or circular buffer) <ul><li>Receive buffer: to absorb jitter </li></ul><ul><li>Tradeoff in buffer size </li></ul><ul><li>Adaptive delay adjustment </li></ul><ul><li>Sequence number: to detect packet loss; Just ignore the loss! </li></ul>Sender Receiver 1 2 3 5 7 6 1 2 3 4 5 6 7 8 9 0 2 3 4 8 9 0 1 2 3 4 3 2 1 1 2 1 2 1 2 3 5 7 5 7 6 8 7 9 8 0 9 0 2 3 2
    8. 8. Timestamp vs sequence number <ul><li>Silence suppression </li></ul><ul><li>Variable length packets </li></ul>1 2 3 4 1 2 3 4 Sender Receiver 5 6 7 5 6 7 Silence … t1 t2 t3 t4 t5 t6 t7 t8 t9 Playout time vs packet loss detection
    9. 9. Real-time Transport Protocol (RTP) Encoded Audio RTP Header UDP header IP header msg sendto(…, msg, …) recvfrom(…, msg, …) Sequence number Optional contributors’ list (CSrc) Source identifier (SSrc) Timestamp (proportional to sampling time) Payload type CC M V P X RTP: media transport RTCP: QoS feedback 8 bits 8 bits 16 bits
    10. 10. RTP-based conference ssrc=5263 ssrc=7182 ssrc=2639 ssrc=9844 Session identified using receive IP address + port
    11. 11. RTP-based conference   Mixer Transcoder  -law  -law G.729 G.729  -law  -law Mixer mixes multiple streams, and puts rtp.ssrc s of contributors in the mixed packet as rtp.csrc Transcoder converts one encoding to another. Typically to accommodate heterogeneous bandwidth links.
    12. 12. Why do we need signaling? Alice Bob Sam Henry <ul><li>Locate destination user </li></ul><ul><li>Negotiate session parameters </li></ul>Bob=> Sam Henry=> Alice=> Where is Alice? INVITE for a call using µ -law and G.729 at OK using µ-law at
    13. 13. Session Initiation Protocol (SIP) <ul><li>Address similar to email </li></ul><ul><li>Two stage lookup: </li></ul><ul><ul><li>DNS: uses naming authority pointer and service records </li></ul></ul><ul><ul><li>Database or service logic: within a domain </li></ul></ul> Alice Bob Jane $ dig –t naptr 3600 IN NAPTR 1 0 &quot;s&quot; &quot;SIP+D2U&quot; &quot;&quot; 3600 IN NAPTR 2 0 &quot;s&quot; &quot;SIP+D2T&quot; &quot;&quot; $ dig –t srv 3600 IN SRV 10 10 5060 . 3600 IN SRV 10 10 5060 $ dig –t a 3600 IN A
    14. 14. SIP message format INVITE SIP/2.0 From: “Bob” <> To: “Alice” <> Subject : How are you? ... SIP/2.0 200 OK From: “Bob” <> To: “Alice” <> Subject: How are you? ... Request Response
    15. 15. Session Description Protocol (SDP) Alice Bob INVITE I can support  -law and G.729 Send me audio at OK; I can support  -law Send me audio at ACK To port 8000 RTP To port 6780 RTP
    16. 16. SDP message format and offer answer INVITE SIP/2.0 ... v=0 o=bob 26172 27162 IN IP4 s=SIP call c=IN IP4 t=0 0 m= audio 6780 RTP/AVP 0 8 5 m= video 6790 RTP/AVP 31 Request Response SIP/2.0 200 OK ... c=IN IP4 t=0 0 m= audio 8000 RTP/AVP 0 8 m= video 0 RTP/AVP 31
    17. 17. Agenda <ul><li>Introducing VoIP </li></ul><ul><ul><li>What does it take to build simple audio telephony? </li></ul></ul><ul><li>Inside Session Initiation Protocol (SIP) </li></ul><ul><ul><li>What are the main features of SIP </li></ul></ul><ul><li>VoIP services using SIP </li></ul><ul><ul><li>How do we implement various services like call transfer, auto-attendant, voicemail? </li></ul></ul>
    18. 18. SIP is …, SIP is not … <ul><li>SIP = core protocol for establishing sessions in the Internet (peer-to-peer) </li></ul><ul><li>Transports session description information from initiator (caller) to receiver (callee) </li></ul><ul><li>Allows change of parameters in mid-session </li></ul><ul><li>Terminate session </li></ul><ul><li>NOT for distribution of multimedia data </li></ul><ul><li>NOT suitable for media gateway control </li></ul><ul><li>. . . </li></ul><ul><li>SIP applications typically fall in following categories: </li></ul><ul><li>setting up voice-over-IP calls </li></ul><ul><li>setting up multimedia conferences </li></ul><ul><li>event notification => IM and presence </li></ul><ul><li>text and general messaging </li></ul><ul><li>signaling transport </li></ul>
    19. 19. Addressing <ul><li>Personal mobility: </li></ul><ul><li>Examples: </li></ul><ul><ul><li>“ Alice Smith” <> </li></ul></ul><ul><ul><li>sip:alice@ </li></ul></ul><ul><ul><li>;user=phone;transport=tcp </li></ul></ul>tel:12125551234 tel:19172223333 [email_address] [email_address] [email_address] [email_address]
    20. 20. SIP message format <ul><li>Very similar to HTTP/1.1 </li></ul><ul><ul><li>Text-based, request-response </li></ul></ul><ul><ul><li>Request method operates on the resource/entity identified in URI </li></ul></ul><ul><li>Headers: </li></ul><ul><ul><li>To, From, Call-ID, CSeq: transaction identification </li></ul></ul><ul><ul><li>Via: response traverses the reverse request path </li></ul></ul><ul><ul><li>Content-Length, Content-Type: message body information </li></ul></ul><ul><li>Syntax: </li></ul><ul><ul><li>White-space doesn’t matter except in first line </li></ul></ul><ul><ul><li>Lines can be folded </li></ul></ul><ul><ul><li>Multi-valued header fields can be combiled as a comma-list </li></ul></ul><ul><li>Requests: </li></ul><ul><ul><li>INVITE, ACK, BYE, CANCEL: related to call setup and tear down </li></ul></ul><ul><ul><li>OPTIONS, INFO, COMET, PRACK, SUBSCRIBE, NOTIFY, PUBLISH, REFER, … </li></ul></ul><ul><li>Responses: </li></ul><ul><ul><li>Provisional : 100 Trying, 180 Ringing, 183 Session progress, … </li></ul></ul><ul><ul><li>Success : 200 OK, 202 Pending, … </li></ul></ul><ul><ul><li>Redirection : 301 Moved permanently, 302 Moved temporarily, … </li></ul></ul><ul><ul><li>Request failure : 400 Bad Request, 401 Unauthorized, 404 Not found, 480 Not available, 486 Busy here, … </li></ul></ul><ul><ul><li>Server failure : 500 Internal server error, 501 Not implemented, … </li></ul></ul><ul><ul><li>Global failure : 600 Busy everywhere, 603 Decline, … </li></ul></ul>
    21. 21. Building blocks <ul><li>SIP user agent </li></ul><ul><ul><li>IP phone, PC, conference bridge,… </li></ul></ul><ul><li>SIP redirect server </li></ul><ul><ul><li>returns new location for requests </li></ul></ul><ul><li>SIP stateless proxy </li></ul><ul><ul><li>routes call requests </li></ul></ul><ul><li>SIP (forking) stateful proxy </li></ul><ul><ul><li>routes call requests </li></ul></ul><ul><li>SIP registrar </li></ul><ul><ul><li>accepts name to address mapping </li></ul></ul><ul><li>Location server </li></ul><ul><ul><li>maintains name to address mapping </li></ul></ul><ul><li>Maintaining state </li></ul><ul><ul><li>stateless: each request and each response handled independently </li></ul></ul><ul><ul><ul><li>Fast load balancing proxies; robust </li></ul></ul></ul><ul><ul><li>(transaction) stateful: remember a whole request/response transaction </li></ul></ul><ul><ul><ul><li>Enterprise servers, . . . </li></ul></ul></ul><ul><ul><li>call stateful: remember a call from beginning to end </li></ul></ul><ul><ul><ul><li>Billing, NAT traversal, . . . </li></ul></ul></ul>Typically implemented in a single software or box Other entities: outbound proxy, back-to-back user agent (b2bua), application-level-gateway (ALG), …
    22. 22. Message routing <ul><li>Response follows the reverse request path </li></ul><ul><ul><li>Via header in SIP message records the request path </li></ul></ul><ul><li>Request routing decision at each hop </li></ul><ul><ul><li>Usually direct end-to-end transport after initial request </li></ul></ul><ul><ul><li>Forcing request path: Record-route and Route headers. </li></ul></ul><ul><ul><li>Request forking: parallel vs sequential (use q-value in Contact ) </li></ul></ul><ul><ul><li>Caller and callee info: further govern request routing </li></ul></ul>q=1.0 q=0.7 q=0.2 Via: Via: Via: Via: Via: Via: [email_address] [email_address] [email_address] [email_address] Via: Via: Via: Via: Via: Via: INVITE 302 moved 486 busy 200 OK
    23. 23. Example call setup (3) invite (4) moved (5) Bob (6) (6) (6) unavailable (7) Alice (8) (11) cancel (12) ok (1) invite (2) moved (9) ok (10) (13)
    24. 24. Transport <ul><li>SIP can operate on any packet network, reliable or unreliable </li></ul><ul><li>UDP: most common </li></ul><ul><ul><li>Low state overhead </li></ul></ul><ul><ul><li>But small max packet size </li></ul></ul><ul><li>TCP: </li></ul><ul><ul><li>Use with SSL </li></ul></ul><ul><ul><li>Connection setup overhead </li></ul></ul><ul><ul><li>Head of line blocking for trunks (use SCTP instead) </li></ul></ul><ul><li>Transport reliability </li></ul><ul><ul><li>Request retransmissions, exponential back-off interval </li></ul></ul><ul><ul><li>INVITE different than other methods </li></ul></ul><ul><ul><ul><li>Retransmit INVITE response after provisional response was sent </li></ul></ul></ul>
    25. 25. NAT traversal <ul><li>Problem: </li></ul><ul><li>Solutions: </li></ul><ul><ul><li>Smart servers </li></ul></ul><ul><ul><ul><li>(open)SER allows detecting nodes behind a NAT </li></ul></ul></ul><ul><ul><ul><li>Use application level gateway and media-proxy </li></ul></ul></ul><ul><ul><li>SIP Signaling </li></ul></ul><ul><ul><ul><li>Symmetric response routing for UDP (rport) </li></ul></ul></ul><ul><ul><ul><li>Connection reuse for TCP/TLS (sip-outbound) </li></ul></ul></ul><ul><ul><li>Media </li></ul></ul><ul><ul><ul><li>STUN: Simple traversal of UDP through NAT </li></ul></ul></ul><ul><ul><ul><li>TURN: Traversal using relay NAT </li></ul></ul></ul><ul><ul><ul><li>ICE: Interactive connectivity establishment </li></ul></ul></ul>L= REGISTER Contact: sip:alice@ . . . E= INVITE alice@
    26. 26. NAT traversal (ICE) <ul><li>Address gathering </li></ul><ul><li>Negotiation </li></ul><ul><li>Connectivity check </li></ul>L= STUN server E= R= Gather addresses (L,E,R) (local) (external) (relay) Gather addresses (local) (external) (relay) INVITE (offer) OK (answer)
    27. 27. Agenda <ul><li>Introducing VoIP </li></ul><ul><ul><li>What does it take to build simple audio telephony? </li></ul></ul><ul><li>Inside Session Initiation Protocol (SIP) </li></ul><ul><ul><li>What are the main features of SIP </li></ul></ul><ul><li>VoIP services using SIP </li></ul><ul><ul><li>How do we implement various services like call transfer, auto-attendant, voicemail? </li></ul></ul>
    28. 28. IP telephony services (PSTN) <ul><li>Call routing services: pre-call, one party </li></ul><ul><ul><li>speed dial </li></ul></ul><ul><ul><li>call forwarding </li></ul></ul><ul><ul><li>“ follow me” </li></ul></ul><ul><ul><li>call filtering/blocking (in/out) </li></ul></ul><ul><ul><li>do not disturb </li></ul></ul><ul><ul><li>distinctive ringing </li></ul></ul><ul><li>Call handling features </li></ul><ul><ul><li>autoanswer </li></ul></ul><ul><li>Multi-party features </li></ul><ul><ul><li>call waiting </li></ul></ul><ul><ul><li>call transfer (blind, consultative) </li></ul></ul><ul><ul><li>conference call </li></ul></ul><ul><ul><li>call park </li></ul></ul><ul><ul><li>call pickup </li></ul></ul><ul><ul><li>music on hold </li></ul></ul><ul><ul><li>call monitoring </li></ul></ul>IP-telephony can’t win by just providing what PSTN has
    29. 29. IP telephony services (Internet) <ul><li>Presence-enabled calls </li></ul><ul><ul><li>place call only if callee is available </li></ul></ul><ul><li>Presence-enabled conferencing </li></ul><ul><ul><li>call conference participants when all are online and not busy </li></ul></ul><ul><li>IM conference alerts </li></ul><ul><ul><li>receive IM when someone joins a conference </li></ul></ul><ul><li>Unified messaging </li></ul><ul><ul><li>receive email, IM alert for new voicemails </li></ul></ul>Programmability of services
    30. 30. Where do the services reside? Make call when boss is online … Enter your authentication PIN for billing… B2BUA Double ringing sound when boss calls… Endpoint Forward to office phone during day, and home phone during evening… Proxy/registrar Endpoint Service control on client vs server Use finger for locating user…
    31. 31. Endpoint call control <ul><li>Language for End System Services (LESS) for endpoint service creation </li></ul><ul><li>Direct user interaction, direct media control </li></ul><ul><li>Handle converged information, e.g., call, presence, email </li></ul><ul><li>Example: when buddy is online, make a call </li></ul><ul><li><less name=&quot;online_call&quot; </li></ul><ul><li>require=&quot;generic presence ui&quot;> </li></ul><ul><li><notification status=&quot; online &quot; priority=&quot;0.5&quot;> </li></ul><ul><li><address-switch field=&quot;origin&quot;> </li></ul><ul><li><address is=“ [email_address] &quot;> </li></ul><ul><li>< call /> </li></ul><ul><li>< alert sound=“; </li></ul><ul><li> text=&quot;Calling …&quot; /> </li></ul><ul><li></address> </li></ul><ul><li></address-switch> </li></ul><ul><li></notification> </li></ul><ul><li></less> </li></ul>
    32. 32. Network call control <ul><li>Common gateway interface -- SIP-CGI (RFC 3050) </li></ul><ul><li>Call processing language -- CPL (XML-based, allows GUI) </li></ul><ul><li>SIP servlets (Java) </li></ul> SIP_FROM SIP_TO stdin CGI-PROXY-REQUEST stdout SIP proxy Urgent Low-priority Voicemail Phone if (defined $ENV{SIP_FROM} && $ENV{ SIP_FROM } =~ /sip: boss@ { foreach $reg (get_regs()) { print &quot;CGI-PROXY-REQUEST $reg SIP/2.0 &quot;; print &quot; Priority: urgent &quot;; } }
    33. 33. Call transfer <ul><li>REFER </li></ul><ul><li>Blind/ consultation/ attended </li></ul>active call REFER C Referred-By: B INVITE C Referred-By: B BYE A A B C active call
    34. 34. B2BUA and third-party call control <ul><li>Back-to-back UA </li></ul><ul><ul><li>Incoming call triggers outgoing call </li></ul></ul><ul><li>Services </li></ul><ul><ul><li>Calling card </li></ul></ul><ul><ul><li>Anonymizer </li></ul></ul>INVITE A B C OK (SDP1) ACK INVITE (SDP1) OK (SDP2) ACK INVITE (SDP2) OK ACK SIP SIP
    35. 35. Voicemail <ul><li>Various design alternatives </li></ul> SIP_FROM SIP_TO stdin CGI-PROXY-REQUEST stdout If no response Proxy controls accept after 15s Voicemail acts like a phone [email_address] Redirect after 10s Endpoint based
    36. 36. Interactive voice response using VoiceXML Telephone PSTN IVR platform <ul><li>Voice and telephony functions </li></ul><ul><li>(ASR, TTS, DTMF) </li></ul><ul><li>Service logic (application specific) </li></ul>VXML Browser Gateway Voice gateway Web server <ul><li>Service logic (CGI, servlet, JSP) </li></ul><ul><li>Voice and telephony functions </li></ul><ul><li>VoiceXML browser </li></ul>Internet user VXML HTML Internet
    37. 37. VoiceXML contd. <form action=“url”> Enter your Id: < input name=‘id’> <input type=‘submit’> </form> <form> < field name=‘id’> <prompt> Your ID, please. </prompt> </field> <block> <submit next=“url”/> </block> </form> Telephony, speech synthesis or audio output, user input and grammar, program flow, variable and properties, error handling, …
    38. 38. DTMF Telephone SIP/PSTN gateway PSTN Internet Internet user D D Audio SIP INFO RTP/ RFC2833
    39. 39. Interworking with telephone network <ul><li>Translating audio (µ-law/A-law) </li></ul><ul><li>Translating signaling (PRI/T1,ISUP) </li></ul><ul><ul><li>Overlap signaling </li></ul></ul><ul><ul><li>Advanced features in SIP are lost in PSTN </li></ul></ul><ul><li>Translating identifiers (phone number) </li></ul><ul><li>Determining transition points </li></ul>Telephone network SIP/PSTN gateway SIP server IP endpoint Telephone subscriber +1-415-123-4567 <ul><li>IP to telephone </li></ul><ul><li>Static mapping </li></ul><ul><ul><li>1-212854xxxx=> </li></ul></ul><ul><li>Gateway information is dynamic: </li></ul><ul><ul><li>Overlapping networks </li></ul></ul><ul><ul><li>Multiple providers </li></ul></ul><ul><ul><li>Load balancing </li></ul></ul><ul><li>Telephony routing over IP (TRIP) </li></ul><ul><ul><li>Route advertisement </li></ul></ul><ul><ul><li>Can be implemented in outbound proxy </li></ul></ul><ul><ul><li>Suitable for current hierarchical network </li></ul></ul><ul><ul><li>+1 at 4¢/min </li></ul></ul><ul><ul><li>+1212 at 1¢/min </li></ul></ul><ul><ul><li>+1212939 free </li></ul></ul><ul><li>Telephone to IP </li></ul><ul><li>Gateway knows the SIP server </li></ul><ul><ul><li><;user=phone> </li></ul></ul><ul><li>ENUM – E164 numbering (using DNS) </li></ul><ul><ul><li>+1 212 9397042 => => </li></ul></ul><ul><ul><li>Suitable for relatively “static” contacts </li></ul></ul>
    40. 40. Summary <ul><li>Introducing VoIP </li></ul><ul><ul><li>Basic audio transfer, why we need RTP and SIP/SDP?… </li></ul></ul><ul><li>Inside SIP </li></ul><ul><ul><li>Message format, addressing, building blocks, routing, transport, NAT traversal, … </li></ul></ul><ul><li>VoIP services using SIP </li></ul><ul><ul><li>Types of services, programmability, call transfer, third-party, voicemail, interactive voice response, telephone interworking, … </li></ul></ul>
    41. 41. VoIP activities <ul><li>IETF working groups: sip, sipping, mmusic, xcon, p2psip, simple, impp, iptel, enum, ecrit, avt, sigtran, midcom, … </li></ul><ul><li>Elsewhere: 3GPP, ITU-T, W3C, Jabber/XSF, ETSI-Tiphon, IMTC, sip-forum, VON, … </li></ul>
    42. 42. References <ul><li>SIP: RFC 3261-3265 </li></ul><ul><li>RTP: RFC 3550, 3551, </li></ul><ul><li>My thesis: (part III: Enterprise IP telephony) </li></ul><ul><li>Open source SIP server: </li></ul><ul><li>Free SIP accounts: http:// </li></ul>