Cnxcc prepaid module: workshop on Kamailio World

This is a short tutorial on how to test the cnxcc module with live traffic and from any softphone. These are the things that you need:

- Register from any softphone:
* server: cnxcc.caruizdiaz.com:5070
* username: anything between 5000-9999. Actually anything will work, but I’d rather use those numbering ranges
* password: anything. It is not required
* credit: you will get 1$ credit every time you register. If you place a call and run out of credit, just register again and you will get +1$ on your account.

- Place a call: you can actually call to any number with the following pattern: “^09\d{8}$”. This basically means that you can call to a number starting with “09″, that has 8 digits afterwards. Example: 0981223344

- You will run out of credit: after a little more than 10 seconds, you will run out of credit and your call will be terminated. Don’t worry, you will receive a SIP MESSAGE on you UA, if it supports it, telling you what just happened.

- Recharge your line: if you want more credit, just re-REGISTER from your UA

- Check you credit: by texting “credit” to destination “service“, from your UA that supports SIP MESSAGE.

- Check the web: you can actually hang up somebody else’s call, or your call, from the web interface. It looks nice and you can log in using “guest” as username and “123456” password.

- Call each other: you have the option to call other registered users, but for this, you have to know the number of the other person, or guess it randomly ;)

- Duplicated username: you may have chosen the same username that someone else did. If that’s the case, your call will last less than 10 seconds if you call simultaneously, or not even start if someone already exhausted the credit. In the latter case, you will receive a SIP MESSAGE telling you that you have no credit left ;).

These are the files involved in this project. I hope you find them useful.

linphone-cnxcccnxcc-csipsimple

 

WebRTC with Kamailio

I noticed lots of queries about this subject, and I created a Kamailio sample script that could help those who are in trouble when working on this.

This post is planned to be explanatory, with some level of detail, but I don’t really have time nowadays so I’m gonna throw it in its current state, hoping to find the time to do it properly soon enough.

  • This script is configured to run behind NAT, port TCP 10080 and TCP/UDP 5090 are exposed to the Internet
  • You have to create valid users using, preferably, “kamctl add …”
  • RTP ports should be open in range 30k-35k, inclusive
  • I used jssip as webrtc SIP UA: http://tryit.jssip.net/
  • Always disable video before placing a call from jssip UA
  • Always use Chrome. Firefox won’t work, and I’m not sure about other browsers
  • I tested calls between:
    • jssip to csipsimple
    • csipsimple to jssip
    • csipsimple to csipsimple

This is the link to the script

Install mediaproxy-ng on Debian based systems

This is a variation of my original post on how to install mediaproxy-ng on rpm based operating systems.

This one goes for the Debian/Ubuntu users, which are a plenty out there.

1. Clone the repository

2. Install compilation dependencies

3. Go to mediaproxy-ng directory and build the Debian packages

4. Go back to the parent directory. It should contain a series of .deb files. Install them all

5. If everything went OK, a message similar to this should appear on the console:

That is pretty much it, quick and straightforward, maybe because the Sipwise guys love Debian more than any other Linux distribution ;)

Asterisk as a transcoder for Kamailio

Using Asterisk as a SBC or transcoder may not be the right choice, especially if you follow the saying “use the right tool for the job”, and Asterisk is not precisely the right tool on these cases.

When you have options like FreeSwitch and SEMS, Asterisk seems to be disproportional and awkward to use, but it is so widely known that sacrificing flexibility to avoid investing time in learning a new technology (in case you don’t know FS or SEMS already) seems like a good alternative.

Having said that, let’s assume the following rules for our setup:

  • Our local network only accepts G722 codec between users, because, we enforce HD quality calls and we have lots of bandwidth at our disposal.
  •  We offer a local numbering plan and we can call between users of the network.
  • We also offer external calls to PSTN. For this purpose, we have a gateway that supports only PCMA/PCMU and G729. We don’t have the licence to do G729 in all of our softphones reason why we use PCM to reach our gateway from the softphones.
  • Asterisk will act as a transcoder, translating from G722 to PCMA/PCMU and backwards.
  • Asterisk will only take part of the SIP conversation when Kamailio detects that we are dialing to a number that does not belong to our internal numbering plan.

And from the SIP perspective

  • Kamailio is listening on port 5075 and serving on the net 192.168.2.0/24, using the IP 192.168.2.97.
  • Asterisk is listening on port 5080.
  • The PSTN gateway is located at 192.168.2.20.
  • Kamailio is accepting every registration request without any kind of authentication.
  • Username format is not being enforced, so I would recommend that you use something similar to 1000, 1100, etc.
  • I’m from Paraguay, and locally we dial “+5959″ to access the mobile network. Change this pattern to your dialing prefix so that it makes sense to your gateway.

Basically, the magic on the Kamailio side happens approximately here:

kamailio.cfg

And, on the Asterisk side we have got two things to modify:

  1. sip.conf: we have to add our Kamailio instance as a trusted peer, with no authentication and with the right codec definition
  2. extensions.ael: yes, I use AEL instead of the common extensions.conf, mostly because I hate extensions.conf syntax. If you chose to use .conf, no problem. It should work using whatever you choose.

