Пример #1
0
 /// <summary>
 /// Update the recorded WAV file for a greeting stream for a specific language.  Each greeting can have multiple language versions recorded
 /// so the language along with the greeting itself need to be identified for updating.
 /// You have the option of having the WAV file converted into raw PCM prior to uploading to prevent codec compatibility issues with the
 /// recording.
 /// </summary>
 /// <param name="pConnectionServer">
 /// The server the greeting being edited is homed on.
 /// </param>
 /// <param name="pPostGreetingRecordingObjectId">
 /// The post greeting recording that owns the greeting being edited.
 /// </param>
 /// <param name="pLanguageCode">
 /// Language code to use (i.e. US English = 1033).  The LanguageCodes enum deinfed in the ConnectionServer class can be helpfull here.
 /// </param>
 /// <param name="pSourceLocalFilePath">
 /// The full path to a WAV file to upload as the greeting stream.
 /// </param>
 /// <param name="pConvertToPcmFirst">
 /// Optional parameter to convert the WAV file into PCM first.  Most codecs are handled by this conversion including G729a, MP3, GSM 610 etc...
 /// however if the file conversion fails then the upload itself is not attempted and failure is returned.
 /// If the file is already in PCM the conversion operation is just a copy and the upload proceeds as normal.
 /// </param>
 /// <returns>
 /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
 /// </returns>
 public static WebCallResult SetGreetingWavFile(ConnectionServerRest pConnectionServer,
                                                string pPostGreetingRecordingObjectId,
                                                int pLanguageCode,
                                                string pSourceLocalFilePath,
                                                bool pConvertToPcmFirst = false)
 {
     return(PostGreetingRecording.SetPostGreetingRecordingWavFile(pConnectionServer, pSourceLocalFilePath, pPostGreetingRecordingObjectId,
                                                                  pLanguageCode, pConvertToPcmFirst));
 }
Пример #2
0
        /// <summary>
        /// returns a single PostGreetingRecording object from an ObjectId string or display name passed in.
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server that the greeting is homed on.
        /// </param>
        /// <param name="pObjectId">
        /// The ObjectId of the post greeting recording to load
        /// </param>
        /// <param name="pPostGreetingRecording">
        /// The out param that the filled out instance of the PostGreetingRecording class is returned on.
        /// </param>
        /// <param name="pDisplayName">
        /// Optional display name to search for recording on.  If both the ObjectId and display name are passed, the objectID is used.
        /// The display name search is not case sensitive.
        /// </param>
        /// <returns>
        /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface.
        /// </returns>
        public static WebCallResult GetPostGreetingRecording(out PostGreetingRecording pPostGreetingRecording,
                                                             ConnectionServerRest pConnectionServer, string pObjectId = "", string pDisplayName = "")
        {
            WebCallResult res = new WebCallResult();

            res.Success = false;

            pPostGreetingRecording = null;

            if (pConnectionServer == null)
            {
                res.ErrorText = "Null Connection server object passed to GetPostGreetingRecording";
                return(res);
            }

            //you need an objectID and/or a display name - both being blank is not acceptable
            if ((string.IsNullOrEmpty(pObjectId)) & (string.IsNullOrEmpty(pDisplayName)))
            {
                res.ErrorText = "Empty objectId and display name passed to GetPostGreetingRecording";
                return(res);
            }

            try
            {
                pPostGreetingRecording = new PostGreetingRecording(pConnectionServer, pObjectId, pDisplayName);
                res.Success            = true;
            }
            catch (UnityConnectionRestException ex)
            {
                return(ex.WebCallResult);
            }
            catch (Exception ex)
            {
                res.ErrorText = "Failed to fetch greeting in GetPostGreetingRecording:" + ex.Message;
            }

            return(res);
        }
Пример #3
0
        /// <summary>
        /// Create a new post greeting recording in the Connection directory
        /// </summary>
        /// <param name="pConnectionServer">
        /// Connection server being edited
        /// </param>
        /// <param name="pDisplayName">
        /// Name of the new post greeting recording - should be unique.
        /// </param>
        /// <param name="pPostGreetingRecording">
        /// Instance of newly created post greeting recording is returned on this out parameter
        /// </param>
        /// <returns>
        /// Instance of the WebCallResult class.
        /// </returns>
        public static WebCallResult AddPostGreetingRecording(ConnectionServerRest pConnectionServer, string pDisplayName,
                                                             out PostGreetingRecording pPostGreetingRecording)

        {
            pPostGreetingRecording = null;

            WebCallResult res = AddPostGreetingRecording(pConnectionServer, pDisplayName);

            if (res.Success)
            {
                //fetch the instance of the post greeting recording just created.
                try
                {
                    pPostGreetingRecording = new PostGreetingRecording(pConnectionServer, res.ReturnedObjectId);
                }
                catch (Exception)
                {
                    res.Success   = false;
                    res.ErrorText = "Could not find newly created post greeting recording by objectId:" + res;
                }
            }

            return(res);
        }