In this article, I have presented the creation of SIP messages and its parsing on the basis of RFC 3261 specification for Session Initiation Protocol (SIP ).
In RFC 3261 specification, there are many modules that need to implement to work with SIP e.g SIP User Agent ( UA ), User Agent Client ( UAC ), User Agent Server( UAS ),
SIP Client Transaction, SIP Server Transaction, Dialog, SIP Parsing, SIP Transport etc. Hence I thought to develop all these modules based on SIP 3261 specification in the form
of libraries and share with the people who really working on SIP for implementing VOIP related applications. And therefore I am creating libraries named as SIP Stack.
The SIP Stack mainly consist of 3 parts.
- SIP Parsers - Included in this article.
- SIP Core Modules - Will be included in Part 2.
- SIP Soft Phone - Will be included in Part 3.
This article of SIP Stack implements the parsing and the composition of SIP message's headers which are in the form of Augmented Backus-Naur Form (BNF) for the SIP Protocol.
Using the code
To use this code, following are the open source libraries requires for its compilation.
- Boost Libraries Version 1.48.0 - Ensure to compile it with VC 2010.
- POSIX Threads Library for Win32 version 2.9.1 downloaded from link http://sources.redhat.com/pthreads-win32/.
In addition to above libraries, after compilation of SIP Parser, the libraries has to be tested on certain datasets that contains SIP headers and SIP messages, for its correct working. These dataset has been used from GNU based oSIP library on link http://www.gnu.org/software/osip/
along with some of the dataset that I have created.
In the attached code, following are the folders has been provided
1. SIPParserDLL -
SIPParserDLL folder contains the project for creating SIP Parser Library
2. SIPParserTest -
ParserTest folder contains the project for testing of SIPParserDLL library
3. Lib -
The Lib folder contains sub folder named "Debug". When the above two project once successfully compiled, then the SIPParserDLL related libraries and
SIPParserTest.exe file have been created in this folder.
4. HHCoreDLL -
The HHCoreDLL provide the basis functionality of creating log file and logging into it. This folder contains the Include files and libraries that are used by SIPParserDLL and SIPParserTest projects.
5. DataSet -
The DataSet folder contains text files based on SIP headers. These files contains the data in SIP headers format. This folder will be used by SIPParserTest project which will test the SIPParserDLL library.
6. Log -
When SIPPaserTest application is running, it create the log file on each run on the basis of current date time stamp. The content of this log file will be the result
of parsing SIP Messages and headers files that have been read from the DataSet folder one by one.
Points of Interest
During running of SIPParserTest application, it can be know whether the SIPParserDLL is parsing SIP message properly. And during parsing of SIP message or header,
if any header not parsed correctly then in that case the log file contains the error named "PARSE ERROR:". This error occurs because of the invalid SIP headers,
URL or SIP messages. These type of incorrect headers/URL/SIP messages has been intentionally created for correct working of SIPParserDLL.