Tim Long

Forever in Electric Dreams
The life and times of a Small Business Server MVP and all-round technology enthusiast. Tim is founder of TiGra Networks, a company based in South Wales UK specialising in small business IT. This blog is aimed at Microsoft Small Business Specialists, IT professionals, Astronomers and anyone interested in science and technology.

Microsoft CRM Caller ID Lookup for TrixBox

image

Following on from my last post where I discussed using LINQ to dip into a Microsoft Dynamics CRM database, here is a real-world application using similar techniques. This sample is an integration between TrixBox, an open-source IP Telephony system and Microsoft Dynamics CRM. It uses LINQ to SQL to look up the Calling Line Identity (CLID) of an incoming call in the CRM database and returns the name and company of the caller, which TrixBox then presents to the user on their telephone display and records in the call detail records. The code is implemented as an HTTP Handler (.ashx) file hosted on an ASP.Net web application. You can test all this in Visual Studio 2008, but my finished solution is hosted in IIS6 on my Windows Small Business Server.

Assumptions
  • This is designed to work with TrixBox CE 2.6, configured to work in the UK
  • TrixBox presents CLID in the format you would dial a national number. For the number (01234) 567890 TrixBox presents the caller ID as  01234567890.
  • Phone numbers are stored in canonical format within my Microsoft CRM implementation. The number above would be stored as +44 (1234) 567890 - if yours are stored differently you'll have to modify the code, but I suggest you always store your phone numbers in canonical form within Outlook and CRM.

There are really 4 parts to this project.

  1. Creating the solution and implementing the HTTP Handler.
  2. Receiving the CLID from TrixBox and getting it into Canonical Form
  3. Querying the CRM database using LINQ and formatting the result string
  4. Configuring TrixBox to use our solution.

I'm going to present the steps as separate blog posts. This is part 1.

Part 1 - Creating the Solution
  1. In visual Studio 2008, create a new project (not a web site). In the New Project dialog, select the Web project type and ASP.NET Web Application template. Ensure you are targetting .NET Framework 3.5 and name your solution.
    image
  2. Right-click the project and select Properties..., on the Application tab, set the default namespace to TiGra.TrixBox and the assembly name to TiGra.TrixBox.CallerIDLookup. Switch to the Settings tab and add the following application settings (click the image for a full-size view if you can't make it out). Substitute values that make sense for you in LocalCountryCode and LocalAreaCode, AreaCodeDigits and NumberCodeDigits. We'll revisit the connection string later.
    image
  3. Right click on the project, click Add New Item... and select Generic Handler. Name it Lookup.ashx, as shown below. A generic handler is sort of like a code-behind file without any content page. There is no predefined content to display and the output is generated by the underlying code. When you double-click the ashx file in visual studio, you will not see any HTML but will be taken directly to the C# code-behind file. This enables us to write code that looks at the URL that was used to access the handler, get the query string from it and generate the response string directly in C# code. The default template supplied with Visual Studio generates the string "Hello world".
    image
  4. Let's just make it a bit easier to test things as we go along. You'll notice that Visual Studio created a Default.aspx page and this is what will be displayed when we run the project. So open up the Default.aspx page in HTML view and set the body as follows:
  5. <body>
        <form id="form1" runat="server">
        <div>
            <a href="Lookup.ashx?CLID=01443208678">Lookup 01443 208678</a>
        </div>
        </form>
    </body>
  6. You can now run the project and it should build with no errors. You'll notice the ASP.NET Development Web Server pop up in the task bar and your Default.aspx page should open in a browser window. If you get warnings about debugging, select OK to enable debugging. When you click on the hyperlink on the default page, you'll should see the "Hello world" response.

The solution so far is attached to this post if you want a quick-start or just want to check your results.

Comments

Tim Long said:

In part 1 , we set the scene and created a new project in Visual Studio and set up a few things in preparation

# May 19, 2008 2:35 AM

Tim Long said:

In part 1 we set the scene and created our web application project. In part 2 we began creating the HTTP

# May 19, 2008 2:39 AM

Tim Long said:

In part 1 , part 2 and part 3 of this series, we built an ASP.NET 3.5 web application to accept a telephone

# May 19, 2008 3:37 AM

TrackBack said:

# May 19, 2008 9:04 PM

Valium. said:

Valium.

# June 28, 2008 9:26 AM

Vicodin m357. said:

Vicodin es. Vicodin. Vicodin side effects. Dangers of vicodin. Drug vicodin. Is it safe to snort vicodin. Pharmacy online no prescription vicodin. Buy vicodin.

# July 28, 2008 11:03 PM

Aldactone and dogs. said:

Aldactone. Aldactone hirtuism. Spironolacto or aldactone. Aldactone hyperkalemia. Hyperkalemia caused by aldactone. Treating acne with aldactone. Length of action of aldactone.

# July 30, 2008 11:38 PM

Zolpidem next day delivery. said:

Cheap zolpidem. Zolpidem eszopiclone indications. Zolpidem.

# August 5, 2008 4:29 PM