Click here to Skip to main content
15,879,474 members
Articles / Programming Languages / C#
Article

SIP Stack with SIP Proxy - (VOIP)

Rate me:
Please Sign up or sign in to vote.
4.86/5 (45 votes)
11 Jun 2007CPOL2 min read 1.6M   28.1K   162   354
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

INVITE sip:john@domain.com SIP/2.0
From: <sip:doe@domain.com>;tag=2084442460
To: <sip:john@1domain.com>
Via: SIP/2.0/UDP domain.com:5060;branch=z9hG4bK2df7b9194cd51e25
Call-ID: john@domain.com-4524j
CSeq: 1 INVITE
Contact: <sip:doe@domain.com:5060>
Content-Length: 226
Content-Type: application/sdp

<session description data, like RTP description>

SIP Server Types

statelessSIP server doesn't store any transaction info.
statefullSIP 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.
B2BUASIP 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:

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

Contact Details

License

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


Written By
Estonia Estonia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: When I get the '407' error? Pin
Ivar Lumi14-Sep-07 20:22
Ivar Lumi14-Sep-07 20:22 
GeneralRe: When I get the '407' error? Pin
UBQ16-Sep-07 18:27
UBQ16-Sep-07 18:27 
GeneralRe: When I get the '407' error? Pin
Ivar Lumi16-Sep-07 19:29
Ivar Lumi16-Sep-07 19:29 
GeneralRe: When I get the '407' error? Pin
UBQ17-Sep-07 21:41
UBQ17-Sep-07 21:41 
GeneralRe: When I get the '407' error? Pin
Ivar Lumi18-Sep-07 5:56
Ivar Lumi18-Sep-07 5:56 
GeneralRe: When I get the '407' error? Pin
UBQ18-Sep-07 23:28
UBQ18-Sep-07 23:28 
GeneralRe: When I get the '407' error? Pin
Ivar Lumi18-Sep-07 23:46
Ivar Lumi18-Sep-07 23:46 
GeneralRe: When I get the '407' error? Pin
lliaolx_guilin10-Jun-09 12:56
lliaolx_guilin10-Jun-09 12:56 
QuestionB2BUA Register ? Pin
LucianoNet10-Sep-07 9:07
LucianoNet10-Sep-07 9:07 
AnswerRe: B2BUA Register ? Pin
Ivar Lumi10-Sep-07 19:48
Ivar Lumi10-Sep-07 19:48 
GeneralRe: B2BUA Register ? Pin
LucianoNet11-Sep-07 3:43
LucianoNet11-Sep-07 3:43 
GeneralRe: B2BUA Register ? Pin
Ivar Lumi11-Sep-07 6:05
Ivar Lumi11-Sep-07 6:05 
QuestionURI Modify ? Pin
Lucio Souza Mello6-Sep-07 10:35
Lucio Souza Mello6-Sep-07 10:35 
AnswerRe: URI Modify ? Pin
Ivar Lumi10-Sep-07 19:51
Ivar Lumi10-Sep-07 19:51 
QuestionLicence is Free ? Pin
Lucio Souza Mello5-Sep-07 4:16
Lucio Souza Mello5-Sep-07 4:16 
AnswerRe: Licence is Free ? Pin
Ivar Lumi5-Sep-07 5:53
Ivar Lumi5-Sep-07 5:53 
QuestionPBX and RTP ? Pin
LucianoNet4-Sep-07 13:35
LucianoNet4-Sep-07 13:35 
AnswerRe: PBX and RTP ? Pin
Ivar Lumi4-Sep-07 19:53
Ivar Lumi4-Sep-07 19:53 
GeneralGreat, Display-Name & Nat enhancement Pin
AmrEmam3-Sep-07 0:15
AmrEmam3-Sep-07 0:15 
GeneralRe: Great, Display-Name & Nat enhancement Pin
Ivar Lumi4-Sep-07 7:17
Ivar Lumi4-Sep-07 7:17 
GeneralI need some clarifications Pin
karthikeyan_kk14-Aug-07 2:34
karthikeyan_kk14-Aug-07 2:34 
GeneralRe: I need some clarifications Pin
Ivar Lumi14-Aug-07 5:58
Ivar Lumi14-Aug-07 5:58 
Questionwhen use sip and rtp,how to through nat ? Pin
chenghua.li6-Jul-07 2:33
chenghua.li6-Jul-07 2:33 
AnswerRe: when use sip and rtp,how to through nat ? Pin
Ivar Lumi6-Jul-07 2:46
Ivar Lumi6-Jul-07 2:46 
GeneralRe: when use sip and rtp,how to through nat ? Pin
chenghua.li6-Jul-07 15:11
chenghua.li6-Jul-07 15:11 

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

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