Click here to Skip to main content
15,867,488 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

 
Generalsip_proxy_demo userguide Pin
nnch26-Sep-08 7:47
nnch26-Sep-08 7:47 
GeneralRe: sip_proxy_demo userguide Pin
Ivar Lumi26-Sep-08 7:49
Ivar Lumi26-Sep-08 7:49 
GeneralMultiproxy setup Pin
nnch26-Sep-08 6:55
nnch26-Sep-08 6:55 
GeneralRe: Multiproxy setup Pin
Ivar Lumi26-Sep-08 7:34
Ivar Lumi26-Sep-08 7:34 
GeneralUnregister Line using sipXtapidotnet api Pin
Atif Ali Bhatti21-Jul-08 1:21
Atif Ali Bhatti21-Jul-08 1:21 
GeneralRe: Unregister Line using sipXtapidotnet api Pin
Ivar Lumi21-Jul-08 7:36
Ivar Lumi21-Jul-08 7:36 
GeneralRe: Unregister Line using sipXtapidotnet api Pin
Atif Ali Bhatti21-Jul-08 19:16
Atif Ali Bhatti21-Jul-08 19:16 
GeneralNot able to run proxy Pin
sparadkar111-Jul-08 8:40
sparadkar111-Jul-08 8:40 
GeneralRe: Not able to run proxy Pin
Ivar Lumi12-Jul-08 6:05
Ivar Lumi12-Jul-08 6:05 
GeneralCompiling Source code [modified] Pin
sparadkar128-Jun-08 16:45
sparadkar128-Jun-08 16:45 
GeneralRe: Compiling Source code Pin
Ivar Lumi28-Jun-08 21:10
Ivar Lumi28-Jun-08 21:10 
GeneralRe: Compiling Source code Pin
sparadkar15-Jul-08 5:00
sparadkar15-Jul-08 5:00 
QuestionNew to Net Sip... Pin
Jim7715-May-08 0:08
Jim7715-May-08 0:08 
AnswerRe: New to Net Sip... Pin
Ivar Lumi15-May-08 0:39
Ivar Lumi15-May-08 0:39 
GeneralRe: New to Net Sip... Pin
Jim7715-May-08 1:01
Jim7715-May-08 1:01 
GeneralRe: New to Net Sip... Pin
Ivar Lumi15-May-08 1:06
Ivar Lumi15-May-08 1:06 
GeneralRe: New to Net Sip... Pin
Jim7715-May-08 1:18
Jim7715-May-08 1:18 
GeneralRe: New to Net Sip... Pin
Ivar Lumi15-May-08 1:22
Ivar Lumi15-May-08 1:22 
GeneralRe: New to Net Sip... Pin
Jim7715-May-08 1:28
Jim7715-May-08 1:28 
Questionhi Pin
loayking5-May-08 21:02
loayking5-May-08 21:02 
QuestionHow to send Notify SIP message to Softswitch? Pin
MyRitu1-Apr-08 1:16
MyRitu1-Apr-08 1:16 
AnswerRe: How to send Notify SIP message to Softswitch? Pin
Ivar Lumi1-Apr-08 2:53
Ivar Lumi1-Apr-08 2:53 
GeneralRe: How to send Notify SIP message to Softswitch? Pin
MyRitu1-Apr-08 3:00
MyRitu1-Apr-08 3:00 
GeneralRe: How to send Notify SIP message to Softswitch? Pin
Ivar Lumi1-Apr-08 3:23
Ivar Lumi1-Apr-08 3:23 
Question404 - Not found Pin
blueimage20-Dec-07 11:00
blueimage20-Dec-07 11:00 

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.