What is Internet Telephony Kundan Singh Dec 2010

  • Slides: 50
Download presentation
What is Internet Telephony? Kundan Singh Dec 2010 http: //kundansingh. com kundan 10@gmail. com

What is Internet Telephony? Kundan Singh Dec 2010 http: //kundansingh. com kundan 10@gmail. com This presentation is a subset of http: //www. slideshare. net/kundan 10/sip-for-geeks

Who am I? Ph. D from Columbia University in 2006 on reliable, scalable &

Who am I? Ph. D from Columbia University in 2006 on reliable, scalable & interoperable Internet telephony Student of Prof. Henning Schulzrinne who is co-inventor of SIP, RTSP Worked at Adobe with Dr. Henry Sinnreich who is considered God Father of SIP Worked on SIP systems since 1999, building prototypes, systems. Worked at Tokbox and 6 Connex on web-based video communication Worked on open source projects p 2 p-sip, videocity, flash-videoio, restlite, rtmplite, siprtmp Vo. IP researcher Software architect Software engineer

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting On Web NAT traversal Walled garden What is the big picture? How does everything fit together?

Audio packet transfer … – Digitization (e. g. , sampling at 8 k. Hz,

Audio packet transfer … – Digitization (e. g. , sampling at 8 k. Hz, 16 bits per sample, i. e, 128 kb/s or 320 bytes per 20 ms) – Real-time compression/encoding (e. g. , G. 729 A at 8 kb/s) – Transport to remote IP address and port number over UDP (Why not TCP? ) – Processing on receiver side is the reverse

Sampling, Quantization, Encoding +127 10101111… 01101101 Encode each quantized sample into 8 bit code

Sampling, Quantization, Encoding +127 10101111… 01101101 Encode each quantized sample into 8 bit code word +0 PCM: 8000 x 8 bits = 64 kb/s Others: 2. 4 to 64 kb/s -127 What is Nyquist’s rate? Why 8000 Hz sampling? What is narrowband/wideband? Round off samples to one of 256 levels (introduces What are frame vs sample-based noise) codecs?

Signal Processing Techniques q What is lossless vs lossy? q What is speech vs

Signal Processing Techniques q What is lossless vs lossy? q What is speech vs full-frequency encoding? q What are Fourier Transform and MDCT? q What is differential coding? q What is linear prediction? q What is algorithmic delay? What is frame size? q What are CBR, ABR, VBR? q What are filtering, noise cancellation and AGC? q What are silence suppression and VAD? q What are echo suppression and reverb removal? q What is comfort noise? q What is forward error correction?

Voice codecs Codecs Bitrate kb/s Use cases G. 711 64 Phone, PSTN G. 729

Voice codecs Codecs Bitrate kb/s Use cases G. 711 64 Phone, PSTN G. 729 8 Vo. IP, carriers G. 723. 1 5. 3/6. 3 Vo. IP, modem G. 722. 2 6 -24 Wideband Vo. IP, mobile Speex 2 -44 Good quality, free, Flash Player i. LBC 13. 3/15. 2 Free, low bit-rate, SILK 6 -40 Skype, open source i. SAC 10 -32 Global IP sound (GIPS), Gtalk

Problems with UDP timeline Sender 1 2 3 4 5 6 7 (a) 1

Problems with UDP timeline Sender 1 2 3 4 5 6 7 (a) 1 2 Receiver Unreliable UDP a) Packet loss b) Out-of-order (very rarely) c) Jitter (delay variation) (b) 3 5 7 6

Playout buffer read microphone write speaker 20 ms packet sendto(remote IP: port) get put

