In my last post on UCMA 2.0 application provisioning, I provided some resources to help you provision a trusted application with Office Communications Server 2007 R2.
Once you have that trusted application contact, you use the values in AppProvisioner.exe in your code via to construct your ServerPlatformSettings instance used to create your CollaborationPlatform and in the ApplicationEndPointSettings used to create your ApplicationEndPoint instance.
For example, using my VM based development environment I’ve created a trusted contact called JimDaly_LabApp (since I log in to the VMs as Jim Daly) with the following trusted contact settings:
The code to establish your ServerPlatformSettings/CollaborationPlatform and ApplicationEndPointSettings/ApplicationEndPoint might be a little confusing at first since the values in AppProvisioner.exe are named differently from the parameters used to instantiate those classes. For example, here is the code I use to create my ServerPlatformSettings and CollaborationPlatfrom in code:
1: #region ServerPlatformSettings settings from AppProvisioner.
3: // Name of this application, to be used as the outgoing user agent string in headers, etc.
4: private static string _applicationUserAgent = "How2_UCMA20_AppProvisioning";
5: // FQDN of the machine where the application is deployed, called "Server FQDN" in AppProvisoner.
6: private static string _localHost = "TS.Fabrikam.com";
7: // Port on which your application will listen, called "Listening Port" in AppProvisioner.
8: private static int _port = 6000;
9: // Trusted application GRUU for your application, called "Gruu" in Approvisioner.
10: private static string _gruu = "sip:TS.Fabrikam.com@Fabrikam.com;gruu;opaque=srvr:JimDaly_LabApp:drb9DrwtxkuUMmKwz3MFTQAA";
16: ServerPlatformSettings settings = new ServerPlatformSettings(
23: _collabPlatform = new CollaborationPlatform(settings);
The first time you write this code, you might not know that the “Listening Port” value in AppProvisioner.exe is used in the port parameter for the ServerPlatformSettings constructor.
Likewise, I use the following code to create my ApplicationEndpointSettings and ApplicationEndpoint instances:
1: #region ApplicationEndpointSettings settings from AppProvisioner.
3: // Contact URI for the AppEndpoint, called "Contact Uri" in AppProvisioner.
4: private static string _ownerURI = "sip:email@example.com";
5: // OCS Pool FQDN where the AppEndpoint contact is defined, called
6: private static string _proxyHost = "OCS-STD.Fabrikam.com";
7: // The port that Office Communications Server is configured to listen on, configured in OCS, not AppProvisioner.
8: private static int _tlsPort = 5061;
14: //Initialize and register the endpoint, using the credentials of the user the application will be acting as.
15: ApplicationEndpointSettings settings = new ApplicationEndpointSettings(
19: _applicationEndpoint = new ApplicationEndpoint(_collabPlatform, settings);
Once you know that mapping, getting your code up and running is straightforward. Using the PublishAlwaysOnline sample, I started up my trusted application so other contacts could see it’s online presence in OC 2007 R2.
In a production application, you wouldn’t hardcode those values, but instead get them at runtime using the ApplicationProvisioning API used by the AppProvisioner.exe sample, but this is a good first step to getting some simple scenarios up and running.