Voice over IP (VoIP)

Download Report

Transcript Voice over IP (VoIP)

SIP/RTP/RTCP Implementation
by
George Fu, UCCS
CS 525 Semester Project
Fall 2006
Two Parts of the Project
• Understand SIP, RTP and RTCP
• Implement SIP, RTP and RTCP
Voice To/From IP
Analog
Voice
CODEC: Analog to Digital
Compress
Create Voice Datagram
Add Header
(RTP, UDP, IP, etc)
Digital
Network
ISO Reference Model and VoIP Standards
ISO Protocol layer
Protocols and standards
Presentation
Codecs / Applications
Session
H.323 / SIP / MGCP
Transport
RTP / TCP / UDP
Network
IP
Link
FR, ATM, Ethernet, PPP, etc.
SIP Messages – Methods and
Responses
SIP components communicate by exchanging SIP messages:
•SIP Methods:
– INVITE – Initiates a call by inviting user to
participate in session.
– ACK - Confirms that the client has received a
final response to an INVITE request.
– BYE - Indicates termination of the call.
– CANCEL - Cancels a pending request.
– REGISTER – Registers the user agent.
– OPTIONS – Used to query the capabilities of a
server.
– INFO – Used to carry out-of-bound information,
such as DTMF digits.
•SIP Responses:
–
–
–
–
–
–
1xx - Informational Messages.
2xx - Successful Responses.
3xx - Redirection Responses.
4xx - Request Failure Responses.
5xx - Server Failure Responses.
6xx - Global Failures Responses.
Example of SIP message
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 166.34.27.44
From: sip:[email protected]
To: sip:[email protected]
Call-ID: [email protected]
Content-Type: application/sdp
Content-Length: 885
c=IN IP4 166.34.27.44
m=audio 38060 RTP/AVP 0
•HTTP message
syntax
•sdp = session
description
protocol
•Call-ID is unique
for every call.
PC-to-PC
Call to a known Computer
Bob
Alice
167.180.112.24
INVITE bob
@193.64.2
10.89
c=IN IP4 16
7.180.112.2
4
m=audio 38
060 RTP/A
VP 0
193.64.210.89
port 5060
port 5060
Bob's
terminal rings
200 OK
.210.89
c=IN IP4 193.64
RTP/AVP 3
m=audio 48753
ACK
port 5060
m Law audio
time
• Bob’s 200 OK message
indicates his port number, IP
address & preferred encoding
(GSM)
• SIP messages can be sent
over TCP or UDP; here sent
over RTP/UDP.
port 38060
GSM
• Alice’s SIP invite message
indicates her port number &
IP address. Indicates
encoding that Alice prefers to
receive (PCM ulaw)
port 48753
time
•Default SIP port number is
5060.
Implementation
• Open All the Sockets in the Main Thread
sip_send_socket = socket (AF_INET, SOCK_DGRAM, 0);
rtp_send_socket = socket (AF_INET, SOCK_DGRAM, 0);
rtcp_send_socket = socket (AF_INET, SOCK_DGRAM, 0);
sip_receive_socket = socket (AF_INET, SOCK_DGRAM, 0);
rtp_receive_socket = socket (AF_INET, SOCK_DGRAM, 0);
rtcp_receive_socket = socket (AF_INET, SOCK_DGRAM, 0);
Implementation
• Separate Thread for RTP and RTCP
pthread_create(&child, NULL, send_RTP_RTCP, NULL);
• Use Select System Call to Make
SIP/RTP/RTCP/User Commands Send and
Receive all Work Simultaneously
Demo
Future Work
Delay
For high quality voice, one way latency must
not be greater than 150ms. Delay greater than
50ms leads to echo and talker overlap.
Jitter
Variation in inter-packet arrival time. The
solution to this problem is to introduce jitter
buffers.
Packet Loss
Loss in excess of 5-10% causes significant
degradation in voice quality.
Re-ordering
Packets may arrive out of order and this leads
to garbled speech.
Speech Coding
PCM, PCM uLaw, ADPCM, LPC, LDCELP, GSM
References
• U. Black, Voice over IP, 2nd ed., Prentice Hall, 2002
• J. Davidson and J. Peters, Voice over IP Fundamentals, Cisco Press, 2000
• Douskalis, IP Telephony. The Integration of Robust IP Services, Prentice
Hall, 2000.
• H. Liu and P. Mouchtaris, “Voice over IP Signaling: H.323 and Beyond,”
IEEE Comm. Mag., October 2000, pp. 142-148
• H. Schulzrinne and J. Rosenberg, The Session Initiation Protocol: InternetCentric Signaling,” IEEE Commun. Mag., Oct. 2000, pp. 134-141.
• RFC 1889: H. Schulzrinne et al, “RTP: A Transport Protocol for Real-Time
Applications”
• http://www.itpapers.com/techguide/voiceip.pdf
• http://www.cs.columbia.edu/sip/