Cisco Cisco TelePresence Management Suite (TMS) Version 15 Developer's Guide

Page of 33
Code examples 
Cisco TMS Extension Booking API Programming Reference Guide (13.0.1) 
Page 28 of 33 
 
 
// (Can also be done in web.config)  
NetworkCredential credentials = new NetworkCredential(“xxx”, “yyy”, “ZZZ”);  
BookingService bookingService = new BookingService();  
bookingService.Credentials = credentials;  
// Set API to use version 6  
if (bookingService.ExternalAPIVersionSoapHeaderValue == null)  
bookingService.ExternalAPIVersionSoapHeaderValue = new 
BookingService.ExternalAPIVersionSoapHeader(); 
bookingService.ExternalAPIVersionSoapHeaderValue.ClientVersionIn = 5; 
// Get a default conference object, where most common values are set  
// (using default values specified in TMS)  
Conference conference = bookingService.GetDefaultConference();  
// Create an array of participants  
Participant[] participants = new Participant[2];  
// Create the elements of the array (the actual participants)  
participants[0] = new Participant();  
participants[0].ParticipantCallType = ParticipantType.IPVideo1; // Dial-out video  
  participants[0].NameOrNumber = “10.47.8.170”;  
// get the recording aliases from the service 
RecordingDevicd[] recordingDevicesWithAliases = bookingService.GetRecordingAliases(""); 
Participant tcs = new Participant(); 
if (recordingDevicesWithAliases != null && recordingDevicesWithAliases.Count() > 0) 
    // use the first recording device in the array 
    var recordingAlias = recordingDevicesWithAliases.First(); 
    if (recordingAlias.Value != null && recordingAlias.Value.Count() > 0) 
    { 
 
// use the first alias found on the first recording device  
 
AliasInfo aliasInfo = recordingAlias.Value.First(); 
 
tcs.ParticipantCallType = ParticipantType.TMS; 
 
tcs.ParticipantId = aliasInfo.SystemId; 
 
tcs.NameOrNumber = aliasInfo.AliasId; 
    } 
participants[1] = tcs; 
conference.Participants = participants; 
// Save the conference, saving the returned conference (where all values are now 
specified)  
conference = bookingService.SaveConference(conference);  
// Output information about the conference.  
Console.Out.WriteLine(conference.ConferenceInfoText);  
Console.Out.WriteLine(conference.UserMessageText);  
Console.Out.WriteLine(conference.ConferenceId); 
Error handling example 
The code show how to handle errors generated from API calls. If the Cisco TMS server is operational with 
the proper licenses, the errors are caused by sending wrong parameters to the API, like doing bookings in 
the past, or trying to get systems in Cisco TMS using the wrong ID.  
All errors generated from the API are SoapExceptions, hence each time a save operation is performed 
against the API, the code should handle exceptions of type SoapException.