/// <summary> /// Fetches a greeting stream file object filled with all the properties for a greeting stream for a post greeting recording /// </summary> /// <param name="pConnectionServer"> /// The Connection server that the greeting is homed on. /// </param> /// <param name="pPostGreetingRecordingObjectId"> /// The objectID of the post greeting recording that owns the greeting to be fetched. /// </param> /// <param name="pLanguageCode"> /// The language of the greeting stream to fetch /// </param> /// <param name="pGreetingStreamFile"> /// The out parameter that the instance of the PostGreetingRecordingStreamFile class filled in with the details of the /// fetched entry is passed back on. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public static WebCallResult GetGreetingStreamFile(ConnectionServerRest pConnectionServer, string pPostGreetingRecordingObjectId, int pLanguageCode, out PostGreetingRecordingStreamFile pGreetingStreamFile) { WebCallResult res = new WebCallResult(); res.Success = false; pGreetingStreamFile = null; if (pConnectionServer == null) { res.ErrorText = "Null Connection server object passed to GetGreetingStreamFile"; return(res); } //create a new greeting instance passing the greeting type name and language which fills out the data automatically try { pGreetingStreamFile = new PostGreetingRecordingStreamFile(pConnectionServer, pPostGreetingRecordingObjectId, pLanguageCode); res.Success = true; } catch (UnityConnectionRestException ex) { return(ex.WebCallResult); } catch (Exception ex) { res.ErrorText = "Failed to fetch greeting stream file in GetGreetingStreamFile:" + ex.Message; } return(res); }
/// <summary> /// Overloaded GetGreetingWavFile function that takes the post greeting recording ID and language code which looks up /// the stream file name to fetch from the Connection server. /// </summary> /// <param name="pConnectionServer"> /// Connection server that houses the greeting being fetched. /// </param> /// <param name="pTargetLocalFilePath"> /// The fully qualified file path on the local OS to store the WAV file for this stream. /// </param> /// <param name="pPostGreetingRecordingObjectId"> /// The post greeting recording that owns the greeting being fetched. /// </param> /// <param name="pLanguageCode"> /// The language code (i.e. US English = 1033). /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public static WebCallResult GetGreetingWavFile(ConnectionServerRest pConnectionServer, string pTargetLocalFilePath, string pPostGreetingRecordingObjectId, int pLanguageCode) { WebCallResult res = new WebCallResult(); res.Success = false; if (pConnectionServer == null) { res.ErrorText = "Null ConnectionServer referenced passed to GetGreetingWavFile"; return(res); } //fetch the greeting stream file object for this greeting and language code. PostGreetingRecordingStreamFile oStreamFile; try { oStreamFile = new PostGreetingRecordingStreamFile(pConnectionServer, pPostGreetingRecordingObjectId, pLanguageCode); } catch (UnityConnectionRestException ex) { return(ex.WebCallResult); } catch (Exception ex) { //this will be rather common - keep the wording here toned down. res.ErrorText = "No greeting stream file found for greeting in GetGreetingWavFile: " + ex.Message; return(res); } //fetch the StreamFile name from the directory - this identifies the actual WAV file in the streams folder on the Connection //server. Normally if there's a greeting stream file record for a greeting there will be a stream file for it - but just //in case. if (String.IsNullOrEmpty(oStreamFile.StreamFile)) { res.ErrorText = "No recording found for stream file"; return(res); } //call the alternateive static definition that actually has the WAV file fetch logic in it. return(GetGreetingWavFile(pConnectionServer, pTargetLocalFilePath, oStreamFile.StreamFile)); }
//helper function to fetch all custom post greeting stream files devined on the server private WebCallResult GetGreetingStreamFiles(out List <PostGreetingRecordingStreamFile> pGreetingStreamFiles) { return(PostGreetingRecordingStreamFile.GetGreetingStreamFiles(HomeServer, ObjectId, out pGreetingStreamFiles)); }