Saturday, May 31, 2014

If you work in IT, you need one of these things - the Kill-A-Watt meter

A colleague recently called me to ask about a server he was planning to install.  The box had dual power supplies, and he wanted to know if would draw an equal amount of AC current for each power supply, or if one PS would supply the machine and the other one would be in a "backup" state, ready to take over if the primary failed.

I didn't know diddly-squat about the make and model of server he was contemplating, and I was unwilling to waste precious minutes of my life Googling for that information -- but I told him what I do in his situation:  Go get two Kill-A-Watt P4400 power meters and plug one into each power supply.

If you work in IT, or in any job that depends on electrical devices, you will eventually need something like this.  I'm kind of surprised at how many IT professionals I meet who don't know that such devices exist and are inexpensive.




The Kill-A-Watt says my laptop is using 54 watts of power.


The P4400 meter is available online and at hardware stores for $20-30 US.  It measures instantaneous power in watts, cumulative power in KWH, current, voltage, frequency, and power-factor.  It is useful for choosing a proper size UPS and estimating runtime, figuring out what a device is costing you in electricity, finding out if dirty power is causing problems with your network gear,  finding heavily loaded circuits before you start blowing breakers, and lots of other things.
It isn't the "perfect" power meter, but it gets the job done, cheap.  Some of its limitations:
  • Only works with standard (15-amp) plugs.
  • Does not keep maximum/mimimum/peak data. (which would be really useful for measuring the start-up load of an air conditioner or refrigerator)
  • No graphing or data-export function.
  • Does not keep data if the power goes off.

One clever person has published a "Tweet A Watt" mod, which makes a standard Kill-A-Watt wirelessly monitorable and provides graphing and Twitter functionality.  It looks like fun, but i haven't tried it yet.

Example CME SIP Trunk configuration for Bandwidth.com



I recently helped a friend move his Cisco 2811 from analog lines to a SIP trunk through Bandwidth.com.

This was my first time dealing with a VOIP trunk that I didn't control both ends of, and my first time dealing with Bandwidth.com. I didn't think it would be all that difficult -- After all, I can't be their first customer to use Cisco gear, and there's bound to be lots of examples of how to do this that I can just Google up... right?

Well, it turns out that there wasn't much information available There was much more trial-and-error involved than I anticipated.

Below the "read more" link is the result of that trial-and-error, for anyone stuck in the same situation.



Bandwidth.com's support forums have only a single thread about getting their service to work with Cisco Call Manager Express.  It also features a rather intimidating disclaimer:

 Note: Bandwidth.com does not provide support for these configurations and they are not guaranteed to work. The above config is also very old and possibly out of date. It would be best to contact the PBX vendor - Cisco - for help with getting this to work with the bandwidth.com service.

Bandwidth.com wasn't kidding about not helping to configure your router.  Their tech support people were polite and knew plenty about SIP, but the only Cisco specific information I was able to get out of them was a link to that forum thread.

The suggested remedy of contacting Cisco for help was also a non-starter, as the maintenance contract on the router we were using was long expired.

And now for a disclaimer of my own:  The configuration below worked for me, but may not be correct or complete for your application.  IP addresses and phone numbers have been changed to protect the innocent.  This information is worth exactly what you paid for it, and I do not intend to provide free tech support for it or even answer any questions about it.

First define some voice service parameters.  The "no supplementary-service sip" commands are necessary to get transfers, call-forwarding, and voicemail to work with Bandwidth.com.
!
voice service voip
 allow-connections sip to sip
 no supplementary-service sip moved-temporarily
 no supplementary-service sip refer
 fax protocol cisco
 sip
  bind control source-interface FastEthernet0/1
  bind media source-interface FastEthernet0/1
!
!
Define codecs to negotiate.  Calls to some area codes did not work until I added the g729br8 codec.
!
voice class codec 1
 codec preference 1 g711ulaw
 codec preference 2 g729r8
 codec preference 3 g711alaw
 codec preference 4 g729br8
!
!
!
Rule 2 translates outbound calls before they are sent to the SIP trunk.  The local area code is 906.
!
voice translation-rule 2
 rule 1 /^9(.......)$/ /+1906/
 rule 2 /^9(..........)$/ /+11/
 rule 3 /^9(.*)$/ /+1/
 rule 4 /^9(...........)$/ /+1/
 rule 5 /^9011(.*)$/ /+1/

Rule 3 translates inbound SIP calls to local 3-digit extensions.  Ext 380 is the CUE AutoAttendant, 400 is an extension or hunt group.
!
voice translation-rule 3
 rule 1 /+19065551212/ /380/
 rule 2 /+19065551213/ /400/
 rule 3 /+19065551214/ /400/
 rule 4 /+18005551212/ /380/
Apply the translation rules to translation profiles
!
voice translation-profile SIP-IN
 translate called 3
!
voice translation-profile SIPCALL
 translate called 2
