Click here to Skip to main content
Licence CPOL
First Posted 20 Mar 2007
Views 387,922
Downloads 7,604
Bookmarked 131 times

SIP Stack with SIP Proxy - (VOIP)

By Ivar Lumi | 11 Jun 2007
C# implementation of SIP
1 vote, 2.8%
1
2 votes, 5.6%
2

3
5 votes, 13.9%
4
28 votes, 77.8%
5
4.89/5 - 36 votes
3 removed
μ 4.51, σa 1.71 [?]
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

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:

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)

About the Author

Ivar Lumi



Estonia Estonia

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralRe: need help for SIP to PSTN call PinmemberIvar Lumi1:10 8 May '10  
GeneralRe: need help for SIP to PSTN call PinmemberASGuru1:16 8 May '10  
GeneralRe: need help for SIP to PSTN call PinmemberASGuru21:35 10 May '10  
Questionhow much client we can connect? PinmemberASGuru22:12 23 Apr '10  
GeneralConfused about the basic settings Pinmemberfilipcz7:16 19 Apr '10  
Generalthe size of source code Pinmembersntslm18:08 22 Mar '10  
GeneralSample is not working properly.,. Pinmembersajithkalady1:40 19 Mar '10  
Am not able to run the server. The log showing below given error :
 

 
Received (489 bytes): 192.168.1.43:5060 <- 192.168.1.43:3363
REGISTER sip:192.168.1.43 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.43:16504
Max-Forwards: 70
From: <sip:1000@192.168.1.43>;tag=4630f16796754b3e83ab97138f51bcf5;epid=c43c95ac07
To: <sip:1000@192.168.1.43>
Call-ID: c15644c8b2634b08999b8553a44f71a4@192.168.1.43
CSeq: 1 REGISTER
Contact: <sip:192.168.1.43:16504>;methods="INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER"
User-Agent: RTC/1.2.4949
Event: registration
Allow-Events: presence
Content-Length: 0
 

 

Invalid request: Via: header field branch parameter is missing !
 
Sending (363 bytes): 192.168.1.43:5060 -> 192.168.1.43:16504
<begin>
SIP/2.0 400 Bad Request. Via: header field branch parameter is missing !
Via: SIP/2.0/UDP 192.168.1.43:16504
From: <sip:1000@192.168.1.43>;tag=4630f16796754b3e83ab97138f51bcf5;epid=c43c95ac07
To: <sip:1000@192.168.1.43>
Call-ID: c15644c8b2634b08999b8553a44f71a4@192.168.1.43
CSeq: 1 REGISTER
Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,PRACK
Content-Length: 0
 
<end>
 

Received (489 bytes): 192.168.1.43:5060 <- 192.168.1.43:3363
REGISTER sip:192.168.1.43 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.43:16504
Max-Forwards: 70
From: <sip:1000@192.168.1.43>;tag=4630f16796754b3e83ab97138f51bcf5;epid=c43c95ac07
To: <sip:1000@192.168.1.43>
Call-ID: c15644c8b2634b08999b8553a44f71a4@192.168.1.43
CSeq: 2 REGISTER
Contact: <sip:192.168.1.43:16504>;methods="INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER"
User-Agent: RTC/1.2.4949
Event: registration
Allow-Events: presence
Content-Length: 0
 

 

Invalid request: Via: header field branch parameter is missing !
 
Sending (363 bytes): 192.168.1.43:5060 -> 192.168.1.43:16504
<begin>
SIP/2.0 400 Bad Request. Via: header field branch parameter is missing !
Via: SIP/2.0/UDP 192.168.1.43:16504
From: <sip:1000@192.168.1.43>;tag=4630f16796754b3e83ab97138f51bcf5;epid=c43c95ac07
To: <sip:1000@192.168.1.43>
Call-ID: c15644c8b2634b08999b8553a44f71a4@192.168.1.43
CSeq: 2 REGISTER
Allow: INVITE,ACK,OPTIONS,CANCEL,BYE,PRACK
Content-Length: 0
 
<end>
Generalthanks from PH Pinmembermdingalla21:09 18 Oct '09  
GeneralGeneral comment Pinmembermapick7:36 3 Oct '09  
GeneralSIP Client Pinmemberbinnibinni3:53 2 Oct '09  
GeneralRe: SIP Client PinmemberIvar Lumi4:00 2 Oct '09  
GeneralRe: SIP Client Pinmemberbinnibinni4:04 2 Oct '09  
QuestionUDP to TCP UA Pinmemberrudacunhasilva7:34 24 Aug '09  
QuestionSIP TCP Pinmemberrudacunhasilva15:48 20 Aug '09  
QuestionSIP_Gateway Pinmemberrudacunhasilva11:15 18 Aug '09  
AnswerRe: SIP_Gateway PinmemberIvar Lumi20:36 18 Aug '09  
QuestionHow to run both SIP Proxy and a client in the same computer? Pinmemberkaiwnyt16:36 10 Jul '09  
AnswerRe: How to run both SIP Proxy and a client in the same computer? PinmemberIvar Lumi21:25 12 Jul '09  
GeneralRe: How to run both SIP Proxy and a client in the same computer? Pinmemberkaiwnyt18:32 14 Jul '09  
QuestionSystem.IndexOutOfRangeException: Pinmembergokhanuslu5:18 17 Jun '09  
Generalis there is client Pinmemberel3ashe23:54 11 Jun '09  
GeneralRe: is there is client PinmemberIvar Lumi7:32 11 Jun '09  
GeneralRe: is there is client Pinmemberel3ashe223:42 13 Jun '09  
GeneralRe: is there is client PinmemberIvar Lumi20:52 14 Jun '09  
GeneralRe: is there is client Pinmemberel3ashe22:54 15 Jun '09  

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.

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