"Hello World" with BT SDK

BT SDK is a new API released by BT (British Telecom) as part of the Web21 C initiative. In this tutorial, I’ll write a Hello world SMS application demonstrating the power of this SDK. The SDK is now live and available for production use. For more information and downloads, visit http://sdk.bt.com.

The SDK in its current phase supports the following capabilities:

Short Message Service - The Short Message Service (SMS) allows the application developer the ability for individuals to send SMS messages.

Voice Call - The Voice Call service allows application developers to add the ability for individuals to place phone calls from their application.

Conference Call - The Conference Call service allows the application developer the ability for individuals to place and control conference calls.

Contacts - The Contacts service allows the application developer the ability to store and retrieve an individual’s current status and availability for communication.

Authentication - The Authentication service allows the application developer to create and control an authentication realm for their application. This includes management and authentication of users.

Information About Me - The Information About Me (IAM) service allows the application developer a way to store and retrieve data about an individual in key value pairs.

Location - The Location service allow the application developer to add the ability to determine the geographic location (latitude, longitude, altitude) of a mobile device. Currently the Location service only operates in mainland UK with BT issued mobiles, but with service providers partnering all the time, the location service will very soon increase.

 

Right, lets start with the sample:

 

Step 1: Downloading the SDK

The first step is to register on the SDK portal (http://sdk.bt.com/) and download the SDK Release 3.0.

 

http://sdk.bt.com/Downloads/tabid/38/Default.aspx

 

Make sure you remove any earlier version of BT SDK before installing the latest release.

 

 

 

As  youll see from the download page that there are few pre requisites for using the SDK.

Technical Requirements

Supported Operating Systems:

·          Microsoft Windows Server 2003 Service Pack 1

·          Microsoft Windows XP Service Pack 2

Required Software:

·          Microsoft.NET Framework 2.0

·          Microsoft Visual Studio 2005

·          Web Services Enhancements v3.0 (WSE 3.0)  (http://msdn.microsoft.com/webservices/webservices/building/wse/default.aspx)

 

Once you have all the required softwares, you can now download and install the BT SDK. The installation also configures the Visual Studio toolbox as there are few SDK controls to help you with the development.

 

 

 

Step 2: Register Application-

After installation, youll need to register an application on the portal. I think each application is isolated to have usage limit during the beta. As you complete the installation, you’ll see another dialog box to help you complete the registration process.

 

 

 

Click the "BT SDK Application Registration Wizard" button to open the certificate tool page. The certificate is now available as Java Web Start application (jnlp file) therefore you'll need to have Java 5.0 installed.

 

 

 

And the Certificate Tool looks like this:

 

 

 

Once you click "Submit Certificate to sdk.bt.com for Signing", it will process the steps defined under section (4) and ask you to save the certificate to some secure location. You'll also need to provide a password for your certificate.  After you save your password, you need to import it into your "Personal store" to use by your application. Double click on the saved PFX file to open  "Certificate Import Wizard".

 

 

 

 

 

 

Press Next and Finish to complete this step.

 

Step 4: Generate WSE 3.0 Policy File-

 

Now from the main setup screen, select the "Generate Policy" option.

 

 

 

Once the "BT Wse3 Policy Generation Wizard" started, select next a couple of times to move the certificate selection screen.

 

 

 

Select the certificate which you just imported and click next to generate the configuration file to your application directory.

 

 

After the file is generated; Close this wizard and also close the main SDK Setup screen. Now it's time to start writing some code.

 

Step 5: Writing the Application-

Finally, we are here to write our Hello world application. Create a new project ( a Console Application) for this sample. Add References to a couple of dll which you can find in %PROGRAM FILES%\BT\BT SDK Release 3.0\BIN\ directory. These assemblies are btsdk.dll and btsdkcomponents.dll.

 

 

 

Also add the WSE 3.0 policy file that you created in the last step to this project. Make sure you set the Build Action on the policy file to Content and make it Copy always to the output folder.

 

 

 

Also add the application configuration file (app.config) to configure WSE. You can paste the following XML directly in the app.config file.

 

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <!-- this section required by BT SDK/WSE3-->

  <configSections>

    <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  </configSections>

  <microsoft.web.services3>

    <security>

      <x509 storeLocation="CurrentUser" />

    </security>

    <policy fileName="wse3policyCache.config" />

    <diagnostics>

      <trace enabled="false"/>

    </diagnostics>

  </microsoft.web.services3>

 

</configuration>

 

Now, you can add the following code to the Main method to send an SMS.

 

using System;

using System.Collections.Generic;

using System.Text;

using BT.Sdk.Components;

 

namespace SMSSample

{

    class Program

    {

        static void Main(string[] args)

        {

            OneWayMessaging oneWay = new OneWayMessaging();

            oneWay.SendMessage("Hello world",  "destination_number"); // replace destination_number with the actual number

        }

    }

}

 

And a second later, I get the SMS on my phone. OK, it is not clear but that is not due to any bug in the SDK. Actually, for some reason, I can't get a clear picture of the SMS. But believe me, it is “Hello World”.

 

 

 

Troubleshooting:

If you are fortunate then you may find some issues during installation or at runtime. If you get an error or have some suggestions then make sure that you log on to the SDK Portal to register the issue.

3 Comments

  • Hello Nauman. thanks for the article i find these bt services very exciting. i've followed your article but this code:

    Sms newSMS = new Sms();
    newSMS.SendMessage("hello from my pc","07973613767");

    throws the following error:

    "The exception that is thrown when one of the arguments provided to a method is not valid (Invalid tel uri: tel:07973613767)"

    i presume i need to format the phone number differently?

  • I've now read the documentation ;^) and add the country code in front of the phone number

    Sms newSMS = new Sms();
    newSMS.SendMessage("hello from my pc","4407973613767");

    this no longer errors, however i have not received a text message my mobile is an orange mobile, will this make any difference i'd be grateful fro your help.

  • Make sure that you don't put 0 after the country code. So it should be
    newSms.SendMessage("hello", "44797......");

Comments have been disabled for this content.