Wednesday, November 28, 2007

VoIP & ISP update

I made a couple of changes to my configuration, one for practical purposes, and the other I was more or less forced to make.

The first change was that instead of using Asterisk to handle my SIP phone, I connected the SIP phone directly to the Voicenetwork.ca service. I did this as there seemed to be some jitter and "sputtering" going through Asterisk, probably because I am trying to do too much on that one Linux system (Mythtv, torrents, DVD burning, file sharing, video server, dynamic DHCP client, and so on.) The good news is that this so far is working great. The sound quality is very good, even when my wife called her sister over in Asia (for 2 cents per minute) ... and this is with a $12 cdn USB phone connected to a slow computer running X-Lite softphone.

The other change is with my ISP.

Teksavvy have changed pricing for some of their high-speed connection services. I was using "unlimited" for $29 /mth, but they are going to up the price for that service by $10 starting next year. Their Premium service, which runs at the same speed, but uses improved routing and better "ping times", also goes for $29/mth, and still does. I went with unlimted originally as the premium package was limited to 100GB download per month. To make up for the raise in pricing for unlimited, they bumped the premium package up to a 200GB / mth download limit, with prepaid upgrades of $10 per 100GB if needed. Since I usually use just over the 100GM per month in most cases, the 200GB should do me just fine.

So all in all, things are looking good ... I may put together another PC I have sitting in my closet unused to run as a dedicated Asterisk server to see if that works without degrading sound quality and stability, but that's for later on.

Monday, November 19, 2007

Bell Mobility - WARNING

I have a teenage daughter, and naturally she wants to be able to chat with her friends on a "hip" cell phone. She readily admits that real functionality has little to do with what she wants. She already has an 30GB video iPod, a 6 or 7 Mega pixel pocket sized digital camera and a functional cell phone, but it's not cool enough to be used with her friends around ... so off we go this weekend to find her a Cherry LG Chocolate 800.

Well, when she approached me with the request, she had already done some research and showed me the Bell Mobility plans that included this phone ... I should have done my own research, but she came to see me late in the week, and I was busy trying to figure out what to get for my wife's birthday this weekend, so I gave it a quick going over and said we'd drop in and pick it up as we were doing our regular weekend chores.

So I drop into the Bell store in the Eaton Centre, go through the nonsense that Bell puts you through in order to obtain the privilege of paying them too much for their crap, and about 45 minutes later my daughter had her Cherry LG.

So I get home, and my daughter disappears into her bedroom to play with her phone. A few hours later she come out and asks if I can help her with her phone as she can't seem to find any easy way to get media on and off the phone.

I start reading the manual and going on line to see what can be done (there is a USB cable that comes with the phone, and it supports bluetooth, but there is no CD that comes with the Bell Mobility version of this phone, so there is nothing obvious as to how to manage your phone from your computer.

First I try bluetooth from my laptop ... I figure out how to do this, so I at least have a way to add music to the phone, and get the pictures and video off if it as well, without having to pay Bell for storage and transfer surcharges.

Next, I try to figure out the ringtones. There are a few built in ringtones, but no obvious way to use your own ringtones. Supposedly the only way to get ringtones on a Bell Mobility phone is to pay Bell for their rigntones and download them paying data rates for the download as well.

Now, that's not acceptable in my opinion ... I buy a phone, it is my phone, and there is no way the person who sold me the phone should be allowed to prevent me from using that phone to its full capacity. Bell Mobility also cripples the phones by hard coding the network information into them, ie, no sim cards on Bell Mobility phone, if you are dissatisfied with Bell Mobility service and cancel your account, your cell phone is pretty well useless. You either resell it to someone who has a Bell Mobility account, or throw it in the garbage.

Anyway, back to the ringtones. I was able to find some software that allowed me to look at the file system of the phone, and with a little experimenting I was able to get an mp3 file into the "Downloads" folder of the phone, which then allowed me to select that file as a ringtone (the actual ringtone directory on a Bell Mobility phone has been modified to be located in the phones firmware, so you can't add ringtones the easy way, simply adding MP3 files to the ringtone folder ), but when I have this file selected as a ringtone, the phone doesn't actually "ring" while it is selected (the phone does everything it should when a call comes in, it lights up, shows the number, etc, it just doesn't make any sounds.)

It was getting late, so I gave up for the night, but I will get back to it tonight or tomorrow night, and see if I can fix this problem (I'm assuming that it's the format of the MP3 file that is unsuitable for use as a ringtone, or it may be that I need to edit some of the other files in the Download folder to "describe" the file for the phone. Worst case I believe I can download a normal ringtone or two and just replace the MP3 files that were downloaded with my own (the displayed information will probably be wrong, but the MP3's should work.)

I have purposely left any information on the tools I used so far out of this post as I don't want people wasting their time on something that doesn't work (yet.) After I finish playing around with this I will post all the information (successful or not) so others can either make use of my work, or in the case of failure on my part, maybe pick up where I left off and possibly find a solution.

Anyway, Bell Mobility ... you really suck. It's my damn phone and who the hell do you think you are breaking it and then charging me a premium for doing so? This will certainly be the last Bell Mobility phone I will ever own, and I would advise anyone who is the least bit interested in using their phones for the purposes they were designed to be used for, to avoid Bell Mobility as well.

Speak-out 7-11 pay-as-you-go

I believe I've mentioned this before, but if not, I was searching for a cheaper cell phone plan when I happened upon The Unofficial 7-Eleven Speak Out Wireless Canada Consumer Page. It spoke of a deal from 7-11 where for $100 you get $100 of air-time ($0.20 per minute local) plus a new phone (which also included 5 minutes air time.) So for $100, you get a free phone and $105 of air time. And, the air time has a 365 day expiry "limit".

Since I don't spend a lot of time on the phone, nor does my wife, and we are paying $100 /mth ($1200 a year) for two cells phone, this $100 deal, even if I need to add an additional $200 or $400 of air time over the year (doubtful) I still come out ahead.

So my first attempt to get this deal (about a month ago) failed, as all the phones were sold out, and the deal was not on any more. The lady behind the counter did tell me that they were going to bring back the deal and the phone shipment was due in on Nov 15th.

So this weekend I head down to the local 7-11 and sure enough, the deal was on and phones were available. $228 later ($100 each for the two phones, plus taxes) and away I go with two active working phones each with 525 minutes of airtime (well, not really as there is about a $0.99 per month 911 charge, so you lose 3 minutes a month, but I can live with that.)

I should mention, the lady that sold me the phone was very friendly and seemed to be quite knowledgeable as I double checked on some information such as sim card capability with Rogers and phone number portability and she assured me both should be no problem.

So I get home, pop open my phone, swap out the sim cards, put the phone back together, power it up, and all phones worked as they should. My Rogers cell phones were now on the Speakout network and my new speakout phones were running on the Rogers network (no surprise here as Speakout uses the Rogers network anyway, but you never know.)

Next steps:

1) Get my Rogers phone numbers ported over to my Speakout account. Called Speakout customer service this morning and checked to make sure my numbers were portable ... they are ... and to check all the information they would need from me in order for them to be able to make the change. They need the account number, any password associated with the account, and the INEI/ESN number of the phone (usually found inside the phone under the battery) Since I called from work, and I didn't have all the phones with me I will gather the information tonight and call them again.

2) Cancel my Rogers account. I need to leave this account active until the numbers are ported over (2 or 3 business days from request date.) I suspect that I will have to pay a $200 early termination penalty, but that's ok, I'll still save a bundle this year.

Stay tuned.

Friday, October 12, 2007

openVPN - Homing from work.

The company I work for has graciously set up a VPN (Virtual Private Network) to allow me to be able to work for them at all hours of the day or night, so I figured, heck, why not return the favour and set up my own VPN so I could be "home" at all hours of the work day?

Besides, this would make connecting to the Asterisk server a lot easier as a VPN hides all the NAT issues that so plague the SIP VoIP standard.

So here is the process I used to get my VPN working.

First a summary of what I did:

1) Install openvpn on my MythDora box
2) Generate the necessary certificate files for server and clients
3) Configure the openvpn server on the MythDora box
4) Copy over the client certificates to my laptop
6) Download the Openvpn compatible client and installed it on my laptop
7) Configure the Openvpn client
8) Configure your home router
8) Test the connection
9) Configure openvpn server to start on reboot.

Install openvpn on my MythDora box:

From my home Linux box (same one I used for both MythTV and Asterisk) I open a terminal session and type:

#yum install openvpn
This installs the openvpn software and creates these two directories:

For the tools needed to create certificates: /usr/share/openvpn/easy-rsa/2.0/
Config examples: /usr/share/doc/openvpn-2.1
Generate the necessary certificate files for server and clients:

Now the "hard part" (Actually everything went pretty smooth.) You can find the basic quick start instructions here, but these instructions take your through a lot of steps that your don't need to go through, such as installing the software in some other manner than by using the "yum" command above. The configuration and certificate creation information still applies, but rather than just send you over to read some long document and try to figure out what to ignore and what is important on your own, here is what I did (keep in mind, my Linux distribution is MythDora 4.0, different distributions may not work the same way.)

In the /usr/share/openvpn/easy-rsa/2.0/ directory you need to initialize your "certificate authority", you do this by running the following (note, you can edit the vars file to change the "export KEY_SIZE=1024" entry to "export KEY_SIZE=2048" if you feel you need the extra security ... I did, as I am connecting from work, I don't want to take any unnecessary chances) :

# . ./vars
# ./clean-all
# ./build-ca
When you run the ./build-ca program, you will be promoted for information, it's really not that important what you respond with, but it should make some sense Ex: in my case:

Country Name (2 letter code) [KG]: CA
State or Province Name (full name) [NA]: Ontario
Locality Name (eg, city) [BISHKEK]: Toronto
Organization Name (eg, company) [OpenVPN-TEST]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:MythTV
Email Address [me@myhost.mydomain]
Next you need to create the "server certificates", you do this by running the following command:

./build-key-server server


When prompted for the "Common Name" enter the word "server". The following two promts that require input, I answered "y".

Now, you will need to create the "client certificates", note that you will need to run this process as many times as the number of machines that you will be connecting to your VPN. In my case I only have one laptop that I want connected, so I only needed to run this "client certificate creation" process one time (I ran it twice though to create a second set of certificates just in case I wanted to use them on another system, maybe give a set to my brother so he could VPN into my network and have his own extension off my Asterisk later on?) Each time you run this process, use a unique "Common Name". In my case I just used "client1" and "client2". Again, the last two prompts of each client certificate build process I responded "Y".

./build-key client1
./build-key client2
Next we create our " Diffie Hellman parameters" by running the following:

./build-dh
This will take several minutes so be patient.

Configure the openvpn server on the MythDora box:

So, now we can look in the /usr/share/openvpn/easy-rsa/2.0/keys directory and see a bunch of files. These are your certificates and related files. To make them easier to find in the future I created a directory /etc/openvpn and copied the /usr/share/openvpn/easy-rsa/2.0/keys to there:

# mkdir /etc/openvpn
# cp
/usr/share/openvpn/easy-rsa/2.0/keys /etc/openvpn/.
Now we need to create the configuration files for the server and client. The recommended procedure is to copy the example files over from the examples directory mentioned above and modify them for your purposes, but I will provide you with the configuration I used and highlight the parts that you may want to change for your own configuration. Keep in my that in my configuration I have an internal network of 192.168.1.0/255.255.255.0 and the VPN will create a virtual adapter on my Linux server with the subnet 10.8.0.0/255.255.255.0 to which the VPN clients will be part of when they connect.

The clients, when they run the VPN client software will connect to my MythDora server as 10.8.0.x ("x" being some number between 2 & 254) and see the MythDora server as 10.8.0.1

First the server configuration file (/etc/openvpn/server.conf):

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one. You will need to
# open up this port on your firewall.
port 1194

# TCP or UDP server? I used TCP as I have to
# traverse two NAT firewalls and UDP sucks at
# that depending upon the routers and firewalls
# being used.
proto tcp
;proto udp

# Read the config file or documentation to figure this one out
# but I would suggest you just leave it as is.
dev tun

# These are your server certificates.
# If you put them somewhere else, change the localtion
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
# server.key is your private certificate, keep it private (secret.)

# 2048 bit keys. If different location, then update path.
dh /etc/openvpn/keys/dh2048.pem

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.8.0.0 255.255.255.0

# Maintain a record of client <-> virtual IP address
# associations in this file. If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt

# Push routes to the client to allow it
# to reach other private subnets behind
# the server. Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
push "route 192.168.1.0 255.255.255.0"
# In my case I wanted any client connecting to the VPN
# to know to go through the VPN to get to the
# 192.168.1.0 network.
# You may have different requirements
# or a different network config.

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120

# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
user nobody
group nobody

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it. Use one
# or the other (but not both).
log openvpn.log
log-append openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3

# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
mute 20

I've left out a bunch of other parameters that could be used, so have a look through the various example config files, or read the documentation to see what else can be configured.

Copy over the client certificates to my laptop:

OK, next we need to copy over the following files to your client machine:

ca.crt
client1.crt
client1.key

Note: this is for "client1", if it were for "client2" you'd copy over the "client2" files and the common "ca.crt" file.

The way you do the copy is not important, except that the more secure method you use the better ... moving the files by floppy and destroying the floppy after you're finished is pretty safe ... sending the files by email or on a public BBS is a pretty damn poor way to go about it ... I used sftp which is very safe, and convenient if you have a sftp client such as filezilla.

Download the Openvpn compatible client and installed it on my laptop:

You can use which ever openvpn compatible client you wish, I used this one (the OpenVPN GUI for Windows) so naturally, the instructions below are for the client I used.

This is a standard windows install, simply download the client installer and run it.

Configure the Openvpn client:

First, you need to move the client certificates you copied over to your client machine into the "C:\Program Files\OpenVPN\config" directory.

Next you need to edit the "C:\Program Files\OpenVPN\config\client.ovpn" file and make the following edits:

Make sure "dev tun" is uncommented and "dev tap" is commented out

Uncomment "proto tcp" and comment "proto udp".

edit "remote my-server-2 1194" to change "my-server-2" to your hostname (if you have a registered domain name for your home network and a static address, then use that, if not I suggest you open a free dynamic DNS account, set up a free domain name under one of their main domains and set up your router to update their records, or download and run one of their clients ... I'll create a separate posting later to explain how to do this in more detail later.

Make sure the proper certificates are being specified, and that they are in the "C:\Program Files\OpenVPN\config" directory, the default client.ovpn file has these as the defaults and should be left as such unless you moved the certificates somewhere else or used a different Common Name than "client1".:
ca ca.crt
cert client1.crt
key client1.key

Configure your home router:

You will have to forward tcp port 1194 to your MythDora box. For testing purposes you should make the MythDora box the "DMZ host", then once you confirm everything works, turn off the "DMZ Host" access and just forward the single 1194 TCP port.

Each router is different in how you make this configuration, but generally speaking the options you are looking for are called "DMZ" and "Port Forwarding".

Test the connection:

To fully test the connection you will need to go to the office and do the final test from there. Before I did this I decided to configure my router to make my MythDora machine the "DMZ" host, meaning it was basically sitting out on the Internet and could be accessed using the external real IP address. I would recommend that you shut down all the other services like MythTV, apache, webmin, vncserver, smb, tftp, cvs, nfs, mysqld, and any other service that a hacker might use to gain easy access to the system. I could then access my server via ssh mythtv@ and make any necessary configuration changes in case the VPN failed.

Once at the office I ssh (I use putty as my ssh client) to my MythDora server, log in and "su" to root, and start up a temporary openvpn session (I actually open two connections to my MythDora box so I can look at the logs if necessary.)

To start the openvpn session type:

/usr/sbin/openvpn /etc/openvpn/server.conf
The session may seem to hang, but it is actually doing somthing.

Now you can run the Windows openvpn client and see if it will connect to your server. If not, in the /etc/openvpn directory you will find a couple log files, openvpn.log being the most useful one for troubleshooting. You can also right click on the Windows openvpn client icon in the system tray and select "View Log" to examine what's going on from the client side.

You can test the actual connection by opening a new ssh session on your laptop and trying to ssh to the openvpn virtual adapter address, 10.8.0.1 by default. If you can get a log in prompt and actually log in using that address, then everything else should work fine.

Configure openvpn server to start on reboot:

As root run the command:
# chkconfig openvpn on

---------------------------------------------

Note 1: in order to use this VPN it is probably best to have a domain name to use, especially if you are like most home users and have an external IP address that can change at any time.

To this end I used the Dynamic DNS servers from www.dyndns.org, which is free and handles the problem of having a "dynamic IP address". I will create a new post detailing the registration, installation and configuration of this service soon.

Note 2: At the moment my SIP client software on my laptop running over the VPN can make and accept telephone calls (SIP,) but for some reason the actual voice stream (rtp) is not passed on ... I haven't had a chance to investigate this, but I recall reading that this is a common problem with a relatively simple fix as I recall, but I haven't have an opportunity to research the problem ... when I find the fix for this problem I will post it.

Wednesday, October 10, 2007

Configuring Asterisk with Voice Network Inc VoIP / SIP service

After installing Asterisk and subscribing to a VoIP DID and PSTN Gateway service the next step was to configure the Asterisk server to actually do some meaningful work.

So here was my basic plan: I would set up some simple 'softphone' software on the family's PCs, give them each an extension and mail box on the Asterisk, then connect the Asterisk to the 'Voice Network Inc' VoIP services.

Then I would configure the Asterisk to: allow calling between extensions (so I can take my laptop to work and call my wife's or daughter's extension just as though I was at home;) allow incoming calls to be answered by Asterisk which then prompts for the caller to enter an extension; allow any of the extensions to make outgoing calls over the PSTN Gateway.

Note: Since one must already know the extension to enter when calling, the first stage of this project will only be used for friends and family whom I provide the extension numbers to use. I will not have a default as yet, as there is no charge for incoming calls, so if telemarketers get frustrated trying to get a valid extension, and can't "zero out" to an operator, big deal ... they can just hang up. Maybe later on, if and when I'm ready to make it a more general access system I'll build a better menu system that allows others to access a "general extension" to ring an extension, or leave a voice mail, but for now that isn't a priority.

The first step was to get a 'softphone' to use for initial testing (later on if this works I can buy some hardware based IP phones, but for now free software based phones will do for what I need.) The most popular VoIP softphone seem to be the X-Lite softphone from CounterPath. You can download a version of X-Lite for Linux, Mac, or Windows.

So with those requirements in mind, here are the related configuration files (note, an Asterisk install usually comes with some example configuration files, the ones I modified I did so by renaming the long and detailed sample files and building my own from scratch. I'll get around to examining the samples as they probably have some good information in them for some of the more advanced features, but that's for later.)

I will use "numbers" to reference comments to prevent as many unnecessary and confusing line wraps as possible.

extensions.conf:
[globals] ;Note 1
OUTBOUNDTRUNK=SIP/voicenetwork_peer
USER1=SIP/user1
USER2=SIP/user2

; VOICE NETWORKS START
; Edit your EXTENSIONS.CONF and place the following information in it
;
[voicenetwork-incoming] ;Note 2
exten => [Assigned DID],1,Goto(s,1) ;2a
exten => s,1,Answer() ;2b
exten => s,2,Wait(1) ;2c
exten => s,3,Background(vm-extension) ;2d
exten => s,4,WaitExten(15) ;2e
exten => i,1,Playback(pbx-invalid) ;2f
exten => i,2,Goto(voicenetwork-incoming,s,1) ;2g
exten => t,1,Playback(vm-goodbye) ;2h
exten => t,2,Hangup() ;2i
exten => 101,1,Dial(${USER1},10) ;2j
exten => 101,2,VoiceMail(u101@default) ;2k
exten => 101,3,Hangup() ;2l
exten => 101,102,VoiceMail(b101@default) ;2m
exten => 101,103,Hangup() ;2n
exten => 102,1,Dial(SIP/user2,10) ;2p
exten => 102,2,VoiceMail(u102@default) ;2q
exten => 102,3,Hangup() ;2r
exten => 102,102,VoiceMail(b102@default) ;2s
exten => 102,103,Hangup() ;2t
exten => 500,1,VoiceMailMain() ;2u

; To use VoiceNetwork.ca to termination your calls
; add the following line to your extensions.conf file
;
[outbound-local] ; Note 3
exten => _9NXXXXXXXXX,1,Dial(SIP/voicenetwork_peer/${EXTEN:1})
exten => _9NXXXXXXXXX,2,Congestion()
exten => _9NXXXXXXXXX,102,Congestion()

[outbound-long-distance] ; Note 4
exten => _91NXXNXXXXXX,1,Dial(SIP/voicenetwork_peer/${EXTEN:1})
exten => _91NXXNXXXXXX,2,Congestion()
exten => _91NXXNXXXXXX,102,Congestion()
exten => _9011.,1,Dial(SIP/voicenetwork_peer/${EXTEN:1})
exten => _9011.,2,Congestion()
exten => _9011.,102,Congestion()

;
; VOICE NETWORKS END



[internal] ; Note 5
include => outbound-local
include => outbound-long-distance
exten => 101,hint,SIP/user1
exten => 101,1,Dial(SIP/user1,10)
exten => 101,2,VoiceMail(u101@default)
exten => 101,3,Hangup()
exten => 101,102,VoiceMail(b101@default)
exten => 101,103,Hangup()
exten => 102,hint,SIP/user2
exten => 102,1,Dial(SIP/user2,10)
exten => 102,2,VoiceMail(u102@default)
exten => 102,3,Hangup()
exten => 102,102,VoiceMail(b102@default)
exten => 102,103,Hangup()
exten => 500,1,VoiceMailMain()
exten => 611,1,Echo()

; Note 6
[asterisk_guitools]
exten = executecommand,1,System(${command})
exten = executecommand,n,Hangup()
exten = record_vmenu,1,Answer
exten = record_vmenu,n,Playback(vm-intro)
exten = record_vmenu,n,Record(${var1})
exten = record_vmenu,n,Playback(vm-saved)
exten = record_vmenu,n,Playback(vm-goodbye)
exten = record_vmenu,n,Hangup
exten = play_file,1,Answer
exten = play_file,n,Playback(${var1})
exten = play_file,n,Hangup
hasbeensetup = Y

[numberplan-custom-1]
plancomment = DialPlan1
include = default
include = parkedcalls
include = parkedcalls

[timebasedrules]
Note 1: This is where you put global Variables. Global variables can save on typing and make reading the information more "human friendly". In this case I really only use one of these variables (USER1) later in the config file just to show how they work (see "2j".)

Note 2: This is the context to define what users in the voicenetwork-incoming context can do. Here's a detailed explanation:

2a:
exten => [Assigned DID],1,Goto(s,1) Replace "[Assigned DID]" with the phone number you selected when you purchased a DID from Voice Network Inc. This causes a call coming in on that "etension" to be transfered to the "s" extension at priority "1". Some VoIP SIP providers pass the phone number you purchased, some pass a special ID number. What I did in order to determine what was being sent was to set up a temporary voicenetwork-incoming context that had the following:
exten => _X.,1,Answer
exten => _X.,2,Wait(1)
exten => _X.,3,SayDigits(${EXTEN})
exten => _X.,4,Wait(1)
exten => _X.,6,Hangup
Which answers anything that comes in, speaks out the number it answered on, then hangs up. The Number it speaks is the number you need to use as the [Assigned DID]

2b:
exten => s,1,Answer() Answers the call

2c:
exten => s,2,Wait(1) Pause for a second

2d:
exten => s,3,Background(vm-extension) Ask use to enter an extension

2e:
exten => s,4,WaitExten(15) Wait for 15 seconds for the user to enter an extension

2f:
exten => i,1,Playback(pbx-invalid) The special "i" extension is called when a user enters an invalid extension. In this case it tells the caller they entered an invalid extension.

2g:
exten => i,2,Goto(voicenetwork-incoming,s,1) The caller is then sent back to the start: extension "s", priority "1".

2h:
exten => t,1,Playback(vm-goodbye) If a caller doesn't enter any extension number before the 15 second wait time, this causes a "timeout" and sends the process to the special "t" extension. It says "goodbye" to the users ...

2i:
exten => t,2,Hangup() ... and hangs up the call.

2j:
exten => 101,1,Dial(${USER1},10) If the user enters a valid extension, in this case if they enter the extension "101", they are taken to this section which dials the phone registered to user ${USER1} (USER1 is a global variable defined in the [globals] section that evaluates to "user1") for 10 seconds. If it is answered then it ends there, if not, after 10 seconds it goes to the next "priority" for that extension; in this case that is "priority" 2.

2k:
exten => 101,2,VoiceMail(u101@default) if the phone isn't answered within 10 seconds, the caller is sent to the voice mail define in the "voicemail.conf" file as voice mail box "101" in the "default" context. The "u101" reference plays a message to the caller telling them that the person at extension 101 is "unavailable" (ie. didn't pick up the ringing phone.) ...

2l:
exten => 101,3,Hangup() ... and then hangs up

2m:
exten => 101,102,VoiceMail(b101@default) This is similar to step "2k" in that it sends the caller to voice mail of the extension dialed. The difference here is that this step is reached only if the extension "rings busy", rather than simply is not picked up (ie. the user is already on the phone and has all the lines in use.) The "b101" tells the voice mail system to play the "user is busy, or already on a call" message when it takes the caller to to the voice mail system ...

2n:
exten => 101,103,Hangup() ... and then hangs up.

2p, 2q, 2r, 2s, and 2t are the same configuration as 2j,2k,2l,2m & 2n except they are for "user2" rather than "user1" (you can create more users by replicating these lines with a new user name, extension number, and voice mail box number.) The only notable difference is in step "2p" where instead of using the ${USER2} variable I use the full "SIP/user2" user definition.


Note 3: This is the context for regular outbound dialing to local 10 digit dialing (my area requires the complete 10 digits for even local dialing, some areas may only require 7 digits, they can change the line _9NXXXXXXXXX,1,Dial(SIP/voicenetwork_peer/${EXTEN:1}) to _9NXXXXXX,1,Dial(SIP/voicenetwork_peer/${EXTEN:1}) or add a new conext if they have local 7 digit dialing for your own area code and local 10 digit dialing for local calls to a different area code.

What that statement says is any number dialed that starts with "9", has the second number in the range of 2 to 9 ("N") followed by any other 6 digits, then send it to the "SIP/voicenetwork_peer" context with the first digit (the "9") removed (the ${EXTEN:1} macro.)

The next two lines are in case of any problems with sending the number to the outbound context. If the lines are all in use, you only dial 9 numbers, you dial 91xxxxxxxxx or 90xxxxxxxxx, or some other problem, you get the message that the number couldn't be dialed.

Note 4: Same as Note 3, except this allows those in this context to also dial long distance numbers (91* for North America long distance, and 9011* for international long distance.)

Note 5: This context is to determine what internal phones can do. First we add the outbound-local and outbound-long-distance contexts to this context to allow them to make outside calls. Then for each internal extension we configure what happens when an internal line dials that extension number: In this case we dial the number for 10 seconds, and fail over to voicemail then hang up just as we did in Step 2.



sip.conf:

[general] ; Note 7
context=default
svrlookup=yes
externip=[your external IP address] ;7a
localnet=192.168.1.0/255.255.255.0 ;7b
register => [peer number]:[password]@did.voicenetwork.ca/ ;7c


[user1] ; Note 8
type=friend ;8a
secret=[password] ;8b
nat=yes ;8c
host=dynamic ;8d
canreinvite=no ;8e
context=internal ;8f

[user2] ; Note 9
type=friend
secret=[password]
nat=yes
host=dynamic
canreinvite=no
context=internal


Note 7: The general context.

7a: This is your external IP address as seen by those out on the Internet. You will need this if you want anyone to initiate a connection from the Internet side. Not really needed for Voice Network Inc. to connect to you as you will be initiating the connection from your asterisk server To determine your external IP address, browse to http://myipaddress.com or some similar website which will show you what address they see you as, or look at your routers "status page" which should (but doesn't always depending upon the ISP you use) show the same information.

7b: Your local IP subnet definition, hopefully you know what yours is, but on most home networks it is either 192.168.1.0/255.255.255.0 or 192.168.0.0/255.255.255.0

7c: You get your peer number when you create one on the Voice Network Inc. website, and the password is the one you define in the "password" field when you configure that peer. Voice Network Inc has a "How-to-videos" section where they show the setup of a Trixbox configuration ... the first part of that video goes into how to create and configure the peer on the Voice Network Inc side of things. You can follow these instructions until they start talking about the Trixbox specifically as those instructions do not directly apply at that point.

Note 8: This section details the configuration of the typical internal IP phone.

8a: Use "friend" here, which simply means that the device both makes and receives connections from the Asterisk box.

8b: This password is one shared by the Asterisk server and the IP phone (the ID will be whatever is in the square brackets, which in this case is "user1". Use this information when configuring the IP phone.

8c: I set "nat=yes" by default as it seems to work even when the address isn't nat-ed ... I may find out later that this is a mistake somehow, but at this point it works, so until I learn otherwise so it shall stay, but this is a warning to those reading that I don't have a clue as to what I'm doing here.

8d: I believe that "dynamic" means that the IP address of the device is handled by DHCP. Again this is just guessing.

8e: "canreinvite=no" causes all communications to be forced to go through the asterisk server. The "yes" option means the asterisk sets up the call and then the two end-point IP devices start talking directly after that and only check back with the asterisk when needed. This is ok if there is no NAT in the way, but NAT ruins the whole process, so it is usually better in the case of a home system like this to just let everything stay connected to the asterisk server.

8f: "context=internal" put this user in the "internal context", which as we say earlier also puts them in the outbound-local and outbound-long-distance contexts as well.

Note 9: The same thing as Note 8, but for user2 this time.


;
; Make sure that you have checked the Send DID option under the EDIT DID option
;
; Edit your SIP.CONF file and place the following lines in it

[voicenetwork_peer] ; Note 10
type=friend
host=did.voicenetwork.ca
dtmfmode=rfc2833
insecure=very
disallow=all
allow=ulaw
context=voicenetwork-incoming ; incoming DID calls will arrive in the voicenetwork-incoming context

Note 10: Add this to your sip.conf file. You get this from Voice Netowrk Inc when you create a peer. After the peer is created, there will be a link in the "configuration example" called "asterisk", click on that to find this same information and a bit more, of which I have already explained in this post.

voicemail.conf
: (This file was one sample file I left alone, and just added the following lines to the default section.)

[default] ;Note 11

101 => [password],user1
102 => [password],user2
Note 11: This section "creates" the users voice mail, assigns the extension to the voicemail, and sets the password.

X-Lite Configuration: To be determined. I have a working configuration, but only for internal phones. I am having some trouble getting external phones to work fully, even if I connect using a VPN ... more on this later.

Sunday, October 7, 2007

VoIP - Voice Network Inc

In order to connect your asterisk to real people with real telephones you are going to need to do at least one of two things: Put some hardware into your Asterisk box that allows you to connect your computer to one or more standard telephone lines (or POTS; Plane Old Telephone Service;) or subscribe to a VoIP provider that you can connect to over the Internet and which in turn provides the hardware that connects to the regular telephone system.

Now, there are advantages and disadvantages to both options which basically boil down to features, flexibility, and cost advantages for the VoIP provider, vs quality and simplicity for your standard POTS provider.

Since I am mainly concerned with cost and flexibility, I have decided to go with VoIP.

There are various levels of VoIP providers, but in the end, the basic services they all offer are what are known as DID (Direct Inward Dialing) services and PSTN (Public Switched Telephone Network) gateway services. Many vendors provide other services on top of those basic services, but as long as you have the basic services and you are willing to do a little work, you can pretty well build yourself a system with all the same services the big VoIP vendors provide, and at no (or little) extra cost.

Those basic services, DID and PSTN gateway services provide the following functionality:

DID (Direct In Dial:) gives you a phone number and allows people to dial that number. When they dial that number it connects them to the VoIP provider, which in turn passes that call over the Internet to your VoIP phone or PBX (Private Branch Exchange - which in my case is my Asterisk box.)

PSTN (Public Switched Telephone Network) Gateway: This service allows you to connect your VoIP phone or PBX to a VoIP providers server, which in turn connects to the PSTN and allows you to call other people connected to the regular PSTN using their POTS phones.

Once you have subscribed to these two services (and they don't necessarily have to be from the same VoIP vendor,) and your VoIP phone or PBX are configured properly, you have the ability to make and receive phone calls from anyone with a phone.

Of course, when you subscribe to a "full service" vendor such as 'Rogers Home Phone', or 'Vonage', you also get some fancy "bells and whistles" such as voice mail, call waiting, call forwarding, etc. All of which are provided for by those vendor's big PBX systems, but since you also have a PBX system (Asterisk) you now have the capability to provide those same features and options without having to pay the high "all in" cost, or "additional charges" usually associated with the "full service" vendors.

So what's the difference? Why should I do it myself rather than let Rogers or Vonage do it for me? Simple ... the basic charge for a DID service can be as low as $5 a month ($1 if you meet certain traffic requirements) and PSTN Gateway services can go as low as $0.01 per minute. So instead of paying $20 a month for a Rogers / Vonage service, plus extra if you want any fancy options, you can pay $10 or less for the basic DID & PSTN Gateway services and build your own fancy options as needed.

So doing some basic research on VoIP providers available in the Greater Toronto Area, I decided I'd give 'Voice Network Inc' a try, and subscribed to their DID and PSTN gateway services.

At this moment I do not have any feel for the quality of their VoIP network, so I cannot really make any positive or negative recommendations as yet on their service. My rational for going with this company was based on them providing features that seemed to best meet my needs.

Some of the reasons I picked Voice Network Inc.


Payment methods: The included the regular methods, including CC, Paypal, and online banking. They also offered EMail money transfer which works best for me. You simply email them a deposit of either $15, $20, $25, or $100, into your account balance, and use the balance to pay for monthly DID and phone call charges. In my case since I'm evaluating the service I went with a small $15 deposit, and purchased one DID number (any charges for making calls is deducted from your balance.) I sent the EMail money transfer Friday evening, and the amount was deposited in my balance at 5am Saturday morning.

Local Calling Charges: Incoming calls are free (I paid $1 a month for the DID, but there are usage conditions that mean that I will likely be charged about $6 a month in the end, but this is "up front" information and will not be a surprise,) and outgoing calls to just about anywhere in Canada will be charged at $0.01 per minute.

Long Distance Charges: My wife's family lives in SouthEast Asia, and the charge for calling her family in that particular city is just slightly over $0.02 per minute; cheaper than your average phone card ... we shall see if the quality is any better.

My initial testing with ths service for local calling seems to be working out quite well in terms of quality ... my first call did sound a little "broken", but when I checked, I was making the call while my wife was streaming live TV from Asian, and the MythTV box was running a "full bore" bittorrent "upload" ... as soon as I turned off the bittorrent client the quality went to "excellent" ... seems that a project for the near future will be to get a hold of a DD-WRT compatible router and configure some QoS (Quality of Service) parameters for my home network.

Upcoming post: My Asterisk config files, which I used to build a basic dial in, dial out, multi extension, voice mail enabled, VoIP system.

Asterisk - Installing a home PBX

As part of the process of reducing my communications bill I want to set up a VoIP service for home phone use. Now I could have just set up a single phone that connects to a VoIP provider, but I figure as long as I'm doing this why not build it on something that will be flexible enough to be useful for future projects, and be immediately able to provide extensions for myself, my wife and daughter.

So that's where Asterisk comes in. An Open-source telephony engine that has all the power of your average office PBX system plus added flexibility and it's free.

Installing asterisk onto my Linux box (same one I run MythTV on) was fairly easy, I simply downloaded the asterisk files from this page and followed the installation instructions at the Asterisk Guru page (Since my Linux system is a MythDora distribution, based on Fedora Core 6, I naturally followed the installation instructions for Fedora Core) .... Note: Some of the instructions don't work exactly as described, but nothing serious enough to mess things up.

Once installed, here are some important basic commands that you will need to know to make configuring the system possible.

Starting asterisk: at the root # prompt type "safe_asterisk"
Stopping asterisk: first connect to the asterisk console by type at the root # prompt: "asterisk -vvvr"; then type at the asterisk console ">" prompt: "stop gracefully".

I haven't added anything yet to start asterisk automatically on reboot, but I assume the simplest way would be to add the line "/usr/sbin/safe_asterisk" to the end of the /etc/rc.d/rc.local file.

Following posts will be in regards to signing up to a VoIP SIP provider, and configuring the asterisk to do something useful.

Internet Service - TekSavvy

Before cancelling my Rogers "Extreme" account, I decided to get a DSL service installed and see if the speeds were at least as good as Cable.

So I call up Teksavvy last Monday (Oct 1) and ask some general questions to make sure I am not committing myself into any long term contracts, so I can have the DSL installed, and if it doesn't work out, then I can cancel the service and just continue using Rogers.

The sales person explained it all to me, and confirmed that I can cancel at any time, so I went ahead and ordered the ADSL service.

Since I already had an ADSL modem from a previous ADSL account a few years back, I didn't need to order one of their modems. Total cost (paid via online backing bill payment method ... the sales guy gave me an account number, then I simply logged onto my online bank account; added them as a "payee"; paid the install charge and 1st months service for a total of $62.59; gave the sales guy the confirmation number; and he gave me an installed date of Friday Oct 5.

Come Oct 5th I take my DSL modem, plug it into the phone line, hook up a spare Dlink router to the modem, configure it with my ID and password, and wait.

Around 3pm I noticed that the green "connected" light was steady, and a couple of minutes after there was a knock on my door. A technician was there telling me that everything was hooked up and should be ready to go. A quick test confirmed everything was working. The tech explained that my CO was very close so I should get near perfect speeds (which I also confrmed ... my 5Mb download, and 800Kb upload rated speeds are in the ~4.4Mb download and 700+ Kb upload.)

So far so good. Rogers can expect a call from me on Monday or Tuesday.

Note: Since I am using "Dry Loop DSL" on top of the usual $29.95 per month charge, there is also a "band B" $9.10 per month surcharge, making the total monthly bill $39.05 plus tax (which I believe is only GST.) According to the Wikipedia article, the "band B" surcharge may no longer be applicable, so I may ask them about this a little latter on after I confirm that accuracy of the Wikipedia information.


Installation Cost
=============
9.10 Band B
29.95 Monthly
19.99 install
-----------------
62.59 incl GST.

Tuesday, October 2, 2007

Preparing for the move Away from Rogers

As mentioned in other posts, I am attempting to move away from Rogers and their high priced services and see just how much money I can save on my $230 / month Rogers communication bill (Digital cable, Internet, and cell phones.)

My plan as it stands now is to look into going with the following:

---------------------------------------
Cell Phones - Replace the two Rogers "family plan" phones and one Fido pay-as-you go phone with three 7-11 Speakout $100 specials ($100 get you $100 air time and a free phone.)

I can swap out the 7-11 sim-card into my existing rogers phones as they are on the same network anyway and should not even need to be unlocked.

My current cell charges are about $120 per month, or $1440 per year, of which I use about 200 minutes per month, or 2400 minutes per year. Of those 2400 minutes, about 1/3 of them were family to family calls, and the other 2/3 were to "non-plan" numbers. Since the 7-11 phones don't have a "free family to family" concept, the 1/3 (800 minutes) need to be doubled as they will cost double. So the total minutes needed will be in the 3200 range. At $0.20 per minute, that means I'm looking at at worst case about $640 worth of minutes.

But instead of just counting on the cell phones I figure I will also set up a cheap VoIP account and use that for normal ""home phone" usage. I can also set up a a simple skype, or VoIP to VoIP type service to keep in touch with the wife while I'm at work.

At the moment I'm looking at Voice Network Inc, mostly because they have the easiest method if signing up, and they seem to be the least expensive ... just what I need to get my feet wet and see if this will work or not.

So the cell phone usage should be minimal, with the bulk of the communications done over the Internet as direct VoIP to VoIP, or through a minimal $0.01 per minuite VoIP DID/Gateway service.

So if I use the same amount of minutes I've used for the last couple of years, and use it in the same pattern, then it should be something like 200 minutes per month total, 66 of those being family minutes (most of which will now be "free",) and the remaining 134 minutes mostly of the $0.01 cent varity.

Total estimated cost:

Cell 7-11 x 3 = $300 + tax = $342 (icluding 300 minutes)
VoIP = $4.50 per month for DID service x 12 = $54 + $1.34 per month usage x 12 = $16.08

Total = $412.08

Additional charge of $200 to get out of the rogers contract early would make it $612.08 ... still a good savings, even if I have to buy another $100 or two of cell phone minutes.
------------------------------------------

Internet. This one was easy, Rogers charges over $50 per month, and traffic shapes the hell out of anything useful. After reading the reviews over on Canadian ISP, and looking at the number of ratings, and the overall score, teksavvy was the obvious choice.

The cost to open an account with them cost a total of $62.59, which includes the months service plus installation charge, and taxes.

Regular costs will be $29.95 for the DSL service, and because it is a "dry loop DSL" (no telephone service on the line) service there is a "band charge" ... in my case it is a "band B" charge of $9.10 per month, making the total $41.40 including GST. Cheaper, and there is no traffic shaping, not usage cap, and the support is magnitudes better than Rogers.
------------------

So the first thing I needed to do was to see if I'm under any contracts, as in order to get out of a contract there is usually some sort of penalty.

So I checked my cell phone contract first, and found out that I was under contract until November 2008, and the penalty for getting out early is $20 for each month left on the contract, up to a maximum of $200 ... I'm hoping that contract applies to the whole "family plan, and not to each individual cell phone, but I certainly doubt it, but even if it is, $400 to break the contract will still leave a sizable savings ... even more so the next year.

I called Rogers to see what kind of contract I was under for Internet and Cable, and it turns out that I am under their "bundle" contract, which if I want to break it would cost me all the saving (15%) that I received from the start of the contract. Fortunately the bundle contract is over the first week of November 2007, which gives me just enough time to test out the Teksavvy internet and VoIP stuff before I go and cancel Rogers ass.

Anyway, we shall see how everything goes ... more to follow.

Wednesday, September 26, 2007

MythDora & Media MVP (rev H3) Configuration


Configuring a MythDora 4.0 standard install to work with a Media MVP rev H3 box.

This article describes the MythDora 4.0 and Media MVP configuration I used to get the Media MVP playing streaming media from my main MythDora Multi-Media system.


Video found on youtube showing basic functions of both MythTV & the Media MVP



Update (Oct 11, 2007): Before doing anything, make sure that you have turned off your firewall on the MythDora box.

To see if the MythDora firewall is running or not, open up a terminal session and type:
# /etc/rc.d/init.d/iptables status
If this returns anything but "Firewall is stopped." then you will need to disable the firewall before proceeding. To stop the firewall do the following:

#/etc/rc.d/init.d/iptables stop
# mv /etc/sysconfig/iptables-config /etc/sysconfig/iptables-config.old

It's probably not the best idea to run permanently without a firewall, but at the moment I don't have the details on setting the firewall to include the proper rules to allow the necessary communications (tcp & udp) between the two boxes. When I figure out the proper rules, I will update the post to include a generic addition to the iptables-config file.



Basic system information:

My MythDora box is based on an AMD single core 3200+ processor, with 1GB of ram, and an 80GM main drive (I also have a 250 GB secondary drive, which I use to mount at various mount points to best make use of disk space, but that configuration is beyond the scope of this article.) I have "hard coded" this box with an IP Address of 192.168.1.10. MythDora also runs DHCP, two tftp servers, and a special "mvprelay" service (more on these later.)

Additionally, while not relevant to this article, I use a Hauppauge
WinTV-PVR-150 for capturing TV, and an Nvidia GeForce 6200 Turbocache video card.

The Media MVP is a "rev H3" and is assigned an IP Address of 192.168.1.100 via DHCP.

The network itself runs a Netgear wireless router (with 4 wired ports. Both the MythDora and Media MVP are connected to the wired ports. Workstations and laptops are a mixture of wired and wireless.) The Netgear router handles the gateway and DNS services, but has had its DHCP service disabled (DHCP runs on the MythDora box as it is more flexible and configurable running there, and depending upon your own router you will likely need to do the same.)


Installation Summary:

  1. Configure the DHCP server
  2. Configure two tftp services (on on port 69, and the other on port 16869)
  3. Download, compile, and run the mvprelay program
  4. Download the dongle.bin.mvpmc file
  5. Create a dongle.bin.ver file
  6. Create and edit a dongle.bin.config file
  7. Set up your MythDora box for NFS shares
  8. Install and configure VLC
  9. Boot the Media MVP box.
Note: The following details are specifically for a MythDora 4.0 installation and an H3 rev (it should also apply to other Hx revisions but I have not tested any other than the H3) of the Media MVP box. If you do not have both of these prerequisites, then these instructions will likely not be accurate (although they may help to give you an idea of what you need to do even if you have some other Linux distro, or rev of the Media MVP box.

For installations with different Linux distros or Media MVP revs, your best bet is to check out the information available on the mvpmc homepage, the mvpmc wiki, or the mvpmc sourceforge forums.

For those of you who are already familiar, or not interested in knowing all the boring details, all the important information is contained in the "quoted" sections . So like for all the parts of this post that look like this:

  • Details are in sections that look like this, and all the really important instructions are in RED


Configure the DHCP Service:

Summary: I had to disable the DHCP service on my router as it was not capable of providing the bootp (bootstrap protocol) information that is required to run the Media MVP box.

Think of the Media MVP as a Linux server without a disk. This means that the Operating System needs to be stored on a server with a disk, and that we need to be able to boot the Media MVP; give it some basic network information; and tell it where it can find its Operating System. It can then load that Operating System up and perform it's multimedia functions.


On a MythDora 4.0 system, you will find the DHCP configuration file at /etc/dhcpd.conf. Open this file and edit it similar to the following:

ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;

option nis-domain "yourdomain.com";
option domain-name "yourdomain.com";
option domain-name-servers 192.168.1.1;

option time-offset -18000; # Eastern Standard Time

range 192.168.1.20 192.168.1.50;

}

group {
next-server 192.168.1.10; # IP address of your TFTP server
#
host mvp {
# NOTE: Change the hardware ethernet to the MAC address of your actual MVP
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.1.100;
filename "dongle.bin.mvpmc";
option root-path "/home/mvp,rsize=4096,wsize=4096,nolock";
}

}
Careful of the line wraps that might show up due to web page formatting, they are invalid in a real config file.

Lines highlighted in red should be modified to reflect your own network information.

This DHCPD configuration does the following:
  • Sets a range of IP addresses from 192.168.1.20 to 192.168.1.50 to be handed out to any computer that requests an IP address from DHCP.
  • Sets a special IP address, 192.168.1.100, for a computer that has a specific hardware address, which in this case will be the Media MVP hardware.
  • Not explicit in this configuration, but impled is that all other IP addresses can be used for "static" addressing, which in the case of the main MythDora computer is configured with a "static" ip address of 192.168.1.10. The DHCP is not configured to do anything with that address, so it does not cause any conflicts.
  • This configuration also does one more thing. It tells any host in the "group" section (in this case the mvp host) that it should look on the server with the address of 192.168.1.10 (MythDora) for a file called "dongle.bin.mvpmc"; upload it to memory; and attempt to boot using this file.



Configuring the tftp (trivial file transfer protocol) service:

Summary: In the above DHCPD configuration t was mentioned that the DHCPD config tells the Media MVP box to upload a file called "dongle.bin.mvpmc". Of course files just don't upload themselves, so we will have to configure a service that will allow the Media MVP to do its uploading. This service is called "tftp" (the Trivial File Transfer Protocol.)

It should be noted that the "H revs" of the Media MVP do some sort of "double boot" process, which I've never found a good description of, but apparently uploads the "dongle" file first using tftp on port 69, prepares itself in some mysterious manner, then reboots and uploads the "dongle" file again using tftp but this time on port 16869 (or it may be the other way around, but it essentially means that you need to instances of the tftp service running, one instance on each port.)

The recommended method of enabling a standard tftp service on the MythDora box (which is just a distro of Fedora Core 6 running MythTV) is to edit the /etc/xinetd.d/tftp file and change the "disabled = yes" to "disabled = no". For some reason this did not work for me, but fortunately there is another relatively easy method that works just as well, and works for both the port 69 and port 16869 instance of tftp.

Edit the /etc/rc.d/rc.local file and add the following lines

/usr/sbin/in.tftpd -l -a :16869 -s /tftpboot -v
/usr/sbin/in.tftpd -l -a -s /tftpboot -v
Then save the file.

You will have to reboot the server in order for the rc.local file to take effect, but we will do this later, as there is still one more edit we need to do to this file. After we finish all the other configuration changes, we will reboot the server when all the changes have been made.


Downloading, Compiling, and Running the mvprelay service:

Summary: The Media MVP comes with it's own software which runs only on Windows. You load the program on your Windows machine and it starts a "service" which when you boot up the Media MVP harware, responds to a query from the hardware for a "Streaming Media Server". Since you will not be running the Media MVP Windows software on your MythDora machine, you will need to run the "mvprelay" program which serves the same, or similar function on Linux.

The process of getting the mvprelay program goes like this:

Open your browser and browse to this link.
Highlight all the text on that page and click copy.
Open you favourite Linux editor and paste the text into it and save as "mvprelay.c"
Compile the file by typing the command "gcc -o mvprelay mvprelay.c"
Copy the resulting mvprelay file to /usr/local/bin or wherever you think appropiate.
edit the /etc/rc.d/rc.local file and add the line "/usr/local/bin/mvprelay 16881 5906 6337 192.168.1.10 &"

Again, you will have to reboot the MythDora box in order for these changes to take effect, but since there is still one more change we will have to make to the rc.local file, we can wait until that change is made before rebooting.



Download the dongle.bin.mvpmc file:

Summary: The dongle.bin.mvpmc file is actually a small specially modified Linux kernel, which is what the Media MVP should run in order to communicate with your MythDora box and stream live TV, recordings and videos.

You should probably get the latest dongle.bin.mvpmc file, which can be done by going browsing to the Sourceforge mvpmc project and selecting the latest version, but in these instructions I will use the one I downloaded at the time of this writing.

You should also be aware that when I used the dongle file as named, it didn't work for me. I've read a few posts on the forums of people having similar problems, so I renamed the file to the more generic "dongle.bin", which should work for everyone. I'd suggest you do the same, just in case you are one of the unlucky ones.


Download the dongle using the command: "wget http://superb-west.dl.sourceforge.net/sourceforge/mvpmc/dongle.bin.mvpmc-0.3.3"
Rename the file to "dongle.bin"
Copy "dongle.bin" to the /tftpboot directory




Create a dongle.bin.ver file:

Summary: Supposedly this file is used to determine if there is a need to reload the dongle.bin file. I'm not sure if this is true, or how it works, but it is needed so create it.


To create the bongle.bin .ver file:

Go to the /tftpboot directory
Run the command "dd if=dongle.bin of=dongle.bin.ver bs=1 count=40 skip=52"


You should end up with a 40 byte file named dongle.bin.ver


Create and edit a dongle.bin.config file:

Summary: This is the file that the Media MVP reads after it boots, and does all the detailed configuration stuff such as setting the time, running the application that connects to the MythDora system, mounts any NFS mounts that might be needed, and a bunch of other important, ad not so important things.

Here is the dongle.bin.config file that I use:

TZ='EST5EDT4,M4.1.0/02:00:00,M10.5.0/02:00:00' ; export TZ
echo "TZ='EST5EDT4,M4.1.0/02:00:00,M10.5.0/02:00:00'; export TZ" > /etc/shell.config;
rdate -s time-a.nist.gov
echo "192.168.1.10 mythtv.yourdomain.com> mythtv ">>/etc/hosts
mkdir /storage
/etc/nfsmount.sh 192.168.1.10:/storage /storage
mvpmc -f /etc/helvR10.fnt -y 192.168.1.10 -s 192.168.1.10 -r /storage/recordings -t /usr/share/mvpmc/easy.xml --startup mythtv -u mythtv -p mythtv -T mythconverg --vlc 192.168.1.10 &
Of course, the RED parts should be modified to use the information specific to your network.

If you are wondering about the parameters used for the mvpmc command, the complete list with explanations are listed here.

Create this file in your favourite Linux editor and save it as /tftpboot/dongle.bin.config


Set up your MythDora box for NFS shares:

Summary: This step configures NFS on your MythDora box to allow the Media MVP box to mount the /storage directory from MythDora box as though it were local to the Media MVP box. This provides to advantages, first it allows access to the MythTV "ring buffer", which means you can pause, and rewind live TV, and in conjunction with VLC allows you to stream other videos from your MythDora box to the Media MVP box. If you do not want to do this, then you will need to read through the documentation and modify the dongle.bin.config as necessary to remove the relevant NFS related parameters from the "mvpmc" command.

Here is what you will need to do in order to allow NFS access.

  • Edit or create the /etc/exports file to include the line "/storage 192.168.1.100(ro)" (modify the IP address to be the address of your Media MVP box.)
  • Restart the NFS service with the following command "/etc/rc.d/init.d/nfs restart" (This is not totally necessary, except if the NFS service is already started, but by doing this you will be able to make sure the exports file doesn't have any major errors that would make it fail.)
  • Set the NFS service to start automatically on reboot by using the command "chkconfig nfs on"



Install and configure VLC:

Summary: VLC is a powerful media player and steamer. The Media MVP can be configured to use the LC streaming capability in order to play videos other than simply via the MythTV protocol which would limit the Media MVP to just playing Live and recorded TV. With this configured you can throw all your legal (of course) bittorrent videos and such into your /storage/videos directory on the MythDora box, then using the Media MVP file browser, you can select and stream and play those videos as well.

To install and configure the VLC streamer do the following:

  • Install VLC by using the command "yum install vlc"
  • Configure VLC to start automatically on reboot by editing the /etc/rc.d/rc.local file and adding the line "su -c "nohup vlc -I Telnet --sout-transcode-audio-sync --sout-transcode-deinterlace &" mythtv" (I run this as the default mythtv user to make sure it have the right permissions and environment. It may work just as well running as root, but I haven't tested it, so if oyu want to, go ahead."
Since you have now made all the necessary configuration changes to the /etc/rc.d/rc.local file, you can, and should, now reboot your computer so that all those changes take effect. If you choose not to do so now, don't forget to do so before booting up the Media MVP box.


Boot the Media MVP box:

Summary: Okay, this is where we find out if I've documented everthing correctly, and if you followed the instructions properly .... Good Luck.

Before putting the power to the Media MVP box, make sure you have connected it to the network and plugged it into your television's audio & video jacks (I use the RCA yellow video jack, but if you have an S-Video input that should work just as well, and as far as I can the Media MVP send signal to both at the same time so there should no extra configuration needed ... but I could be wrong, so if the S-Video doesn't work try the RCA jack and then go read the documentation.

If everything goes well when you put the power to the Media MVP you should see something similar to the following:

  • A screen comes up with 5 large grey blocks at the bottom. The first four blocks should turn black and the screen should switch
  • You might get a message asking to hit "OK" within 3 seconds. You shouldn't have to do anything at this point, but if the rest of the boot doesn't go as described below, reboot and hit OK at this point to see if the Media MVP has detected the "Streaming Video Server" at the MythDora Address.
  • The next screen you see should have 10 small blocks at the bottom of the screen. These should step through turning black with the words "loading application" above it. The blocks may cycle through a couple of times, but within 15 seconds or so the screen should flash black.
  • The next screen should be black except for a blue "splotch" in the middle of the screen with mvpmv.org. This should show for a few more seconds and then you should see the MythTV menu appear on the screen.
  • At this point, you are on your own, browse around and check out all the menu options. Note, some of these options do not work as yet (at least in many cases, and mine in particular.) For instance, the "Live TV" option should work, but the "New Live TV" option may not work and actually cause the mvpmc application to crash and restart (this causes no damage, the application simply restarts and you can continue on.) The crashes seem to be caused by the version of the dongle you are using, although in this case until you go into your mythtv mysql database and configure the database to allow remote access your system may only give you an error message about "sql access" rather than crashing.


Misc Info:

Summary: I'll add some more stuff here that should make the MythDora box a little more useful for organizing your media. When I get some more time I will document how I installed and configured SAMBA in order to allow my daughter to upload her music to the system ; and how I installed and configured VNC to set up some "virtual X session" where you can do some unattended bittorrent downloading, burning DVD backups, and such on the MythDora box, and control it all from your firefox or IEexplorer browser. Ie. Use your browser as though it were a monitor, keyboard, and mouse attached to your MythDora box, and run applications as though your were sitting in front of the machine. You can also just close the browser and the apps keep on running, and can be reconnected to your browser, password protected, any time you want to monitor progress.

Introduction

A little introduction:


Who: A middle aged guy who hates to give tons of money to large companies for things and services that I could do myself and at far less cost, or with a little research effort could get the same services from a smaller company at half the price.

Where: Toronto, Ontario, Canada. So the information found here may not be of much use to anyone unless they too live in Toronto. I suspect though that much of this will apply to anyone, just that it will probably be more directly relevant the closer you live to Toronto.

What: This blog will deal mostly with technology issues and how to "roll your own" solutions, or in cases where you can't really do it yourself, point you toward the least expensive alternatives.

My main focus will be on issues like Television (cable, vs Satellite, vs over the air; TiVo alternatives, consolidating your media, and so on,) Internet providers, and Communications (cell phone services, VoIP choices.)

When: It just so happens that currently I get all the above mentioned services from one source; that being Rogers Cable. Now I don't have a big issue with Rogers, they do a decent job of providing these services, but they're not perfect, and since my "bundle" contract is over at the end of October, which means I either need to sign up for another 2 or 3 year contract, or have my $230 monthly bill for Cable, Internet, and cell services go up at least another 15%, I figured this would be a perfect time to see how I could go about looking at alternatives.


Why: As mentioned above, my current Internet, Cable, and communications bill amount to around $230 a month. That's WITH a 15% discount for getting all these services from one company (Rogers) and signing a 3 year contract. Even doing a little bit of research I can easily see that if I were to do a little shopping around I could save a grand or two a year, get all the same services, plus some more, and have a lot more control over how everything works.


How: Exactly! How indeed will I accomplish this. Well, it will probably be by doing a lot of research, and comparing what's available. It will also take a little work building and purchasing some relatively inexpensive technology to attempt to accomplish what the big service providers charge "an arm and a leg" to provide.

The current Plan: Before I even seriously considered doing this, the first thing I figured I should do was to build myself a MythTV system. I did this because I figured I would need to start somewhere, and rather than swapping out an existing service (cable, phone, Internet,) that I would build something I didn't already have, a Personal Video Recorder (PVR), that would cost money to purchase or rent, and that could potentially help me save money later on (ie. rather than having a digital cable box in each room, I could throw in a couple of TV capture cards, connect one to a digital box, one or two to analog cable, stream live or recorded TV to the beedrooms ... thus rather than paying for 2 or 3 digital boxes, I could just get one, and make use of streaming and "TiVo-ing" to makeup the difference.

I currently have a MythTV box running and working, including streaming to the bedroom. There is still some more work to do before it is the way I want it, but I now have the "theory" down, so I am confident that what I want can be done. So now I can confidently move on to finding cell, land-line, and Internet alternatives. So stay tuned.