Category: Asterisk & VOIP

Asterisk & VOIP

Asterisk md5secret password problem

Asterisk md5secret password problem

Introduction –

After upgrading the Asterisk-1.2 to new Asterisk version 1.4 … The md5secret password option in SIP configuration file was not working with new Asterisk 1.4 version…. We try to sort this problem… and finally we found the solution…..

1] Open Asterisk configuration file ‘ sip.conf ‘ and check your realm name –

[root@indianGNU.org:/etc/asterisk# cat sip.conf

[general]
port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
allowguest=no
#disallow=all

…..
…….
localnet=192.168.1.0/24
externip=A.B.C.D
realm=asterisk.IndianGNU.org
recordhistory=yes
videosupport=yes

;add sip_account.conf file configuration ;; note below line is not comment..
#include sip_account.conf
[root@indianGNU.org:/etc/asterisk#

2] How to generate MD5 secret password for SIP account –

[root@indianGNU.org:~# echo -n “4050:asterisk.IndianGNU.org:mypwd” | md5sum
91f55d8bd74cad9e223c2d3a326f1367 –
[root@indianGNU.org:~#

3] The format for generating the MD5 secret password is ….

[root@indianGNU.org:~# echo -n “sip_account_no:realm_name:password” | md5sum

sip_account_no = This is the SIP account name see below file
realm_name = This option is set in sip.conf file of asterisk with “realm” option
password = Password for your SIP account

4] Asterisk SIP account file (in my case ‘sip_account.conf’ )

[root@indianGNU.org:/etc/asterisk# head -n 13 sip_account.conf

[4050]

username=4050
md5secret=91f55d8bd74cad9e223c2d3a326f1367
callerid=Arun Bagul<4050>
context=for-allowme
type=friend

….
….

[root@indianGNU.org:/etc/asterisk#

5]
Now restart or reload Asterisk server and try to login register account 4050 with secrete password “mypwd” .. The account will be registered successfully…

[root@indianGNU.org:~# /etc/init.d/asterisk reload
Reloading Asterisk PBX configuration files.
[root@indianGNU.org:~#

Thank you,

Arun Bagul

Caller ID problem with Aserisk?

Caller ID problem with Aserisk?

Introduction –

Magnet has the expertise to build a VoIP based extensible EPABX system. The system runs on standard PC hardware and provides scalability and advance feature set at a fraction of cost of similar solutions. Please click here for more details…

We were facing Caller ID problem with Asterisk (PBX) since long time.. Finaly we got the solution!!…

Few days back we have upgraded our Asterisk version to latest Asterisk-1.4 version. There are few changes in Asterisk-1.4 and some functions are deprecated in 1.2, and removed innew Asterisk-1.4  version…

In old version we are using SetCallerID() function, which is removed in Asterisk-1.4. So we have used Set() and CALLERID() functions for Caller ID and it is working perfectly… We are very thankful to Nirav Sir, for helping us to resolve this issues. It was a good thing to learn the new ways of debugging…

Thank you,

Arun Bagul

VOIP service in India

VOIP service in India

I dont know what got me suddenly but yesterday I wanted to know all that is legal & available w.r.t VOIP.So I made a call to Mr.Adil.Doctor who is the Linksys Sales Manager(India) & is located at Cisco Systems Pvt Ltd,Mumbai.

After getting a brief idea about where VOIP is in India he informed me that a call from a VOIP phone to a PSTN/Mobile isnt legal in India.International calling is legal through the calling cards which can be got from Internet Telephony Service Provider such as Phonewala.com.

Although he couldnt provide all the information I was looking for but he has promised he will forward me to someone from the Cisco Bangalore office so that I could get my doubts cleared.

Asterisk Saga!!

Asterisk Saga!!

We worked on an Asterisk setup project couple of months ago. It was a rocking experience. Me being in the story, has written up a saga on it! Credits to the whole team that worked on it!Here you go on the Asterisk Saga!
asterisksag

It was Friday evening, Time to party. Not just yet! We came to know about this project. The Client’s requirement was to setup a working Asterisk Voice over IP server. This would enable them to route internal and external calls using a computer, a Digium ISDN card, and the Asterisk software. Seven companies had laid their hands and minds on it. Sounds interesting? Yes on a weekday it would be.The client had a server with Asterisk installed on it. But it was not working. Many people, including some regarded as experts in the field, had tried to solve the problems for the last two weeks, but everyone failed. And the client wanted us to get this working before Sunday – at any cost – as there was an important presentation to the CEO of one of the largest telecom companies in India. Does it get any bigger than this! Of course it does. Read on…

To give you a little background, we have an Asterisk based phone system setup in our office. Nirav – our Chairman – had blogged about the problems we faced setting it up with the ISDN line. Sudish – the client – read this post after a Google, and got his ISDN connection working when he followed those instructions. That’s why he called us up, after some failed attempts from many.

Nilkanth, our Systems Team Leader, and a true hero in this story, informed the team about the project. The server was physically located in another city, and we had shell access to it. Nirav had setup most of the things on the Asterisk Server in Magnet. And Ali knew some part about dial plans. Rest of the team knew only the basics of the technology till that Friday evening. Then What?

What else? We jumped in to the battle like brave warriors, The first enemy to tackle was getting hold on more than the basics and doing that with a timer. We had just one plan. “Ground work first and all the detailed documentation, long process can come in later. Quick analysis seemed the need of the hour and the only trigger we had was a couple of Samosas and chai. Not a bad start at all. The first strike from our team was a detailed check- list of priorities, delegation of all the duties on the list to the best to be working on them. Who knows better than our Nilkanth of his team capabilities?

Now, things started like this for us. Ali left early that evening. Nirav and Nilkanth were working on the server to fix the issues. The Asterisk server was not able to route outgoing calls at that time. There were lots of errors and warnings. We found many files edited by different people. Initially, we tried fixing them. We grouped the errors, set priorities, and got on to them. But the setup was all messed up. It was 6pm by then. Nirav had to leave so, he told us which important files need attention and left. So there was Nil, Arun and me. We tried to fix those errors one by one. But it still did not work. We decided to re-compile Asterisk. We took a backup of current configuration, downloaded the version the client wanted, and re-compiled. We re-configured things. Now we had fixed all the errors the log files were clean. The outgoing calls from command line were working fine. But, the incoming calls were not coming in – seemed like they were going to a blackhole! Various Voice over IP clients like eyeBeam, SJPhone were showing the Error 403!! It was 3am Saturday by then. We had already decided that no matter what happens, we are going to get it working and only then we will leave for home. Challenges don’t push us down, they make us rise higher!

The spirit of the team and determination to get over the problem helped us to stay focussed. Each of us motivated the other person.

We rebooted the system since we had re-compiled and re-configured, but… we invited more trouble!! The server was unable to detect the Digium card that connects the software with the ISDN line bearing the telephone connections. Oops!!!

This was like adding insult to an injury! We were stuck and no one could suggest how to proceed. We Googled the error. We decided to insert the card in a different slot on the computer. We called up Sudish, who was awake with us and asked him to plug-in the Digium card into another slot. He immediately arranged some person on the site and did exactly as we asked. The machine was rebooted again. And the error still showed up!

After some deep debugging, Nil figurred that the problem is due to Kudzu. Kudzu is a hardware detection agent on RedHat Linux, and it was detecting the card, but not able to understand what it was. We shut off Kudzu on the server, and that got the card back to life!

It was Saturday morning now, and the phones were still not working. Vishal“ our CTO  pitched in and we all started working on identifying what’s really causing the problems. Vishal’s jumping in encouraged the team and showed his commitment. He brought a new perspective and was really helpful in checking our assumptions and also researching.

Sudish had a hair pulling time while all this was happening, as the time for the presentation was approaching very quickly. He had all his hopes on us. Did that pressurize us? No we were honoured by the trust.

Sudish was very cooperative in all this… he was with us, offered us his ideas, showed great faith in us and supported us thoroughly. As a matter of fact he was also awake with us to help us. What more can we expect?

We then took a new approach. One closed door did not stop us. We just looked out for another one. We started observing the issues from another angle and brainstormed to analyze a little differently. We divided work: we took turns to download, research, try on our server, communicate with client, think / plan, take care of needs etc. This helped each ones point of view bring new solutions.

Right then, we found that some of the pre-requisites for the operating system were not installed on the server. We downloaded and installed all those hoping that it would fix it! Lady luck was not in our favor, and doing this too did not make the system work! The day went in configuring and re-configuring the setup. Trying out different combinations to see if something would work. The same setup files that worked for us, and a lot of other people, did not work on this particular server.

Sunday morning…and we were all stressed. The client had urgent requirement, the team was working continuously on this from Friday morning, putting their best efforts. Vishal was with us and Nirav in the loop. Nirav actually logged onto the server remotely during break timings of his seminar and tried to solve the problems. Unfortunately, he could also not solve it. This was really getting hot now!

Sunday morning, we spent half an hour discussing the problems and possible solutions with Nirav. He encouraged the team and showed his support. He told us that he will get back to us on chat by evening. But I had some intuition and I told him… “hopefully we will tell you that things are working.. by evening.

By late morning, we were getting close. We had fixed most of the problems. We were now able to receive calls on the server. We could make outgoing calls from the common line and the interactive voice response system was working too. But the extensions were not registering with the server yet. We re-considered everything. We had a very good dial plan, we had all files configured correctly. We had provided all dependencies to the kernel. So there was very little chance of any problem with all that. Now the only thing that could have some problem was – well, Asterisk itself!

We planned to install the latest version again. We compiled Asterisk 1.2.13 keeping the configuration and the other libraries files intact. Vishal started eyeBeam software phone client and to his surprise, it registered! Catching hold of his excitement, he tried it again. And it worked again. He tried calling, and that worked too! Within a minute, all of us were on it. And every single thing worked! We checked the incoming calls, outgoing calls and the calls within network.. everything working fine! The final compilation helped us fix the issue. We setup our final extension dial plan. And called the client from the working software phone, and gave him the good news! It was Sunday afternoon, and our afternoon tea was unforgettable that day! Not less meaningfull than a medal that said GREAT and ON TIME.

And now, of course the moral of the story! First of all, weekends don’t need to be the same, they can be more intersting than you are prepared for. Teamwork, Dedication and Planning can take you out of the most difficult situation. We did well but that would not be enough if our planning was not to do it on time and that made all the difference. So conclusion – we understood the final goal, we chalked the steps to get there. We started as a team and finished as a team. We left each work to the best in the team. We enjoyed the challenges. We went back to the drawing board when one option did not work. We assured and updated the client at all times to find more faith and trust each time.

I think this is one rocking weekend one can have, I could not learn and experience more in 48 hours. Waiting for such interesting weekends ahead!

(People in the photo above, L to R: Ali, Jayesh, Nilkanth, Arun, Ameya. Thanks to Prakash for the creative Image work!)

Asterisk PBX server behind NAT (asterisk port forwarding)

Asterisk PBX server behind NAT (asterisk port forwarding)

If Your asterisk server is behind NAT then to access asterisk from outside world you need to use the port forwarding features of iptables in Linux.

Steps for asterisk Port forwarding

1] Check rtp.conf file in asterisk

root@indiangnu.org:/etc/asterisk# cat rtp.conf
;
; RTP Configuration
;
[general]
;
; RTP start and RTP end configure start and end addresses
;

rtpstart=10000
rtpend=20000

root@indiangnu.org:/etc/asterisk#

*
In rtp.conf file rtpstart and rtpend variables defines which range of port is your asterisk server using for data transfer at real time it is 10000 to 20000 range.

*supose IP address of Asterisk server is 192.168.1.150

2] Apply iptables rules for port forwarding

#Port forwarding for Asterisk
itables -I FORWARD -s 192.168.1.150 -p tcp –dport 5060 -j ACCEPT

#port forwarding for TCP
itables -A PREROUTING -t nat -i eth3 -p tcp -m tcp –dport 5060 -j DNAT –to-destination 192.168.1.150

#port forwarding for UDP

iptables -A PREROUTING -t nat -i eth3 -p udp -m udp –dport 5060 -j DNAT –to-destination 192.168.1.150

#port forwarding for RTP traffic
iptables -I FORWARD -s 192.168.1.150 -p udp –dport 10000:20000 -j ACCEPT

iptables -A PREROUTING -t nat -i eth3 -p udp –dport 10000:20000 -j DNAT –to-destination 192.168.1.150

Thank you,

Arun Bagul