Tuesday, September 20, 2016

Destiny: The Rise of Iron

Xbox destiny player? Do you have a physical copy of Destiny that you have to put in the xbone every time you play? Buy the xbox360 digital upgrade collectors edition instead of the rise of Iron DLC and free yourself from your disk :D It's £9 more than the DLC; then you can gift your disc to someone who hasn't got Destiny.

Wednesday, March 16, 2016

A year later ...

Wow, a whole year goes by so quickly ...well the Windows 10 international UK keyboard is no better than the Windows 8 was. Way to go MS. In fact the issue is worse because if you use a 3rd party International UK keyboard to get at diacritics you lose Cortana (yes really!). Cortana relies on a bunch of regional settings to decide whether she/it works in your region, and changing the keyboard breaks something. Still working on fixing that :D
I am now an Xbox one owner, it has some cool hardware features, but is a bit let down by the functionality provided by the operating system at the moment (as of March 2016):

  • It has IR emitters and can control things!
  • It has IR receivers for its' own remote
  • 802.11a/g wireless
  • Plays 3d blu-ray
  • Instant on mode
  • Voice commands
  • Facial recognition
  • so called "2nd screen" xbox glass as remote
  • REMOTE STREAMING TO A PC!!!
Downsides unfortuately:

  • Instant on mode consumes ~10W as far as I have measured (way too much).
  • The IR controls are limited to doing what the xbox knows how to do, no macros can be recorded and played back :(
  • Facial recognition for login is fooled by change of hair cut :(
  • No wake on LAN (not sure how xbox glass turns the machine on from standby, but it's not WOL).
  • You can't change the "resume on power" action for the xbox, when the power comes back the xbox stays off, even when it was in instant on mode.
Why do you care? Well remote streaming to your PC when you share the TV with the family is a serious bonus, I game from my office while my partner and or family are watching TV; but having to interrupt everyone to turn the xbox on is not a good thing (you need to see the screen to login). Plus having the xbox emitting IR commands while you're playing remote is going to annoy the rest of the family. Plus 10W on standby !!! arrrgh!! (knock, knock, are you playing? yes. Can you stop changing the volume please!)
So my solution is evolving. I have an IR blaster from Microsoft (media centre IR extender, bought for a long defunct media PC to go under the TV). I have a PI (I will need to check how much power it uses :D) the Xbox can be turned on via IR from full off (where it consumes less than 1W). I will set the Xbox's IR output to use a TV/Cable box/Audio remote that won't affect my devices, the PI can listen for these codes and "emit" the right ones for my TV etc. Plus the PI can remotely turn on the Xbox via IR, it will know when the Xbox is on as well! (the xbox will emit the on signal for a TV). I will put a mains timer plug on the Xbox and the pi to pull the power during the night and provide a hard reset for the Xbox and the PI, (so when I am remote I only have to wait a day to get the kit hard reset).
Other thoughts: have the PI display through the in hdmi of the xbox, get the pi to record IR sequence sign in so that I don't have to have the xbox always sign in as me with no password, use a PI zero (it can be setup as a USB slave rather than as a controller and therefore be a HID, no IR at that point).
I better get cracking.

Friday, March 13, 2015

I noticed that the international options on Windows UK English for windows 8 were a bit poor, but I hadn't realised how poor until I started using Duolingo on my Chromebook to learn Swedish (the Chromebook has UK International English keyboard support built in after a fashion, there's a Chromestore install to add it). Here's the fix you need to be able to type all those odd characters like ß and ¿ and «» and if you prefer to type your own curly quotes rather than rely on word to screw you over ( “” & ‘’) http://www.zolid.com/uk-intl-kb/index.htm

Monday, March 2, 2015

Call Routing with the Siemens n300ip

Call Routing with the Siemens n300ip

We've had one of these DECT IP phone boxes for quite a while. In fact we've had two, but the first one had a 10Meg half duplex interface which caused a lot of grief, which caused us to get the current one.
Why did we get a DECT VOIP phone? Because I was trying to save money of course! A small amount, granted. The idea was that we would drop our phone line and just rely on cable internet with VOIP for our house phone and mobiles to cover any outages. This worked well for 3 years. The calls were cheaper and the quality better, plus we had features on the VOIP line we would have had to pay for with a land line:
  • Voicemail to email
  • Incoming CLID
  • Itemised billing
Plus we could use our number even when we were away from home by logging in with MicroSIP.
Sadly our cable provider kept hiking up the price in increments, and eventually an offer came along that offered more bandwidth with a land line for less money, and with the added bonus of free outbound weekend calls. (I am aware that Virgin did free weekend calls, but the additional cost for the land line was more than we spend on calls).
How to integrate these free calls into the current network? Well the n300ip has dial plans, they are basic but could be configured to route calls through either VOIP or the land line based on the number dialled. However the one thing it doesn't have is any logic related to dates and times. If BT's calls were cheaper than SIPGATE we might forgo the CLID and the itemised e-billing and the network voicemail, but during the week they aren't. 

Timed call routing on the cheap

The solution is a nifty script I popped together in python, the script uses libCurl, runs on Linux or Windows with suitable addition of libCurl and need python 3.3 (I leave it as an exercise for the more able to convert it so that it runs on all Python version.

The script runs Saturday morning when our server wakes from its slumber and again on Monday morning.
The call plan fields were captured by using wireshark and then edited using VIM, the script has to do session cookie handling for the password cookie, because I couldn't get libCurl (or Curl for that matter) to persist session cookies.
The functionality of the script is login, upload the call plan and then logout. The parameter is to toggle between enable.txt and disable.txt (the two call plans, enable puts UK landlines beginning 01 and 02 through the fixed line and disable.txt undos this by disabling those call plans). The script is very simple, if you change the call plans it will overwrite them.

Python Code

#!/usr/bin/env python3
import pycurl
from io import StringIO
try:
    from io import BytesIO
except ImportError:
    from StringIO import StringIO as BytesIO

import email

import argparse

def enable_disable(string):
     valid_values = ['enable','disable']
     value = str(string)
     if not value in valid_values:
        msg = "action is either enable or disable, you typed " % string
        raise argparse.ArgumentTypeError(msg)
     return value

parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('action', choices=['enable','disable'] , nargs = 1,
                   help='either enable or disable, set the dialplan in enable.txt or disable.txt')

args = parser.parse_args()

def CallPlanFileName(x):
        return {
        "enable" : 'enable.txt' ,
        "disable" : 'disable.txt' }[x]

filename = CallPlanFileName(args.action[0])

#print (args.action[0])


## Callback function invoked when body data is ready
def stdout(buf):
    # Print body data to stdout
    import sys
    sys.stdout.write(buf)
    # Returning None implies that all bytes were written

## Callback function invoked when header data is ready
def stderr(buf):
    # Print header data to stderr
    import sys
    sys.stderr.write(buf)
    # Returning None implies that all bytes were written

body=BytesIO()
header=BytesIO()

c=pycurl.Curl()
c.setopt(c.URL,'http://192.168.XX.XX/login.html')
c.setopt(c.POSTFIELDS, 'language=1&password=XXXX')
c.setopt(c.WRITEFUNCTION, body.write)
c.setopt(pycurl.HEADERFUNCTION, header.write)
c.setopt(c.COOKIEFILE, '')  #Make Curl Cookie aware
c.perform()

with open('header.txt','wb'as h:
    h.write(header.getvalue())

with open('body.txt','wb'as b:
    b.write(body.getvalue())

request_line, headers_alone = ((header.getvalue()).decode('ISO-8859-1')).split('\r\n',1)
mhead = email.message_from_string(headers_alone)

print (mhead.as_string(True))
cookies = mhead['Set-Cookie']
print (cookies)
c.setopt(c.COOKIE, cookies)

with open(filename,'r'as f:
    data=f.read()
    c.setopt(c.POST,1)
    c.setopt(c.POSTFIELDS, data)
    c.setopt(c.URL,'http://192.168.XX.XX/settings_telephony_dialplan.html')
    c.perform()

c.setopt(c.URL, 'http://192.168.XX.XX/logout.html')
c.perform()
c.close()

exit()

Call plans

Enable.txt

del_dprno=30&dpr0_0=50000&dpr1_0=0&dpr2_0=&dpr4_0=0&dpr0_1=999&dpr1_1=7&dpr2_1=&dpr4_1=1&dpr0_2=200&dpr1_2=0&dpr2_2=&dpr4_2=2&dpr0_3=101&dpr1_3=7&dpr2_3=&dpr4_3=3&dpr0_4=111&dpr1_4=7&dpr2_4=&dpr4_4=4&dpr0_5=090&dpr1_5=255&dpr2_5=&dpr4_5=5&dpr0_6=90&dpr1_6=0&dpr2_6=&dpr4_6=6&dpr0_7=01&dpr1_7=7&dpr2_7=&dpr4_7=7&dpr0_8=02&dpr1_8=7&dpr2_8=&dpr4_8=8&dpr0_9=0845&dpr1_9=7&dpr2_9=&dpr4_9=9&dpr0_10=0870&dpr1_10=7&dpr2_10=&dpr4_10=10&dpr0=&dpr6=1&dpr1=0&dpr2=&access_code_isdn=&access_code_mode_isdn=0&access_code_voip=&access_code_mode_voip=0&access_code_min_digits=4

disable.txt

del_dprno=30&dpr0_0=50000&dpr1_0=0&dpr2_0=&dpr4_0=0&dpr0_1=999&dpr1_1=7&dpr2_1=&dpr4_1=1&dpr0_2=200&dpr1_2=0&dpr2_2=&dpr4_2=2&dpr0_3=101&dpr1_3=7&dpr2_3=&dpr4_3=3&dpr0_4=111&dpr1_4=7&dpr2_4=&dpr4_4=4&dpr0_5=090&dpr1_5=255&dpr2_5=&dpr4_5=5&dpr0_6=90&dpr1_6=0&dpr2_6=&dpr4_6=6&dpr0_7=01&dpr1_7=7&dpr2_7=&dpr4_7=7&dpr0_8=02&dpr1_8=7&dpr2_8=&dpr4_8=8&dpr0_9=0845&dpr1_9=7&dpr2_9=&dpr4_9=9&dpr0_10=0870&dpr1_10=7&dpr2_10=&dpr4_10=10&dpr0=&dpr6=1&dpr1=0&dpr2=&access_code_isdn=&access_code_mode_isdn=0&access_code_voip=&access_code_mode_voip=0&access_code_min_digits=4

Cron

My server isn't on all the time, it shuts down in the evening and doesn't start up again until everyone is up and about. Initially I was puzzled why my script wasn't having any effect at the weekends. Of course I set the time of the cron job to be midnight Friday and midnight Sunday, both at times my server was asleep. Here's the solution I use:
#                    Test if it is Saturday
@reboot              test $(date +\%u) -eq 6 && ( cd $HOME/bin; ./BT_CallPlan enable ) >> ~/BT.log
#                    Test if it is Monday
@reboot              test $(date +\%u) -eq 1 && ( cd $HOME/bin; ./BT_CallPlan disable ) >> ~/BT.log

Other details:

Our cable provider was Virgin Media, we replaced this with BT Infinity 1 
  • Virgin (30M down 2.5M up) - usually 20M down 1M up
  • BT Infinity 1 (38M down 9.5M up) - so far 34M down and 9M up (much better for telecommuting)
Our VOIP provider is SIPGATE
I sold the Home Hub 5 (£35) and bought an Huawei FTTC terminal adapter/router (which I put custom firmware on).
We use a Buffalo Airstation running OpenWRT (with Asterisk running on it for VOIP), this also provides IPV6 via Hurricane Electric, 2.5 and 5 GHz wireless N and remote access. 
When we needed analogues phone lines I used an old BT voyager ADSL router (ADSL disabled) as an ATA (logged into Asterisk as an extension), of course we now have a real analogue line :) .
Virgin Media super Hub (very poor piece of kit), was set to Modem mode due to it's appalling WIFI drop out rates, and general lack of configurable options.


Tuesday, December 3, 2013

I have entered the IPv6 Arena.
My setup was a mash up of configurations from various folks, and connectivity is achieved through a tunnel from the folks at Hurricane Electric.

Before I launch into how I did my configuration: DANGER! DANGER Will Scarlet! - IPv6 is routable, all of it all the time; we have all got lazy sitting behind our NAT routers, not worrying about stuff getting at us directly from the internet. Once you correctly setup one machine on your network as an IPv6 gateway, the chances are that ALL your machines will suddenly be publicly available via IPv6.
You have been warned!


Howto:

Before you start, your external IP address should be returning ICMP packets if it is pinged. On Virgin Media cable this is turned off by default. You will need to turn it back on or you won't be able to establish the tunnel.
Sign up for an IPv6 Tunnel at Hurricane Electric's website (http://tunnelbroker.net/ or select Free IPv6 Tunnel Broker from the HE home page).
After filling out the new user form, it will ask you to pick your nearest end point. I'm in the UK and I couldn't see any advantage to trying to pick a site in the US for my tunnel, so I picked London. You can only connect one tunnel to your external IP, and once you're setup, all your internal network machines will have public addresses via a routed network. If you delete and setup your tunnel again those addresses will change.
This is where I made my first mistake, I assume you're only just familiar with IPv6 addresses, so read them carefully. My IPv6 address for my router was only 1 digit different from my routed network address, and this got me confused.
The Example configurations will lead you in the right direction, but I actually found them to be less than complete. I'm using Ubuntu 13.10, my IPv6 endpoint has a static network configuration (I am not using Network Manager, all my network configuration is done in /etc/network/interfaces).

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
address 2001:XXXX:YYYA:ZZZZ::2
netmask 64
endpoint 216.66.80.26
local 192.168.x.y
ttl 255
up ip -6 route add default dev he-ipv6
down ip -6 route del default dev he-ipv6

iface eth0 inet6 static
address 2001:XXXX:YYYB:ZZZZ::1
netmask 64

My mistake initially was not to realise that A and B were different :D

When you've setup your tunnel (you may stop there if only want one machine on your network to have IPv6 access to the internet), you will want to add two more things. Your internal network adapter will need an IPv6 address from the "routed IPv6" network (not the network that's wasted on your tunnel). And then you will need to advertise your route. 
The beauty of IPv6 is that it's all very self configuring, apart from a few niggles.
Once the tunnel's up, and the internal network interface has a "routed" address on it, you will need to advertise it to your local net. Install RADVD. It doesn't need any configuration, but here's where complication sets in: RADVD can advertise the IPv6 DNS, but Windows will only get IPv6 DNS from DHCPv6. Basically you end up setting up DHCPv6 just to advertise DNS for windows machines.
If your router also happens to be a webcache you can skip the routed address and RADVD in favour of http proxying over IPv4 and getting the cache server to do all the IPv6 magic.
My next trick is to try and make an all IPv6 machine that can still talk to the IPv4 internet.

Tuesday, January 22, 2013

We got hacked!
The house phone is an Asterisk PBX and our service provider is Sipgate. They informed me last Thursday that our system was compromised, due to some unusual call activity, but no more info than that. So we changed all our passwords for our SIP account. FAIL.
Saturday and Sunday and Monday saw more calls made; Sipgate support don't work weekends and we didn't notice until the call credit low warning hit my inbox on Monday evening. Another email to Sipgate, this time they tell us that our Asterisk PBX is making the calls, and no we can't have the money back. A quick check and lo! I allowed external guest extensions to connect to the PBX, and I didn't restrict the IP addresses of registering devices. DAMN! Ah well, you live and learn.
Fortunately Sipgate charge up front, and we only put £10 on at a time. The bad guys made off with £4-ish of calls, we don't have auto pay setup and we do get an alarm when the credit goes below £5. All told the most we can loose is £10 and this saves us £15 every month (no line rental).
So a quick crash course in securing Asterisk, and a dollop of iptables firewalling for the PBX and we're back up and running.

Friday, January 11, 2013

Three Challenge

Apparently 3/Three don't accept that I own the phone. Worrying; I suspect this is true for all mobile phone companies. Because I don't have the purchase receipt or the details of where it was originally bought, they won't accept that I am the owner. So what?
Well if the original owner phoned them up, read out the IMEI and said the phone had been stolen, they would block the phone. Fortunately they didn't register it, but I can't register it either.
My other motivation is that 3 will unlock the phone for £15.53 (apparently) whereas all the other places want about £24. I shan't be using 3 once the phone is unlocked ...
The system beggars belief to my mind; they sent me a SIM to my postal address, they can see from their network that I am calling from my handset (with the IMEI), you'd think they'd want to encourage people to register. At worst they've got some personal details they can bundle up and sell on (email, phone number address etc.) at best they've got that plus marketing data about the second hand market for their handsets, something they probably need to know about if they want to sell more new handsets.
Hopefully the seller will be forth coming with the store and the date of purchase which can then be used to confirm to three that I actually own the handset now and so it can be registered to me.
(and then promptly unlocked and switch to Giff Gaff :D).