Hayling Island

Hayling Island
Showing posts with label Asterisk and VoIP. Show all posts
Showing posts with label Asterisk and VoIP. Show all posts

Saturday, June 23, 2018

Phones are working .. PoE is on .. and Asterisk and routing

So I have now installed a couple of switches in the loft, and Fireball, the house server is back online. I established two networks - one yellow zone, for the house and the wifi network, and the purple zone with the phones.

I needed a separate network for the phones, since they need to boot from a TFTP server. Some of the Cisco phones, like the 7970 actually won't seem to accept a static IP, so they need a DHCP server that also gives out the address of the TFTP service as well. Now, since the house router doesn't dish out advanced settings like that - a bit Cisco unique -  I have to serve up the phone network DHCP and TFTP settings from Fireball. So it is the router for the phone subnet.

As is commonplace for Asterisk, the phones then started exhibiting the one-way-voice problem. If I call between extensions in the house, no problems. However, as soon as I try to call in from outside, the voice only works one way.

Turns out that it is not the usual codec issue, nor is it a NAT issue, but a routing issue ..


If the traffic is coming from a hard phone to a soft phone, the hard phones are routed to Fireball anyway, since their default gateway is the Fireball 192.168.4.1 interface. However the reverse doesn't work, since the switch is not layer 3, and doesn't know that 192.168.4.x traffic needs to route via Fireball. Since all of the hard phones are on a network that doesn't have a routing rule on the router (not a good name for a device for which I can't provide internal routing information), they can't receive RTP data from POTS calls and the sipgate service.

So I changed the settings in sip.conf to force all traffic for phones to go via Fireball, rather than trying to allow the RTP flows directly between devices. That seems to work. 

sip.conf has to be set to identify each of the internal networks separately. In my case this looks like

externip=hilabs.dlinkddns.com ; This is the free ddns service from Dlink - works fine

localnet=192.168.10.0/24 ; allows multiple lines
localnet=192.168.4.0/24   ; 

directmedia = no ; force all traffic to go via Asterisk on Fireball 

Seems to work ok now. The loading on Fireball increases very slightly, but hardly an issue since the compressed audio only consumes about 64K bits/second, and it is compressed and decompressed at source (viz the phones). Unless I was running a call centre, Fireball can cope. It copes an awful lot better now it is running headless, so it's not running KDE, or Gnome, or any window manager at all. I love the command line! 

Tuesday, May 3, 2016

.. and we are live with Asterisk!

I solved the issue with the analogue phone lines by getting rid of them. For the princely sum of 5.95 per month, Sipgate offer a trunking service, which means you can get your Virgin Media provided phone number transferred to them, and they will forward all calls to that number back to your own Asterisk system.

I've not done anything too complex so far, but it all works. If someone calls, then the VoIP phones (the Cisco ones) ring - first the main ones, then if they aren't answered the ones in the office and craft room get added on, and then if they are not answered, the mobiles ring!

If the call drops through to voicemail, the message is sent via an email attachment to us, so we can pick it up on our mobiles wherever we are as well.

Now Virgin Media charged me 17.95 a month for the privilege of a phone line. Since I don't need that any more, I wonder what their reaction will be when I ask that I have that money taken off my bill?  (Please note this only works if your current provider doesn't use the phone line to provide your broadband. Obvious when you think about it!)

All bets taken. Mine is that I might get a discount of a fiver after months of haggling.

*** Wrong again. After haggling, VM tell me that it is actually more expensive to change package to stop paying the line rental than it is to keep it. We need a bit more OFCOM legislation I feel. 

Monday, March 7, 2016

Asterisk and stuff

One of the other fascinations I have is with telephone systems. I have a Cisco 7940, and a 7970 in the house, and I have a Sipgate account for VoIP. It was working fine with one phone, but then I thought I wanted both phones working. SIP is a strange protocol, and is hugely flexible so you can spend happy hours playing with all kinds of things to get it going. The phones are different as well; Cisco rely on having a TFTP server in the network for the phone to boot from, which contains most of the phone configuration. Each phone has a SIP<macaddress>.cnf file in the tftpboot directory that it looks for, to bring up the phone. I had some happy times with Wireshark to find out what was going wrong. Having fixed the 7940, the 7970 uses a similar approach, but a completely different format for the configuration file - now in XML! The phones also have their own web services built in ..

So having the phones working individually, I needed something so I can use them both. There is a lovely bit of Open Source software - Asterisk - that can run on Linux to provide a local PBX solution. So, downloaded that, and it now functions to manage calls coming in and going out on the SIP line.

I then installed Zoiper on all of the mobiles and tablets in the house, and that works well - so I can now call Trish from the office to her mobile, without the call going out over the air - and therefore is free. So far so good.

What I want to do next is to receive incoming calls on the house phone, and send them out to the SIP phones. So, how to solve this?

I did the usual, searched with Google and decided from a ten minute bit of research that the SPA-3000 device, available for pennies from eBay would be a good bet. Ah. Now the real fun begins.

I found the manual online, and there is a very comprehensive Asterisk book for download. I am still struggling though - this is a key part of the home phone strategy, so I can use the existing analogue handsets over DECT to ring them (assuming the phone call is from someone I like - telemarketers will get a very long message advising them that we don't accept unsolicited marketing blah blah on the phone). I will post more as I find out more, but this is a nightmare so far. There are literally hundreds of settings for the SPA-3000.

I may have to sell the little darling and buy a better interface.