Click here to Skip to main content
Click here to Skip to main content

SIP Stack with SIP Proxy - (VOIP)

, 11 Jun 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
C# implementation of SIP
Screenshot - proxy.jpg

SIP Overview

SIP is an application-layer control protocol that can establish, modify, and terminate multimedia sessions (conferences) such as Internet telephony calls. SIP can also invite participants to already existing sessions, such as multicast conferences. Normally SIP uses UDP and TCP port 5060 and TCP 5061 for SSL communication. SIP protocol is very similar to HTTP, so if you have some knowledge about HTTP, then it is easy to learn SIP. SIP doesn't transfer session data like audio, video. RTP(real time protocol) is used for that, SIP just helps to open RTP streams.

SIP Message Example

From: <>;tag=2084442460
To: <>
Via: SIP/2.0/UDP;branch=z9hG4bK2df7b9194cd51e25
Contact: <>
Content-Length: 226
Content-Type: application/sdp

<session description data, like RTP description>

SIP Server Types

stateless SIP server doesn't store any transaction info.
statefull SIP server creates and holds SIP commands transaction state.
registrar/location Allows users to register their locations and later to use that info to forward calls to registered contact.
B2BUA SIP server is like statefull + holds active calls state.(This is needed if call billing or full control of call is needed)
presence Provides user availability services, like if user is online,offline, ... .
... There are some more, but not so important ones.

Basic SIP Commands

  • INVITE - Initiates a session. This method includes information about the calling and called users and the type of media that is to be exchanged.
  • ACK - Sent by the client who sends the INVITE. ACK is sent to confirm that the session is established. Media can then be exchanged.
  • BYE - Terminates a session. This method can be sent by either user.
  • CANCEL - Terminates a pending request, such as an outstanding INVITE. After a session is established, a BYE method needs to be used to terminate the session.
  • OPTIONS - Queries the capabilities of the server or other devices. It can be used to check media capabilities before issuing an INVITE.
  • REGISTER - Used by a client to login and register its address with a SIP registrar server.

Ok, some ABC done, there are many documents on the internet, so it is not a good idea to rewrite these there.

If want more advanced information, then see:

SIP Proxy Demo Overview

This SIP proxy example just implements fully functional simple stateless, statefull, b2bua proxy. You can use hardware SIP phones or soft phones to play with this proxy.This is an advanced example, code is well commented, so beginners don't hate me because no more text here. Just read RFC 3216, see information links I noted earlier. After you go through those, if you then look at the code, it is all nicer then.

Some free available softphones are:

        *) Added B2BUA support.
        *) Many bug fixes. 
        *) SIP -> PSTN and PSTN -> SIP gateway support. 
        *) Non-SIP URI gateway support. 

Contact Details


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ivar Lumi

Estonia Estonia
No Biography provided

Comments and Discussions

GeneralRe: How to Register IP Phone ??? PinmemberIvar Lumi24-Aug-11 5:15 
GeneralRe: How to Register IP Phone ??? Pinmemberkelibox25-Aug-11 14:26 
QuestionHow to set enviroenment Pinmemberbliznak220-Jul-11 4:31 
Hi Ivar,
Recentlly I got a task to navigate phone calls done from voip adapter (using sip protocol). Your solution seems to be exellent, but I do not know how to connect and set all these things. I run your Sip Proxy demo on my comuter and create users [test1; test2] in Settings tab. After setting voip adapter [sip proxy=MyComputerIP; Line1=test1; Line2=test2], the lines are appeared in Registrations tab. Also in Gateways tab I added corectlly sip gateway ( or IP of the sip proxy), but I can not make a call. When I try to make a call there is a busy tone (Destination not found).
Please help me with this, Thanks
AnswerRe: How to set enviroenment PinmemberIvar Lumi20-Jul-11 20:11 
Generalvoip sip client with video Pinmemberwaelsys200724-May-11 2:33 
GeneralRe: voip sip client with video PinmemberIvar Lumi24-May-11 3:41 
GeneralA question about RTCP Pinmemberywchen8-Apr-11 16:17 
GeneralRe: A question about RTCP PinmemberIvar Lumi8-Apr-11 21:10 
GeneralRe: A question about RTCP Pinmemberywchen12-Apr-11 13:58 
GeneralRe: A question about RTCP PinmemberIvar Lumi12-Apr-11 20:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 11 Jun 2007
Article Copyright 2007 by Ivar Lumi
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid