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:email@example.com SIP/2.0
Via: SIP/2.0/UDP domain.com:5060;branch=z9hG4bK2df7b9194cd51e25
CSeq: 1 INVITE
<session description data, like RTP description>
SIP Server Types
||SIP server doesn't store any transaction info.
||SIP server creates and holds SIP commands transaction state.
||Allows users to register their locations and later to use that info to forward calls to registered contact.
||SIP server is like statefull + holds active calls state.(This is needed if call billing or full control of call is needed)
||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
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
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.