Daniel Pocock: Quickstart: Integrating SIP support into any application with reSIProcate
Today's applications are more dynamic and interactive than ever before, typically offering the user many ways to collaborate or get live data about their community or environment as they need it.
Two open standards exist with a broad focus on real-time messaging and session control, SIP and XMPP (Jabber). Both of them have been supercharged by the development of technologies like WebRTC that makes every browser into a communications endpoint. Here, we look at integrating SIP into any C++ application (either client or server). We use the industry standard SIP stack reSIProcate.
The quickest way to get started is with a Debian, Ubuntu or Fedora development environment. reSIProcate is conveniently packaged on all those platforms (for Fedora, it is not yet in yum and must be built from the tarball using rpmbuild).
Getting the environment set up
Once you have Debian or Ubuntu installed, just do:
# apt-get build-dep resiprocate # apt-get install libresiprocate-1.8-devThis will install all the necessary tools, libraries and header files. Headers are under /usr/include/resip Writing some code The object orientated nature of C++ is heavily leveraged by reSIProcate, and this makes it easy to code. The stack is based on a callback paradigm: you create some objects based on well-defined interfaces, give your objects to the stack, and put the stack into a loop. The stack will call your object when some event occurs (e.g. new incoming call, new text message) The easiest way to see this in practice is to browse the test cases. The test cases under the resip/dum(mirrored on github) section of the source tree provide good high-level examples of the type of code an application writes when using reSIProcate in an existing application. Sending a SIP text message Based on the basicMessage test case, I've created a trivial piece of code below to send a text message over SIP. The whole demo project is uploaded into github, see the README for instructions on how to build and run. Here, we have a quick look at the one object in the demo, it is notified on the progress of the SIP text message:
class ClientMessageHandler : public ClientPagerMessageHandler
public:
ClientMessageHandler()
: finished(false),
successful(false)
;
virtual void onSuccess(ClientPagerMessageHandle, const SipMessage& status)
InfoLog(<<"ClientMessageHandler::onSuccess\n");
successful = true;
finished = true;
virtual void onFailure(ClientPagerMessageHandle, const SipMessage& status, std::auto_ptr<contents> contents)
ErrLog(<<"ClientMessageHandler::onFailure\n");
successful = false;
finished = true;
bool isFinished() return finished; ;
bool isSuccessful() return successful; ;
private:
bool finished;
bool successful;
;
int main(int argc, char *argv[])
// boilerplate initialisation code...
...
NameAddr naTo(to.c_str());
ClientPagerMessageHandle cpmh = clientDum.makePagerMessage(naTo);
Data messageBody("Hello world!");
auto_ptr<contents> content(new PlainContents(messageBody));
cpmh.get()->page(content);
...
</contents></contents>Going further with reSIProcate
- Look at the other test cases
- Look at some of the contributed applications, which include two click-to-call programs.
- For browser integration, look at the SIP over WebSockets support
- Feel free to ask questions on the mailing lists
Imagine if you could send git pushes to any of your friends on Google Talk
or other Jabber (XMPP) servers. Even though you're in different places
and your computers probably cannot talk to one-another directly, you can
share a git repository, without relying on a git hosting provider such
as GitHub.
Update for 06/10/2012
Well I had not written the weekly work log for the last week that
is because the week was short (oh yeah thanks to all these bandhs
our week got fluctuated and to be frank the week was only 4 days
long) and second was my lazyness. Here goes the update
* After a long discussion with
Dear Facebook friend,
I like you and I want to chat with you, just not on Facebook!
My Facebook account is there to reach you where you are, but I do not
hang out there. Please join me at Free and Open spaces instead - via
email, IRC or Jabber

Some more progress since my last entry....
Slovenian, Punjabi fully completed.
Romanian completed for first two sublevels, hence rescued.
Got signs of life from Galician, Croatian, Georgian, Malayalam, Nepali
translators. But nothing happened yet
Got offers to help for Welsh, Lithuanian. But nothing
happened yet.
Progress for Amharic in level 1
At this very moment, it means that I would deactivate 14 languages: