Naked ADSL and VoIP 2012-style

Monday, 2 April 2012

Last month I decided to take the plunge and switch over to a Naked ADSL service. Late last year Internode had announced that they’d sorted out number porting for customers on existing ADSL2+ connections (like myself). More recently they also introduced a new tier in their Naked plans, so that leaving my old 50G ADSL2+ plan was now viable.

The switch to a naked line happened on the scheduled day. I didn’t realise however that the porting of the phone number would take a few extra days. Not a huge problem, but something to be aware of.

Going naked means you have no dial-tone. If you want to keep your phone number, it needs to be ported to a VoIP service. In this case to NodePhone (Internode’s VoIP offering), with $10/month call credit. I’ve been using first FreeCall and more recently PennyTel as outgoing VoIP providers for a number of years. It will be interesting to see how NodePhone compares.

Two nice features that I discovered was it comes with voicemail (you can customise the greeting, and you can get email notifications), and caller ID is included (instead of paying $6/month for the privilege)

I configured my trusty ATA (a Sipura SPA-3000) with new settings to work with NodePhone. All seemed fine, but it didn’t work – the registration was failing. A call to Internode Support didn’t identify any issues other than I was using more recent firmware than they were aware of, and that I was using relatively ‘old’ hardware. In any case just when I was about to give up for the evening, I noticed that it had started working all by itself.

All seemed fine for a few days, then I noticed that we were getting calls going to voicemail but no missed calls were on the phone. Strangely the ATA was still saying it was registered but most calls never rang the phone – they just redirected to voicemail.

Another call to Internode support, but again no joy. Nothing looked out of place with my settings, but they could see the registration was dropping out regularly (which would explain the calls not coming through to the handset). Their final suggestion – get some new hardware.

It turns out I bought the Sipura SPA-3000 way back in 2005. 7 years is a good innings for consumer hardware, so maybe it was time to update to something more current. The Gigaset C610 seemed to be well regarded so I picked up one from Internode’s Adelaide office.

It was pretty straightforward to configure, but annoyingly I then discovered I was having the same problem still. Another call to Internode Support, but this time they said they had TWO active registrations – one for the Gigaset and one for the SPA! That didn’t make sense, as the SPA was now sitting on a shelf – no power, no network. They reviewed the modem and Gigaset settings and things seemed to settle down, and I received an incoming call ok.

So hopefully that’s the way things will stay for now on Smile

MetroYam–Windows Phone Edition

Friday, 16 March 2012

Part 3 of a series on developing .NET clients for Yammer. For the Windows Phone version of MetroYam, I’m again making use of RestSharp to handle the REST API work. Once difference when using RestSharp on Windows Phone compared to the desktop is that it only exposes asynchronous methods. So instead of calling Execute, we have to call the ExecuteAsync method. Here’s the equivalent code:

using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Gardiner.MetroYam.Core; using RestSharp; using RestSharp.Authenticators;

namespace Gardiner.MetroYam.PhoneClient { public class Network { private readonly ObservableCollection \_messages;

    public Network( ObservableCollection<MessageViewModel> messages )
        \_messages = messages;

    public void Request()
        var client = new RestClient();

        client.BaseUrl = "";
        string consumerKey = "12312341234243";
        string consumerSecret = "kciud84kf0943kdi4kdk3kr";

        var oauth\_token = "84944kf984444";
        var oauth\_token\_secret = "kdiekemfckcfiejekmekduj454j4";

        var request = new RestRequest( "api/v1/messages.json", Method.GET );
        client.Authenticator = OAuth1Authenticator.ForProtectedResource(
            consumerKey, consumerSecret, oauth\_token, oauth\_token\_secret

        // 2011/03/28 20:39:12 +0000
        request.DateFormat = "yyyy/MM/dd HH:mm:ss zzzzz";

        client.ExecuteAsync<MessageList>( request, Callback );

    private void Callback( RestResponse<MessageList> response, RestRequestAsyncHandle arg2 )
        var users = new Dictionary<int, User>();
        foreach ( Reference reference in response.Data.References )
            if ( reference.Type == "user" )
                users.Add( reference.Id, new User { Fullname = reference.FullName, Photo = reference.mugshot\_url } );

        foreach ( var message in response.Data.messages )
            var vm = new MessageViewModel();
            vm.Body = message.Body.Plain;
            vm.Created = message.created\_at.LocalDateTime;
            User user = users\[ message.sender\_id \];
            vm.Sender = user.Fullname;
            if ( user.Photo != null )
                vm.PhotoUrl = user.Photo;
                vm.PhotoUrl = new Uri( "\_photo\_small.gif" );

            \_messages.Add( vm );
} }

Rather than a single method that returns the list of messages, we now have a class that populates an ObservableCollection. A reference to this is passed in via the constructor. The ViewModel page that calls this code is straight forward:

using System; using System.Collections.ObjectModel; using Caliburn.Micro; using Gardiner.MetroYam.Core;

namespace Gardiner.MetroYam.PhoneClient { public class MainPageViewModel : Screen { private ObservableCollection \_messages; public ObservableCollection Messages { get { return \_messages; } set { \_messages = value; NotifyOfPropertyChange( () => Messages ); } }

    public MainPageViewModel()
        Messages = new ObservableCollection<MessageViewModel>();

    protected override void OnInitialize()

        var network = new Network( Messages );

} }

Through the magic of Caliburn Micro, the public properties exposed by this ViewModel class are automatically bound to the View. In this case we are using a simple Panorama-based Windows Phone application template. The result is an application that looks like this: Screenshot of MetroYap on Windows Phone It would be nice leverage the Reactive Extensions (Rx) library to simplify access to the ExecuteAsync method, but because this method doesn’t just return an IAsyncResult this is a little more involved. Sergy posted to the RestSharp group an example last year, but I assume the RestSharp and Rx libraries have changed since then as his code no longer compiles for me.

Internal MSBuild Error: MSB0001

Thursday, 15 March 2012

Encountered this weird error from MSBuild today:

Unhandled Exception: Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: MSB0001: Internal MSBuild Error: Global Request Id 6 has not been assigned and cannot be retrieved.
Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: Global Request Id 6 has not been assigned and cannot be retrieved.
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrow(Boolean condition, String unformattedMessage, Object arg0)
   at Microsoft.Build.BackEnd.SchedulingData.GetScheduledRequest(Int32 globalRequestId)
   at Microsoft.Build.BackEnd.Scheduler.HandleRequestBlockedOnInProgressTarget(SchedulableRequest blockedRequest, BuildRequestBlocker blocker)
   at Microsoft.Build.BackEnd.Scheduler.ReportRequestBlocked(Int32 nodeId, BuildRequestBlocker blocker)
   at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
   at Microsoft.Build.Execution.BuildManager.Microsoft.Build.BackEnd.INodePacketHandler.PacketReceived(Int32 node, INodePacket packet)
   at Microsoft.Build.BackEnd.NodeManager.RoutePacket(Int32 nodeId, INodePacket packet)
   at Microsoft.Build.BackEnd.NodeProviderInProc.RoutePacket(Int32 nodeId, INodePacket packet)
   at Microsoft.Build.BackEnd.NodeEndpointInProc.SendData(INodePacket packet)
   at Microsoft.Build.BackEnd.InProcNode.OnNewRequest(BuildRequestBlocker blocker)
   at Microsoft.Build.BackEnd.BuildRequestEngine.RaiseRequestBlocked(BuildRequestBlocker blocker)
   at Microsoft.Build.BackEnd.BuildRequestEngine.IssueBuildRequest(BuildRequestBlocker blocker)
   at Microsoft.Build.BackEnd.BuildRequestEngine.IssueUnsubmittedRequests()
   at Microsoft.Build.BackEnd.BuildRequestEngine.EngineLoop()

Turns out I had a <Target /> with a DependsOnTarget attribute which referenced a target that didn’t exist (because I’d forgotten to <Import /> the related .targets file in which it was defined!)

MetroYam–WPF desktop edition

Wednesday, 14 March 2012

Part 2 of a series on developing .NET clients for Yammer.

The first client that I’ve attempted is the WPF version. This version of MetroYam uses the MahApps.Metro library to enable a Metro interface.

Once the UI framework is in place it’s time to register with Yammer for an API key. You need this to access their REST API. Initially this just allows you to access the Developer Yammer group, but it may be possible to apply to Yammer to make it useable by any Yammer user.

Using the OAuth1 integration test from the RestSharp source code repository as a guide, I created a class with the following method prototype accessing a feed of messages (keys changed to protect the innocent!)

public List<MessageViewModel> Request()
    var client = new RestClient();

    client.BaseUrl = "";
    string consumerKey = "0121212121212";
    string consumerSecret = "abcdefgkskdlasllkjsfien3234sdfsdf";

    client.Authenticator = OAuth1Authenticator.ForRequestToken( consumerKey, consumerSecret );
    var request = new RestRequest( "oauth/request\_token", Method.POST );

    var response = client.Execute( request );

    var qs = HttpUtility.ParseQueryString( response.Content );
    var oauth\_token = qs\[ "oauth\_token" \];
    var oauth\_token\_secret = qs\[ "oauth\_token\_secret" \];

    request = new RestRequest( "oauth/authorize" );
    request.AddParameter( "oauth\_token", oauth\_token );
    var url = client.BuildUri( request ).ToString();
    Process.Start( url );

    var verifier = "01234"; // <-- Breakpoint here (set verifier in debugger)

    request = new RestRequest( "oauth/access\_token", Method.POST );
    client.Authenticator = OAuth1Authenticator.ForAccessToken(
    consumerKey, consumerSecret, oauth\_token, oauth\_token\_secret, verifier
    response = client.Execute( request );

    qs = HttpUtility.ParseQueryString( response.Content );
    oauth\_token = qs\[ "oauth\_token" \];
    oauth\_token\_secret = qs\[ "oauth\_token\_secret" \];

    Debug.WriteLine("oauth\_token {0}", oauth\_token);
    Debug.WriteLine( "oauth\_token\_secret {0}", oauth\_token\_secret );

    request = new RestRequest( "api/v1/messages.json", Method.GET );
    client.Authenticator = OAuth1Authenticator.ForProtectedResource(
    consumerKey, consumerSecret, oauth\_token, oauth\_token\_secret

    // 2011/03/28 20:39:12 +0000
    request.DateFormat = "yyyy/MM/dd HH:mm:ss zzzzz";

    RestResponse<MessageList> responseList = client.Execute<MessageList>( request );

    var users = new Dictionary<int, User>();
    foreach ( Reference reference in responseList.Data.References )
        if ( reference.Type == "user" )
            users.Add( reference.Id, new User() { Fullname = reference.FullName, Photo = reference.mugshot\_url});

    var messages = new List<MessageViewModel>();

    foreach ( var message in responseList.Data.messages )
        var vm = new MessageViewModel();
        vm.Body = message.Body.Plain;
        vm.Created = message.created\_at.LocalDateTime;
        User user = users\[ message.sender\_id \];
        vm.Sender = user.Fullname;
        if ( user.Photo != null )
            vm.PhotoUrl = user.Photo;
            vm.PhotoUrl = new Uri( "\_photo\_small.gif" );


    return messages;


The Models (Message, User etc) and ViewModel (MessageViewModel) are declared in the ‘portable’ class library. This library is shared between the WPF, Windows Phone and Metro-style WinRT applications.

This particular method causes a web browser to load part-way through to obtain a user authentication code. Normally an application would cache the oauth_token and oauth_token_secret values returned by the “oauth/access_token” call so the user wouldn’t need to re-authenticate the app each time.

The relevant XAML to render this is pretty straightforward (not that I’m a XAML expert like Nigel!)

<ListView Grid.Column="1" Grid.Row="1" Margin="20,0,0,0" x:Name="Messages"

            <Border Padding="0,0,0,10">
                <DockPanel ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                    <Image Width="48" Height="48" Source="{Binding PhotoUrl, IsAsync=True}" DockPanel.Dock="Left" VerticalAlignment="Top" />
                    <TextBlock Text="{Binding Path=Sender}" DockPanel.Dock="Top" FontWeight="Bold" />
                    <TextBlock Text="{Binding Path=Created}" DockPanel.Dock="Top" />
                    <TextBlock Text="{Binding Path=Body}" DockPanel.Dock="Bottom" TextWrapping="WrapWithOverflow" />


And to confirm that this does actually render something, here’s a screenshot of work in progress:


I like how the <Image/> element can take an Internet URL so that it just loads the photos automatically.

My plan is that the client will default to the ‘company’ list in the first column, but let you add additional columns to follow other groups that you are a member of.

MetroYam–a .NET Yammer client (or three)

Monday, 12 March 2012

I first came across Yammer via Rob Farley when I was working at LobsterPot Solutions. Imagine Twitter and Facebook morphed together, but just for a single organisation instead of publishing your thoughts for all the world (or your friends) to see. Yammer knows what information to show you because it’s based around your email address – so for example everyone who has a email address would be able to collaborate on Yammer together, without worrying that their posts would be seen by non users.

It’s quite a useful platform for sharing resources and information amongst colleagues, and a useful adjunct to other communication methods (face to face, phone, email, IM). The basic offering is free, but if you want to have more administrative control you pay for the privilege.

Access is via their website, but they also provide a number of platform-specific clients too. Unfortunately the Windows client isn’t the greatest. I’ve had problems where it wouldn’t auto-update, and the current version doesn’t seem to have working notifications. It also uses Adobe AIR, which is just one more think to keep patched. It’s enough to make you want to write a decent client and maybe learn a few things along the way – queue ‘MetroYam’ – my name for a Yammer client built on .NET.

My plans are to build a number of clients:

It will be interesting to see how much code I can share and reuse between the 3 different platforms.

The inspiration for the user interface I plan to build is MetroTwit (my Twitter client of choice) – a great example of the Metro design that Microsoft are building into Windows 8.

Screenshot of MetroTwit

It won’t be a carbon-copy but they’ve got some good ideas worth emulating.


Yammer API

Lucky for me, Yammer have a REST API that they provide for things just like this. It uses OAuth for authentication and JSON.

Caliburn Micro

I plan to use Caliburn Micro for all three clients. I’ve used CM before, for my ‘Aussie Toilets’ Windows Phone app, so this will be a chance to explore it’s support for WPF and WinRT.


For the WPF and Windows Phone clients, I’m going to make use of the RestSharp library to access the Yammer API as it provides support for JSON as well as OAuth. RestSharp doesn’t support support WinRT, so I’ll need to take a different approach there.

Visual Studio 2010 + 2012 beta

And finally it’s happened! You can open solutions and projects in 2012 not be restricted from still using them in 2010. I’ll need to use VS 2012 to build the WinRT projects, but I’ll also need to still use VS2010 to build the phone app (as the 2012 beta doesn’t come with Windows Phone support yet).