Playout buffer read microphone write speaker 20 ms packet sendto(remote IP: port) get put while (true) { Received packet recvfrom() buf = read(au, 20 ms); //blocks if (!silence) playout buffer sendto(remote, buf); … } while (true) { buf = get(20 ms); buf = recvfrom(. . . ); // blocks write(au, buf); put(buf); }

Playout buffer – – What is the its purpose? What should be the buffer

Playout buffer – – What is the its purpose? What should be the buffer size? How to do adaptive delay adjustment? Why do you need sequence number? Sender 1 2 3 1 4 5 2 6 8 7 3 5 9 7 0 1 8 6 2 9 3 0 4 2 3 4 Receiver 3 2 1 1 2 1 7 2 1 5 2 3 5 7 6 8 7 9 8 0 9 2 0 3 2 http: //citeseerx. ist. psu. edu/viewdoc/summary? doi=10. 1. 1. 54. 9716

Timestamp vs sequence number Playout time vs packet loss detection Sender t 1 t

Timestamp vs sequence number Playout time vs packet loss detection Sender t 1 t 2 t 3 1 2 t 4 t 5 Silence … 3 t 6 t 7 4 5 t 8 t 9 6 7 4 5 6 7 Receiver • Silence suppression • Variable length packets

Real-time Transport Protocol (RTP) IP header UDP header 8 bits V PX CC 8

Real-time Transport Protocol (RTP) IP header UDP header 8 bits V PX CC 8 bits 16 bits M Payload type Sequence number Timestamp (proportional to sampling time) RTP Header msg Encoded Audio sendto(…, msg, …) recvfrom(…, msg, …) Source identifier (SSrc) Optional contributors’ list (CSrc) RTP: media transport RTCP: Qo. S feedback

RTP FAQ – Who uses RTP? – Is RTP a transport or application protocol?

RTP FAQ – Who uses RTP? – Is RTP a transport or application protocol? – Is RTP secure? What are SRTP, ZRTP? – Is RTP header a big overhead? – Is RTCP needed for two-party voice calls? http: //www. cs. columbia. edu/~hgs/rtp/

Why do you need signaling? 0 : 800 t 202 9. 27. 16. 4

Why do you need signaling? 0 : 800 t 202 9. 27. 16. 4 29 a d G. 7 a E for T I V IN sing call u an µ-law is. 2 Al. 3 ice? re. 1 he 92 W>1 Bob= OK u sin gµ -la wa t 1 28 . 59 . 19 Alice=> 128. 59. 194 . 3 5 12 15 => am . 3 Alice 128. 59. 194 ry 8 4. 2 12 1. 2 n He Bob 202. 16. 49. 27 . 19 4. 194 128. 59 1. 8 2 3. S Sam 154. 28. 32. 112 1. Locate destination user 2. Negotiate session parameters Henry 125. 33. 2. 81

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting On Web NAT traversal Walled garden

HTTP SIP GET, POST, HEAD, PUT, DELETE REGISTER, INVITE, BYE, CANCEL, ACK, OPTIONS, …

HTTP SIP GET, POST, HEAD, PUT, DELETE REGISTER, INVITE, BYE, CANCEL, ACK, OPTIONS, … Text-based protocol Request-response Headers and body RTSP SMTP SETUP, TEARDOWN, PLAY, RECORD, DESCRIBE, … HELO, MAIL, RCPT, DATA, QUIT

Addressing yahoo. com alice 24@yahoo. com tel: 12125551234 alice@columbia. edu 1234@columbia. edu Alice. Smith@columbia.

Addressing yahoo. com alice 24@yahoo. com tel: 12125551234 alice@columbia. edu 1234@columbia. edu Alice. Smith@columbia. edu What is address-of-record (Ao. R)? What is sips URI? What is tel URI? – RFC 3966 columbia. edu tel: 19172223333 pc 12. columbia. edu Examples: “Alice Smith” <sip: alice@columbia. edu> sip: alice@128. 59. 194: 5070 sip: alice@columbia. edu; user=phone; transport=tcp

Lookup Two stage lookup similar to email: office. com DNS: to locate server for

Lookup Two stage lookup similar to email: office. com DNS: to locate server for a domain Database: locate user within a domain Bob home. com columbia. edu yahoo. com Alice 128. 59. 194 Jane 128. 59. 19. 61 $ dig –t naptr columbia. edu. 3600 IN NAPTR 1 0 "s" "SIP+D 2 U" "" _sip. _udp. columbia. edu. 3600 IN NAPTR 2 0 "s" "SIP+D 2 T" "" _ sip. _tcp. columbia. edu. $ dig –t srv _sip. _udp. columbia. edu. 3600 IN SRV 10 10 5060 cocoa. cc. columbia. edu. _sip. _udp. columbia. edu. 3600 IN SRV 10 10 5060 eclair. cc. columbia. edu. $ dig –t a cocoa. cc. columbia. edu. 3600 IN A 128. 59. 199 How to do failover and load sharing?

INVITE sip: alice@home. com SIP/2. 0 Via: SIP/2. 0/UDP 202. 16. 49. 27: 5060;

INVITE sip: alice@home. com SIP/2. 0 Via: SIP/2. 0/UDP 202. 16. 49. 27: 5060; branch=z 9 h. G 4 b. K 74 bf 9 Max-Forwards: 70 From: “Bob” <bob@office. com>; tag=9 fxced 76 s 1 To: “Alice” <alice@home. com> Call-ID: 384827@202. 16. 49. 27 CSeq: 1 INVITE Contact: <sip: bob@202. 16. 49. 27> Subject: How are you? Content-Type: application/sdp Content-Length: 151. . . Request Response SIP/2. 0 200 OK Via: SIP/2. 0/UDP 202. 16. 49. 27: 5060; branch=z 9 h. G 4 b. K 74 bf 9 From: “Bob” <bob@office. com>; tag=9 fxced 76 s 1 To: “Alice” <alice@home. com>; tag=8321234356 Call-ID: 384827@202. 16. 49. 27 CSeq: 1 INVITE Contact: <sip: alice@128. 59. 194> Content-Type: application/sdp Content-Length: 147. . . What are WS and CRLF?

Requests Purpose Method Reference Establish a SIP session with offer/answer INVITE RFC 3261 Acknowledge

Requests Purpose Method Reference Establish a SIP session with offer/answer INVITE RFC 3261 Acknowledge a response to INVITE ACK Cancel a pending request CANCEL Terminate an existing SIP session BYE Query the capabilities of server or UA OPTIONS Temporarily bind Ao. R to device URI REGISTER Establish a session to receive updates SUBSCRIBE Deliver updates in a subscribed session NOTIFY Upload status to a server PUBLISH RFC 3903 Ask another UA to act upon a URI REFER RFC 3515 Transport an instant message (IM) MESSAGE RFC 3428 Update session state information UPDATE RFC 3311 Acknowledge a provisional response PRACK RFC 3262 Transport mid-call signaling data INFO RFC 2976 RFC 3265

Responses Class Code Examples Provisional 1 xx 100 Trying 180 Ringing 183 Session Progress

Responses Class Code Examples Provisional 1 xx 100 Trying 180 Ringing 183 Session Progress Success 2 xx 200 OK 202 Accepted Redirection 3 xx 300 Moved 302 Multiple Choices Client error 4 xx 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 486 Busy Here Server error 5 xx 501 Not Implemented 503 Service Unavailable Global error 6 xx 600 Busy Everywhere 603 Decline

Header examples Name Purpose Reference Alert-Info Customized ringing RFC 3261 Record-Route Proxy will stay

Header examples Name Purpose Reference Alert-Info Customized ringing RFC 3261 Record-Route Proxy will stay in SIP signaling path Supported List of supported extensions Replaces Call control, transfer, pickup RFC 3891 Join Conferencing RFC 3911 Reason for failure response RFC 3326 Event Associated event package RFC 3265 Referred-By Third-party who initiated the request RFC 3892

Example call flow Proxy UA SIP office. com trapezoid home. com alice@home. com bob@office.

Example call flow Proxy UA SIP office. com trapezoid home. com alice@home. com bob@office. com INVITE 100 Trying UA INVITE 100 Trying 180 Ringing 200 OK ACK RTP media session BYE 200 OK What is an outbound proxy?

Message routing Response follows the reverse request path – Via header in SIP message

Message routing Response follows the reverse request path – Via header in SIP message records the request path Via: a. home. com alice@home. com Via: b. example. com Via: a. home. com Via: c. yahoo. com Via: b. example. com Via: a. home. com bob@yahoo. com bob@ip 2. yahoo. com Via: b. example. com Via: a. home. com bob@example. com Request routing decision at each hop – Usually direct end-to-end transport after initial request – Forcing request path: Record-route and Route headers. – Request forking: parallel vs sequential (use qvalue in Contact) – Caller and callee info: further govern request routing q=1. 0 ed INVITE 2 30 v mo q=0. 7 486 busy 20 0 OK q=0. 2

Example call setup Alice (9) ok @residence. net (8) (10) @visiting. com (13) (6)

Example call setup Alice (9) ok @residence. net (8) (10) @visiting. com (13) (6) unavailable (7) (6) (5) (3) invite (4) moved (12) ok Bob @home. com @school. edu (2) moved (6) (11) cancel (1) invite @yahoo. com @lab. school. edu

Elements • SIP user agent • Maintaining state – IP phone, PC, conference bridge,

Elements • SIP user agent • Maintaining state – IP phone, PC, conference bridge, … • SIP redirect server – returns new location for requests • SIP stateless proxy – routes call requests • SIP (forking) stateful proxy – routes call requests • SIP registrar – accepts name to address mapping • Location server – maintains name to address mapping Typically implemented in a single software or box – stateless: each request and each response handled independently • Fast load balancing proxies; robust – (transaction) stateful: remember a whole request/response transaction • Enterprise servers, . . . – call stateful: remember a call from beginning to end • Billing, NAT traversal, . . . Other entities: outbound proxy, back-toback user agent (b 2 bua), application-levelgateway (ALG), …

SIP FAQ – – – What is a SIP transaction? What is a SIP

SIP FAQ – – – What is a SIP transaction? What is a SIP dialog? What is early media? What is re-INVITE? Why do you need record-route? What is request forking? http: //www. cs. columbia. edu/sip/

Session negotiation INVITE alice@home. com I can support -law and G. 729 Send me

Session negotiation INVITE alice@home. com I can support -law and G. 729 Send me audio at 202. 16. 49. 27: 6780 Bob 202. 16. 49. 27 Alice 128. 59. 194 OK; I can support -law Send me audio at 128. 59. 194: 8000 ACK RTP To port 8000 To port 6780 RTP How to modify media session?

Session Description Protocol (SDP) INVITE sip: alice@home. com SIP/2. 0. . . Content-Type: application/sdp

Session Description Protocol (SDP) INVITE sip: alice@home. com SIP/2. 0. . . Content-Type: application/sdp Content-Length: 151 v=0 o=bob 26172 27162 IN IP 4 202. 16. 49. 27 s=c=IN IP 4 202. 16. 49. 27 t=0 0 m=audio 6780 RTP/AVP 0 8 5 97 98 a=rtpmap: 97 i. LBC/8000 a=rtpmap: 98 telephone-event/8000 m=video 6790 RTP/AVP 31 What is offer/answer? What is telephone-event?

SIP is…, SIP is not … • • Core protocol for establishing sessions Allows

SIP is…, SIP is not … • • Core protocol for establishing sessions Allows transport of session description Allows change of parameters in mid-session Terminate session SIPdistribution applications typically fall in following NOT for of multimedia data categories: ü setting up Vo. IP calls NOT suitable for media gateway control ü setting up multimedia conferences. . . ü event notification => IM and presence ü text and general messaging ü signaling transport

What is the real value in SIP? ü Open system ü Advanced services

What is the real value in SIP? ü Open system ü Advanced services

Telephony Internet Call routing speed dial, call forwarding, “follow me”, filtering/blocking (in/out), do-not-disturb, distinctive

Telephony Internet Call routing speed dial, call forwarding, “follow me”, filtering/blocking (in/out), do-not-disturb, distinctive ringing, … Call handling auto-answer, auto-attendant, voice-mail, … Multi-party call waiting, call transfer (blind/consultative), conference call, park, pickup, music-onhold, monitoring, … Presence enabled place call only if callee is available, invite participants when all are online and not busy, … Unified messaging receive email, IM alert for new voice mail, or when someone joins your conference, … Web enabled click-to-call, web conference, view conference status and voice-mails on web, … what phone has is not enough! Programmable services

Programming services If somebody is calling the third-time, allow mobile. Try office and home

Programming services If somebody is calling the third-time, allow mobile. Try office and home in parallel, if that fails, try home. Allow call to mobile if I’ve talked to person before. If on tele-marketing list, forward to dial-a-joke. Try office during day, and mobile in evening. …

Where do the services reside? Double ringing sound when boss calls… Enter your authentication

Where do the services reside? Double ringing sound when boss calls… Enter your authentication PIN for billing… B 2 BUA Make call when boss is online … Endpoint Use finger for locating user… Proxy/registrar Forward to office phone during day, and home phone during evening… Service control in endpoint vs network? Endpoint

Endpoint call control • Language for End System Services (LESS) • Direct user interaction,

Endpoint call control • Language for End System Services (LESS) • Direct user interaction, direct media control • Handle converged information, e. g. , call, presence, email Example: call a friend when he comes online <less name="online_call" require="generic presence ui"> <notification status="online" priority="0. 5"> <address-switch field="origin"> <address is=“alice@home. com"> <call /> <alert sound=“ring. au" text="Calling …" /> </address-switch> </notification> </less>

Network call control SIP-CGI RFC 3050, CPL, servlets Priority. pl SIP_FROM SIP_TO stdin CGI-PROXY-REQUEST

Network call control SIP-CGI RFC 3050, CPL, servlets Priority. pl SIP_FROM SIP_TO stdin CGI-PROXY-REQUEST stdout if (defined $ENV{SIP_FROM} && $ENV{SIP_FROM} =~ /sip: boss@mycompany. com/) { foreach $reg (get_regs()) { print "CGI-PROXY-REQUEST $ reg SIP/2. 0n"; Urgent SIP proxy print "Priority: urgentnn"; Phone Low-priority Voicemail } }

B 2 BUA and 3 pcc B Back-to-back UA – Incoming call triggers outgoing

B 2 BUA and 3 pcc B Back-to-back UA – Incoming call triggers outgoing call A SIP INVITE OK (SDP 1) ACK Services – Calling card – Anonymizer C SIP INVITE (SDP 1) OK (SDP 2) INVITE (SDP 2) OK ACK

Voice. XML Gateway PSTN Telephone VXML Browser Internet HTML Internet user Voice gateway VXML

Voice. XML Gateway PSTN Telephone VXML Browser Internet HTML Internet user Voice gateway VXML 1. Voice and telephony functions 2. Voice. XML browser IVR platform • Voice and telephony functions (ASR, TTS, DTMF) • Service logic (application specific) Web server Service logic (CGI, servlet, JSP)

Voice. XML contd. <form action=“url”> Enter your Id: <input name=‘id’> <input type=‘submit’> </form> <field

Voice. XML contd. <form action=“url”> Enter your Id: <input name=‘id’> <input type=‘submit’> </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, …

Interworking with telephone sip: bob@home. com +1 -415 -123 -4567 Telephone subscriber Telephone network

Interworking with telephone sip: bob@home. com +1 -415 -123 -4567 Telephone subscriber Telephone network SIP/PSTN gateway SIP server IP endpoint • Translating Telephone to IP IP to telephone audio (µ-law/A-law) Static mapping Gateway knows the SIP server • Translating signaling (PRI/T 1, ISUP) – 1 -212854 xxxx=>@gw 1. columbia. edu – <sip: 4567@gateway 2. example. com; user=phone> – Overlap signaling Gateway information is dynamic: – Overlapping networks, multiple providers, ENUM – E 164 numbering (using DNS) – Advanced features in SIPLoad arebalancing lost in PSTN – +1 212 9397042 => – Telephony routing over IP (TRIP) => • Translating identifiers number) –(phone Route advertisement, can be implemented sip: hgs@cs. columbia. edu in outbound proxy, suitable for current • Determining Suitable for relatively “static”transition points hierarchical network 2. 4. 0. 7. 9. 3. 9. 2. 1. e 164. arpa contacts +1 @service. mci. com at 4¢/min +1212 @nyc. gw. com at 1¢/min +1212939 @itgw 1. columbia. edu free

Summary of services • • Call forwarding: basic INVITE behavior Call transfer: REFER method

Summary of services • • Call forwarding: basic INVITE behavior Call transfer: REFER method Call hold: set media to 0. 0 Caller id: From, plus extensions DTMF carriage: carry as RTP (RFC 2833) Calling card: B 2 BUA + voice server Voicemail: UA, proxy, media server Programming: CGI, CPL, servlet, LESS, CCXML, Voice. XML, SECE, …

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting

What will you learn? Voice Signaling Challenges Sampling Encoding Transport Call flow Extensions Scripting On Web NAT traversal Walled garden

Java. Script API

Java. Script API

siprtmp. py in action

siprtmp. py in action

Browser HTML × Device capture × Real-time codecs × E 2 E UDP media

Browser HTML × Device capture × Real-time codecs × E 2 E UDP media Flash Player × × H. 264 Video encoder Echo cancellation UDP media Server socket Cloud Hosted & elastic – – – Utility billing Programmable IVR Conferencing Recording/playback Accounting Tracking Phone – Voice, SMS, …

Peer-to-peer ≠ cloud computing • • Self management Free resource sharing No central co-ordination

Peer-to-peer ≠ cloud computing • • Self management Free resource sharing No central co-ordination … • • Self management Utility computing Central co-ordination … managed

NAT traversal Solutions: Problem: Smart servers iptel. org INVITE alice@ – SER allows detecting

NAT traversal Solutions: Problem: Smart servers iptel. org INVITE alice@ – SER allows detecting nodes behind a NAT – Use application level gateway and media-proxy SIP Signaling E=128. 59. 194: 8123 REGISTER alice@iptel. org Contact: sip: alice@10. 1. 2. 3: 5060. . . L=10. 1. 2. 3: 5060 – Symmetric response routing for UDP (rport) – Connection reuse for TCP/TLS (sip-outbound) Media – STUN: Simple traversal of UDP through NAT – TURN: Traversal using relay NAT – ICE: Interactive connectivity establishment

SIP is just a tool! How do you use it? Open house vs walled

SIP is just a tool! How do you use it? Open house vs walled garden

ITU-T’s H. 323 IETF’s SIP Managed “services” Legacy of telecom network Complex integrated spec

ITU-T’s H. 323 IETF’s SIP Managed “services” Legacy of telecom network Complex integrated spec End-to-end principle Inspired by Internet & web One task for one protocol Winner among Vo. IP carriers, mobile operators, and digital voice providers Terminal Control/Devices Jabber/XMPP Codecs H. 245 RAS RTCP Jingle for session initiation RTP TPKT many SIP features Re-uses TCP UDP Q. 931 IP and lower layers Proprietary Terminal Control/Devices Codecs RTCP Adobe’s SIP SDP RTMFP, RTP Skype, Yahoo, MSN, Cisco’s Skinny, … Transport Layer

What do I do? q IP telephony signaling and applications q Technology demonstration by

What do I do? q IP telephony signaling and applications q Technology demonstration by open source q Web communications and peer-to-peer IP telephony