!
You are going to need a transcoder, so define dspfarm services
!
voice-card 0
 dspfarm
 dsp services dspfarm
!
!
!
There is nothing special about the interfaces.  For simplicity, I am not showing any NAT.


192.168.10.1 is the local LAN

192.168.10.2 is the Cisco Unity Express (CUE) voicemail

10.10.100.88 is the "outside" WAN interface that connects to Bandwidth.com
!
interface FastEthernet0/0
 description $FW_INSIDE$$ETH-LAN$$INTF-INFO-FE 0/0$
 ip address 192.168.10.1 255.255.255.0
 no ip redirects
 no ip unreachables
 ip virtual-reassembly
 duplex auto
 speed auto
!
interface Service-Engine0/0
 ip unnumbered FastEthernet0/0
 no ip redirects
 no ip unreachables
 ip flow ingress
 service-module ip address 192.168.10.2 255.255.255.0
 service-module ip default-gateway 192.168.10.1
!
!
interface FastEthernet0/1
 ip address 10.10.100.88 255.255.255.0
 ip access-group WAN-SIP in
 ip verify unicast reverse-path
 no ip redirects
 no ip unreachables
 no ip proxy-arp
 ip virtual-reassembly
 duplex auto
 speed auto
 no cdp enable
 service-policy output SDM-Pol-Ethernet1
!
Some basic static routes
ip route 0.0.0.0 0.0.0.0 10.10.100.1
ip route 192.168.10.2 255.255.255.255 Service-Engine0/0
!
!
A simple WAN access-list that allows SIP connections from the Bandwidth.com peers, and RTP (UDP >1024)

The RTP traffic can come from anywhere, not just from the SIP peers.
!
ip access-list extended WAN-SIP
 permit tcp host 216.82.224.202 host 10.10.100.88 range 5060 5061
 permit tcp host 216.82.225.202 host 10.10.100.88 range 5060 5061
 permit udp host 216.82.224.202 host 10.10.100.88 range 5060 5061
 permit udp host 216.82.225.202 host 10.10.100.88 range 5060 5061
 permit ip host 75.151.219.185 host 10.10.100.88
 deny   tcp any any eq telnet
 deny   tcp any any eq 22
 permit udp any host 10.10.100.88 gt 1024
 deny   ip any any log
!

Define SCCP
!
sccp local FastEthernet0/0
sccp ccm 192.168.10.1 identifier 1 priority 1 version 3.1
sccp
!
Here is where the transcoder is bound to SCCP
!
sccp ccm group 1
 associate ccm 1 priority 1
 associate profile 1 register XCODER

And here is the transcoder definition.  The 4 codecs here worked for me.
!
dspfarm profile 1 transcode
 codec g711ulaw
 codec g711alaw
 codec g729abr8
 codec g729r8
 maximum sessions 8
 associate application SCCP
!

Dial-peer for all the CUE extensions
!
dial-peer voice 380 voip
 destination-pattern 38.
 b2bua
 session protocol sipv2
 session target ipv4:192.168.10.2
 dtmf-relay rtp-nte
 codec g711ulaw
 no vad
!

Two dial-peers for outgoing SIP calls.  One for each SIP peer IP address.
!
dial-peer voice 101 voip
 description ** Outgoing call to SIP trunk **
 translation-profile outgoing SIPCALL
 destination-pattern 9.T
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.224.202
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 clid network-number 9065551212
 no vad
!
dial-peer voice 102 voip
 description ** Outgoing call to SIP trunk **
 translation-profile outgoing SIPCALL
 destination-pattern 9.T
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.225.202
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 clid network-number 9065551212
 no vad
!
Two dial-peers for incoming SIP calls.  One for each peer address.
!
dial-peer voice 201 voip
 description ** Incoming call from SIP Trunk ***
 translation-profile incoming SIP-IN
 b2bua
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.224.202
 incoming called-number .%
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 no vad
!
dial-peer voice 202 voip
 description ** Incoming call from SIP Trunk ***                           
 translation-profile incoming SIP-IN
 b2bua
 voice-class codec 1
 voice-class sip dtmf-relay force rtp-nte
 session protocol sipv2
 session target ipv4:216.82.225.202
 incoming called-number .%
 dtmf-relay rtp-nte
 ip qos dscp cs5 media
 ip qos dscp cs4 signaling
 no vad
!

Add the lines below to your "telephony-service" config to make the transcoder work.
!
telephony-service
 sdspfarm units 1
 sdspfarm transcode sessions 8
 sdspfarm tag 1 XCODER



Thursday, May 29, 2014

Back from the dead, sort of

It has been a while since hosting problems put the old MikeMcarthur.net website out of its misery.

Now I am playing around with alternative ways to bring it back from the dead -- without shelling out any money.  This will probably involve posting some of the old articles (the ones that aren't hopelessly dated, anyway) as I resurrect them from old GeekLog backups.