Thursday, April 03, 2008

Unit testing code is important.  If you make code changes in a library that other people are using, you want to make sure all of the code works as expected.  Using NUnit is great for that.

However, when it comes to speech applications, you probably manually test your applications before each release.

If you are writing managed code for Office Communications Server 2007 Speech Server, and you are using a SIP for your telephony lines, I have something that will help you automate your testing.  I created a simple class that will send SIP INFO requests to the caller if they include "log=true" in the SIP URI parameters.  It basically works like this:

  1. Call into your application and then generate a test script based on the call log.
  2. Run the customized OutboundCalls application, passing your newly generated script as the script to run.
  3. The OutboundCalls application will automatically go through the application, following the same path.

Attached is the unit testing code, a demo and some basic instructions.  Open the UnitTesting solution and read the ReadMe.htm file for all the details.

Happy Testing!

UnitTesting.zip (8 MB)
4/3/2008 6:13:06 PM (GMT Daylight Time, UTC+01:00)  #    Comments [4]  |  Trackback
5/15/2009 8:42:15 PM (GMT Daylight Time, UTC+01:00)
Eric, this is great and just what I've been looking for. Could you say more about how to use it, though? For instance, it seems I can not run it in Visual Studio (I get the error that we can't make an outgoing call as "the current state is incoming" --> "Unable to establish session with remote party. Response Code 486."

Do I need two SIP lines dedicated to my dev machine?

The low-level SIP stuff is not my province, so I need a little guidance there, if you could . . .

Thanks!
6/8/2009 10:59:30 PM (GMT Daylight Time, UTC+01:00)
Well, Eric's disappeared, but I did finally get this working. For anyone who wants to use this, I encourage you to really go through the ReadMe.htm file in the UnitTesting project. However, it does assume a good bit of knowledge that I didn't have, so I am posting here a more detailed version of the "To run the demo" section (sorry for the formatting, but no HTML allowed):

[SydneyOs: Modified instructions below]
To set up the demo:
Set the CallingParty on the MakeCallActivity - not sure why this isn't in there, but I couldn't get it to work without it. So, add the following line of code in OutboundCallsWorkflow.OnEntry:
makeCall.CallingParty = new SipUriTelephonyAddress(new SipUri("sip:OutboundCalls@localhost"));
Register the LoggingInstrumentation and OutboundCalls applications in the Speech Server Admin console
When you register the Logging Instrumentation app in the Admin Console, remove the Called Party "*" designation and add a "LoggingInst" Called Party to match that in the Sip Uri
Note: If the Target App is on a different server, you need to do the following:
Deploy the LoggingInst app to the Target Server (create IIS App for it), register in Admin Console and set the Called Party to LoggingInst
In Admin Console, add the Target Server as a Trusted Peer on your Dev/Test machine.
Make sure to check "Allow outbound calls"
In Admin Console on the Target Server, add your Dev/Test machine as a trusted peer
In OutboundNumbers.xml, change the sip uri to reflect your target server's IP
To run the demo:
Run the OutboundCalls.aspx page from IIS (will not work to run from Visual Studio)
Click "Send Trigger"
I added trace statements in both apps to know that it was running properly. If the target server is on a different machine, you can also run WireShark with a display filter of "sip" to see that the call is working. You won't see any sip traffic if running locally.
6/8/2009 11:01:16 PM (GMT Daylight Time, UTC+01:00)
By the way, I initially got this running on a separate server, which is why I have the bit about a two server setup, but to get the call log for use in generating a test script, I'm pretty sure you want a single machine setup so all the logging is in one place.
6/18/2009 6:53:08 AM (GMT Daylight Time, UTC+01:00)
Hi... I have newly taken a managed service from service provider in CA. from.. http://www.onthenetoffice.com/overview.html its working good for me.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Theme design by Jelle Druyts

Pick a theme: