An Introduction to Linphone
April 29, 2010 8 Comments
I have been looking for a softphone for some time now with two requirements: (1) easy to use GUI; and (2) can easily be used from command line. Many softphones have great GUIs, which are easy to use and very friendly. The second part, easy to use from command line, was a tricky requirement. The idea is to make a complete call from the command line in an interactive way. For example, dial a number, enter options to any IVRs, and then hangup once done. However, I had another requirement: be able to script this whole thing as well.
Linphone is a softphone that met my requirements. It is very easy to use. I was able to use its GUI to create SIP accounts and register with Asterisk and FreeSWITCH, and make calls easily. But there are two things which make this the complete package for me.
The first is linphonec. It’s a command line program which lets you make calls, etc. interactively. Just run the program, it registers with the appropriate servers, and then you can issue commands to make and control calls.
The second is linphonecsh. This is what finally sold me on this product. Using some very simple steps, one can script the whole behavior of one (or more, if desired) calls. Linphonecsh is actually a daemon for linphonec. You can read how to control it from Control a linphonec daemon from scripts. Although that’s the official page, for those of us too lazy to click a link, below are the main steps:
Start the daemon:
Register with SIP provider:
linphonecsh register --host mysipprovider.net --username 100 --password mypassword
Check status of registration:
linphonecsh status register
Call a number:
linphonecsh dial "sip:firstname.lastname@example.org"
Stop the daemon:
I had a problem. I wanted to register Linphone to an Asterisk server on the LAN. I used the following command to register (I am omitting the init, etc. as they are understood).
linphonecsh register --host 10.10.1.10 --username 100 --password mypassword
linphonecsh status register would show register=-1. I tried many things but nothing worked. Searching led me to Linphonecsh register problem. I didn’t really understand what I was doing wrong. I finally figured it out.
If you look at ~/.linphonerc file, you will notice that the word realm is used. For me it was
realm="asterisk". The way I understand it, realm in the file is the same as
--host in the register command. In other words, if realm is “asterisk” then
--host should not be an IP address but it should be a hostname.
With this idea in mind, I created an entry in /etc/hosts file for 10.10.1.10 mapping to asterisk. And I modified my register command to the following. It worked!
linphonecsh register --host asterisk --username 100 --password mypassword
So if you are having problems registering linphonecsh to an Asterisk server, try this. Maybe it will solve your problem. I mean, it’s not just with Asterisk; the solution may work for other servers also. Of course, if the server is not on your LAN, you should use its domain name instead of IP for