private void JobSubmitRequestTTS_Click_1(object sender, EventArgs e) { //JobSubmitRequest TTS // setup EMsgAPI object - EM EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitService EM = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitService(); // setup Authentication objects EMsgAPI_JobSubmit201101.RequestAuthentication reqAuth = new EMsgAPI_JobSubmit201101.RequestAuthentication(); EMsgAPI_JobSubmit201101.XDDSAuthType XDDSAuth = new EMsgAPI_JobSubmit201101.XDDSAuthType(); EMsgAPI_JobSubmit201101.UIDType uid = new EMsgAPI_JobSubmit201101.UIDType(); // init Authentication objects XDDSAuth.Password = txtAccessCode.Text; uid.Value = txtUserId.Text; XDDSAuth.RequesterID = uid; reqAuth.Item = XDDSAuth; // Setup MessageObject EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType[] JS_Message = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType[1]; JS_Message[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.MessageType(); // Setup JobOptions - Voice and CRef EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobOptionsType JS_JobOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobOptionsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType JS_CRef = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.EncodableStringType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceOptionsType JS_VoiceOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceOptionsType(); // set CREF and Billing Code JS_CRef.Value = "Voice Job from Premiere Connect"; JS_JobOptions.CustomerReference = JS_CRef; // Set VoiceOptions JS_VoiceOptions.ANI = txtANI.Text; JS_VoiceOptions.VoiceDeliveryMethod = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceDeliveryMethodType.PAMD; JS_VoiceOptions.VoiceDeliveryMethodSpecified = true; JS_VoiceOptions.RecipientTimezoneOptionSpecified = false; // Set JobOptions as FaxOptions JS_JobOptions.VoiceOptions = JS_VoiceOptions; // Set Message Object JS_Message[0].JobOptions = JS_JobOptions; // Free Objects JS_JobOptions = null; JS_VoiceOptions = null; JS_CRef = null; // Setup Documents EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType[] JS_Documents = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType[1]; JS_Documents[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocumentType(); // Setup reusable variables for the document EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocDataType DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.DocDataType(); // Setup Document - TTS Template to be used EMsgAPI_Demo.EMsgAPI_JobSubmit201101.SosObjectIdType sosObject = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.SosObjectIdType(); sosObject.ownershipLevel = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.OwnershipLevelType.customer; sosObject.ownershipLevelSpecified = true; sosObject.sosType = "tts"; sosObject.Value = "tts_insert"; JS_Documents[0].Item = sosObject; JS_Documents[0].DocType = "unspec"; JS_Documents[0].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ItemChoiceType.SosObject; JS_Documents[0].@ref = "TTS"; DocData = null; // Setup Content EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType EM_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType(); EM_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType[] JS_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType[1]; JS_Content[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.ContentPartType(); JS_Content[0].Item = "TTS"; JS_Content[0].Item = JS_Documents[0]; JS_Content[0].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit201101.TreatmentType.voice_all; JS_Content[0].TreatmentSpecified = true; // Setup Destination EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceType[] delivery = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceType[1]; delivery[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.VoiceType(); delivery[0].Phone = txtPhoneNumber.Text; // Setup Insert(s) EMsgAPI_Demo.EMsgAPI_JobSubmit201101.InsertListTypeInsert[] inserts = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.InsertListTypeInsert[1]; inserts[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.InsertListTypeInsert(); inserts[0].number = "1"; inserts[0].Value = "Hello, We're testing a new provider and you've been selected as a test subject. Thanks for volunteering!"; delivery[0].InsertList = inserts; delivery[0].@ref = "Phone Number Entered"; EM_Content.Part = JS_Content; JS_Message[0].Contents = EM_Content; JS_Message[0].Destinations = delivery; JS_Message[0].MessageId = System.Environment.MachineName + DateTime.Now; JS_Content = null; // Setup Request and JobSubmitRequest object EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Request Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Request(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Response Response = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.Response(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitRequest JS_Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitRequest(); EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitResult JS_Result = new EMsgAPI_Demo.EMsgAPI_JobSubmit201101.JobSubmitResult(); // Everything is Setup Prepare to Launch Job // First check to see if we need to setup proxy Set_Server_and_Proxy(EM); // Setup Reqeust Object Request.ReceiverKey = EM.Url; Request.Authentication = reqAuth; // Assign Reqeust and Response objects to EM Object EM.RequestValue = Request; EM.ResponseValue = Response; JS_Request.Message = JS_Message; //JS_Request.DocumentSet = JS_Documents; try { JS_Result = EM.JobSubmit(JS_Request); } catch (Exception ex) { System.Console.WriteLine(ex.Message); System.Console.Read(); return; } if (JS_Result.Status.StatusCode != null) { string JobNumber; JobNumber = JS_Result.MessageResult[0].JobId.XDN + ":" + JS_Result.MessageResult[0].JobId.MRN; txtJobNumber.Text = JobNumber; } string emfilename = "emresponse.xml"; string resfilename = "result.xml"; //string reqfilename = "request.xml"; try { //This will output the response, result and request(if uncommented) to XML files in the //installed directory. This can be very usefull for debugging or ir help is requested from //the EMAPI support team if (chkResult) { serializeResult(emfilename, EM.ResponseValue); serializeResult(resfilename, JS_Result); //serializeResult(reqfilename, JS_Request); } } catch (IOException io_error) { MessageBox.Show("Error - " + io_error, "Error", MessageBoxButtons.OK); } }