I’ve been on a lookout for a dream sip phone for a while. A dream to me is: cheap and reliable, and with some decent customizations. When I came across a Cisco 7962G for $9.37 shipped (+tax) on Amazon, I knew it had to be mine. My only regret is… That I purchased just one.
But who needs the phone?
Well, I do. I don’t like having my cellphone around my working desk, it’s a distraction. I want my wife to be able to reach me, occasionally I need to call her. And I also dislike shouting around the house, and calling using Google Home is just way too slow (hey Google, call my wife on Duo. Hey google, call bedroom on Duo. And then answer. Broadcasting doesn’t work great either). Get a smaller house you say, #1stworldproblems.
I live in the States, and I maintain a Polish phone number (30 cents/year! + Pay per outgoing minute). I also have a Google voice number, and so does my wife. We already have 3 wireless phones at home, hooked up to Obi 200 (good piece of hardware, it allows you to plug in analog phone and connects to SIP). But 3 is not enough, plus I can never find the bloody headset. I want good loudspeaker, and I want it always in the same place.
Did I make a mistake?
The day after I ordered the Cisco phone, I found a thread on reddit “No more Cisco 79xx spam“. I read about how unreliable stuff is, how it’s difficult to configure, how it doesn’t work. Okay, off to a great start. At this point I was happy I ordered just one phone. Frankly, I think that post is maybe a bit exaggerated.
Requirements
- Add at least 1 sip line. Preferably 3. One SIP server is sufficient though .
- Ideally, connect to my outgoing Google voice line, with selection of the outgoing number (mine or my wife’s),
- Support my PBX which connect via sip to my Polish phone number
- caller id
- make local (within house), calls. Receive local calls (from my wireless headset), without going to the outside world.
- Bonus points for call transfer
- Bonus points for one cable, aka POE (power over Ethernet)
I’m happy to say, all points are achieved, and then some more!
Getting started
The day the package arrived. I was surprised. Original cisco box, it looks like original ethernet cable, the phone, headset, and the cable to plug in headset and the phone. So I plug in the phone to my new managed POE switch, and nothing happens. A bit disappointing. But then, after configuring DHCP, TFTP, NTP, the phone starts, and the beautiful Cisco’s logo shows up.
DHCP
# For cisco (I don't know if these are strictly required, but they won't do harm).
option boot-server code 66 = string;
option option-66 code 66 = text;
option option-67 code 67 = text;
subnet 10.0.12.0 netmask 255.255.255.0 {
range 10.0.12.10 10.0.12.100;
option routers 10.0.12.1;
option broadcast-address 10.0.12.255;
option tftp-server-name "10.0.12.1";
option ntp-servers 10.0.12.1;
}
TFTP
# cat /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
NTP
Not strictly required, but I like seeing a correct date on my phone. Just install ntpd π
Firewall + VLAN
iface enp1s0.12 inet static
address 10.0.12.1
netmask 255.255.255.0
PHONE_NETWORK="10.0.12.0/24"
PHONE_VLAN="${VLAN_IFACE}.12"
# PHONE: Accept TFTP, DHCP, SIP, RTP (10000-20000)
# Both TCP UDP
-A INPUT -i $PHONE_VLAN -s $PHONE_NETWORK -p tcp --dport 10000:20000 -j ACCEPT
-A INPUT -i $PHONE_VLAN -s $PHONE_NETWORK -p udp --dport 10000:20000 -j ACCEPT
# DHCP only UDP (67 & 68), and TFTP 69
-A INPUT -i $PHONE_VLAN -p udp --dport 67:69 --sport 67:69 -j ACCEPT
# SIP Both tcp and udp (cisco uses tcp)
-A INPUT -i $PHONE_VLAN -s $PHONE_NETWORK -p tcp --dport 5060:5061 -j ACCEPT
-A INPUT -i $PHONE_VLAN -s $PHONE_NETWORK -p udp --dport 5060:5061 -j ACCEPT
# NTP
-A INPUT -i $PHONE_VLAN -s $PHONE_NETWORK -p udp --dport 123 -j ACCEPT
# Established and related
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
Ok, so we have the infra…
With this infra, I can actually start booting the phone. First challenge – find all the files. There is an article by cisco, with a link to the files… But the link doesn’t work and the files it refers too are not there. Basically, we need a new firmware, a SIP firmware. The article is pretty good and explains the meaning behind the files. In particular, I am going to install a SIP firmware P003-8-12-00.bin on the phone.
- Download CISCO firmware. It should be on CISCO website, but I didn’t find it. The link didn’t wok. I found this 3cx.com article, and it had this link to the firmware.
Place all of the files in the TFTP server root. - Read the Mac address of the phone. I did that in my DHCP logs.
# tail -f /var/log/daemon.log | grep SEP Oct 7 20:22:51 usa dhcpd[27939]: DHCPOFFER on 10.0.12.10 to 04:da:d2:bf:e9:05 (SEP04DAD2BFE905) via enp1s0.12 Oct 7 20:22:51 usa dhcpd[27939]: DHCPREQUEST for 10.0.12.10 (10.0.12.1) from 04:da:d2:bf:e9:05 (SEP04DAD2BFE905) via enp1s0.12
- Now I know my phone name (SEP04DAD2BFE905), I can create, in my TFTP folder, SEP04DAD2BFE905.cnf.xml.
The minimal content of SEP04DAD2BFE905.cnf.xml is
SIP42.9-4-2SR3-1S
which ideally should allow you to upgrade firmware.
Configure asterisk
- Create the accounts in sip.conf
- Create the extensions.conf
- Configure SEPXXX.cnf.xml
Fun times. Stuck in registering
Ok, so the phone boots… but it spins “registering”. I look at asterisk logs
# asterisk -r
usa*CLI> core set verbose 3
… and there is nothing there… let’s tcpdump and see what’s coming in
# tcpdump -i enp1s0.12 port 5060 -n
21:47:06.195913 IP 10.0.12.10.51787 > 10.0.12.1.5060: Flags [S], seq 3821038227, win 8192, options [mss 1340], length 0
Ok. So the phone is trying to make a connection, but asterisk ignores it. Why?
root@usa:~# netstat -an | grep 5060
udp 0 0 0.0.0.0:5060 0.0.0.0:*
Okay, asterisk is bound to 0.0.0.0 on udp. Like what do you mean “SYN”!? That’s TCP. Asterisk is bound to UDP. What the ??? Quick lookup in the manual: Asterisk uses UDP by default for sip… but it has a magic option
trancport=tcp
lo-and-behold, now the phone connects. Wohoo.
So all in all, this is asterisk config
[localtemplatecisco](!)
type=friend
host=dynamic
context=sip_out
insecure=invite
canreinvite=yes
disallow=all
allow=ulaw
allow=alaw
[cisco1](localtemplatecisco)
secret=password
callerid=CISCO
transport=tcp
; google voice accounts
[googlevoicetemplate](!)
type=friend
host=dynamic
context=sip_out
insecure=invite
canreinvite=yes
context=google_voice_outgoing
transport=tcp
disallow=all
allow=ulaw
[olavoiceoutgoing](googlevoicetemplate)
secret=voice1password
callerid=26229xxxxx
[piotrvoiceoutgoing](googlevoicetemplate)
secret=voice2password
callerid=2626xxxxxx
transport=tcp
Dialplan
My dialplan is very rudimentary, and very much work in progress.
The first line (100.) matches local calls (1001, 1002, 1003). I realize I could make local numbers shorter π
The second line matches local american calls. Could be more restrictive. The remaining two lines match full international phone number schema for US numbers and for Polish numbers.
Ok, but you promised Google Voice
I can’t get credit for this. Link to details. The only changes I’ve done to the that proposal is. On Obi200, SP1 and SP3 are google voice numbers, and SP2 is a trunk to asterisk.
- Extensions.conf:
; this forwards the appropriate incoming google voice line to appropriate SIP account. This way, Cisco phone correctly shows which line is ringing
[from_gvoice]
exten => 2626xxxxxxx,1,Dial(SIP/piotrvoiceoutgoing,30,tTk)
exten => 2622xxxxxxx,1,Dial(SIP/olavoiceoutgoing,30,tTk)
; This sends all google voice calls to the google voice trunk to Obi 200. Obi 200 would use 'caller id' to differentiate which outgoing line to use. This allows to use physical buttons on Cisco 7962g to select proper outgoing call.
[google_voice_outgoing]
exten => _X.,1,Dial(SIP/gvoicetrunk/${EXTEN})
On Obi, for outgoing calls (on the trunk SP):
X_InboundCallRoute: {2622xxxxxx:sp1},{2626xxxxxx:sp3}
This sends the calls from 2626* to SP3, and 2622* to SP1.
For incoming calls, in both SP1 and SP3 (adjusting the phone number appropriately)
X_InboundCallRoute: {:ph1,sp2(2622xxxxxx)}
This forwards the call to both the physically connected phone, and to asterisk. Asterisk then fans out the call to cisco (and other devices, as configured in extensions.conf).
Bonus: how much power does it use?
It’s a class 2 poe device, which means it allocates 7 watts. According to my switch, it consumes 4.5 watts… making it a $4 bill in a year. More than I expected, but I am hoping my switch does not count the actual usage properly π
Port Admin Oper ---Power(mWatts)--- PD Type PD Class Pri Fault/
State State Consumed Allocated Error
--------------------------------------------------------------------------
1/1/2 On On 4500 7000 802.3af Class 2 3 n/a
Leave a Reply