sip.conf

extensions.ael

The full list of files are available on my github, here.

Installing mediaproxy-ng

This is a small guide on how to install mediaproxy-ng from sources on RPM based systems like CentOS.

Naming convention

All these “ng” stuff are really confusing and sometimes it’s hard to distinguish the pieces among them.

  • rtpproxy: it’s a media relaying software for RTP packets. It runs as a service and needs to be controlled and instructed using it’s own protocol.
  • rtpproxy module: it’s the Kamailio module that controls the rtpproxy service, from the configuration scripts.
  • rtpproxy-ng module: it’s the next generation (ng) module for Kamailio, based on the rtpproxy module. It serves as a replacement for that old module on newer systems.
  • mediaproxy: it’s another media relaying software, similar to rtpproxy, but older.
  • mediaproxy-ng: despite of its name, it is not the next-generation mediaproxy, but instead, the next generation of the rtpproxy (the service, not the module). From Kamailio, it can be controlled from both the rtpproxy and the rtpproxy-ng modules.

Before you begin: I’m using a x86 virtual machine. This means that you have to change the package names from i686 to x86_64 when necessary.

1. Kernel upgrade: you may not need to do this, so I recommend skipping this step unless you end up with an error like “undefined symbol” when trying to load the kernel module in the last step. In my particular case, I had to do it with my CentOS 6.0 VM.

2. Install development tools: several tools are needed to perform this step. Instead of manually listing them one by one, I would rather save some typing time by just installing the whole package ;)

3. Download the sources: from github

4. Install kernel development headers: this is going to be a kernel module, we need them.

5. A few other dependencies

6. Install mediaproxy-ng

7. Copy the resulting binary to the PATH: the Makefile doesn’t provide a rule for installing the binary.

8. Compile and install the iptables extension

9. Compile and install the kernel module

10. Finally, if everything went fine, you should be able to see something like this:

Csipsimple: a custom version

csipsimple-logo

Ever heard of it? It’s an Android SIP client, the best to my opinion, that ports the PJSIP stack to Android devices and adds to it a really good-looking user interface.

Four months ago, I started studying Android programming and the love for it didn’t take long to come. Learning it was relatively easy because of my background on Java, but it is a complicated platform with so much diversity that it will take long before I could say that I fully understand everything.

Creating a custom version of Csipsimple has been in my TO-DO list since more than a year. I first tried to rebrand it but I had no idea how to do it and I even downloaded the code and took a look on it. It was Chinese to my eyes.

Finally, I decided to study Android and the result of it is a work in progress which is looking quite good and promising to be a great product for ng-voice, the company I work for.

Below are a few screenshots of the product, and with this link you can get to the github project with a full list of features and things that makes the softphone different than the original csipsimple.

Login Screen

Login Screen

Customer information screen

Customer information screen

Dialer

Dialer

 

VUC: Kamailio

VUC is a very famous conference for VOIP users that is streamed every week on Friday. Today, a great group of Kamailio developers were gathered together for an update regarding the upcoming release of Kamailio 4.1.

For me, it was the first time meeting most of the guys in the conference although I know them through the interactions in the SR-DEV mailing list. It was a great experience indeed.

My participation was mostly related to the cnxcc module that I contributed some months ago, and that will be released along with some other modules for the 4.1 version.

There’s a video of the session that you can watch. The important part of me talking about the module starts here.

After watching it I noticed my pronunciation needs some major improvements (well, my English in general :D), specially with the words ending with consonants. Bear with me please, English is my third language ;).

I leave you with the video link below, in case you want to watch very smart people talking about Kamailio ;)

Three months at ng-voice

ng-voiceFor those who follow me and didn’t notice my new job, it has been 3 months already. Three great months :). I switched from a regular commuted job at Conexion, to a full-time telecommuting job for a company located in Hamburg, Germany, which is 6 hours away from my timezone.

Timezone was never a problem. When I am about to start here, they are about to have lunch. It sounds rough but it is not when a perfectly built schedule and task list is given to you, and when you work with very talented and disciplined professionals.

And speaking about talented people, well, I work with the best in the industry. No exaggeration.

My work is very diverse and exciting and although it’s been only 3 months, I already worked with:

  1. Mobicents: I wrote an Online Charging Server based on Mobicents OCS following the Diameter Credit Control Application specs.
  2. Kamailio IMS modules: I bug fixed and extended the ims_charging module.
  3. CSipsimple: I created a custom version of the famous Android SIP phone which can be found here.

Three different VoIP related technologies in three months, and it’s getting better every day :).

DWG2000 API Windows demo

Finally a full-featured and executable demo is available for downloading and testing.

It runs on any Windows box with dotNet framework 2.0 installed on it. Personally, I tested the app on Windows XP and Windows 7.

To try it, decompress the zip file and paste the only two DLL files into %windir%System32 folder. Then, run the executable file.

This is a very early demo application and it may contain bugs. In case of that, please report it to my personal email so I can fix it.

dwg2000-demo

Scripts to make your life with Dinstar easier

Yes, the title expresses itself with plenitude.

Take a look to my new contribution and write me an email if you find any troubles configuring it.