/// <summary> /// Fetch details for a single notification template by ObjectId and populate the local instance's properties with it /// </summary> /// <param name="pObjectId"> /// Unique identifier for notification template to fetch /// </param> /// <returns> /// Instance of the WebCallResults class with details of the fetch results. /// </returns> private WebCallResult GetNotificationTemplate(string pObjectId) { string strUrl = string.Format("{0}notificationtemplates/{1}", HomeServer.BaseUrl, pObjectId); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Helper function to fill in the Location instance with data from a Location by its objectID string or their hostaddress string. /// </summary> /// <param name="pObjectId"></param> /// <param name="pDisplayName"></param> /// <returns></returns> private WebCallResult GetLocation(string pObjectId, string pDisplayName = "") { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { int iCount; strObjectId = GetObjectIdFromName(pDisplayName, out iCount); if (string.IsNullOrEmpty(strObjectId)) { WebCallResult oRes = new WebCallResult(); oRes.Success = false; if (iCount > 1) { oRes.ErrorText = "More than one location found for host address=" + pDisplayName; } else { oRes.ErrorText = "No location found for host address=" + pDisplayName; } return(oRes); } } string strUrl = string.Format("{0}locations/connectionlocations/{1}", HomeServer.BaseUrl, strObjectId); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetch a role by objectId or name and fill the properties (if found) of the current class instance with what's found /// </summary> /// <param name="pObjectId"> /// GUID of the role to find. /// </param> /// <returns> /// WebCallResults instance. /// </returns> private WebCallResult GetPolicy(string pObjectId) { string strUrl = HomeServer.BaseUrl + "policies/" + pObjectId; //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fills the current instance with details of a call handler template fetched using the ObjectID or the name. /// </summary> /// <param name="pObjectId"> /// ObjectId to search for - can be empty if name provided. /// </param> /// <param name="pDisplayName"> /// display name to search for. /// </param> /// <returns> /// Instance of the webCallSearchResult class. /// </returns> private WebCallResult GetCallHandlerTemplate(string pObjectId, string pDisplayName) { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { int iCount; strObjectId = GetObjectIdFromName(pDisplayName, out iCount); if (string.IsNullOrEmpty(strObjectId)) { WebCallResult oRes = new WebCallResult(); oRes.Success = false; if (iCount > 1) { oRes.ErrorText = "More than one template found for display name=" + pDisplayName; } else { oRes.ErrorText = "No template found for display name=" + pDisplayName; } return(oRes); } } string strUrl = string.Format("{0}callhandlertemplates/{1}", HomeServer.BaseUrl, strObjectId); var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fills the current instance with details of a routing rule fetched using the ObjectID or the name. /// </summary> /// <param name="pObjectId"> /// ObjectId to search for - can be empty if name provided. /// </param> /// <param name="pDisplayName"> /// display name to search for. /// </param> /// <returns> /// Instance of the webCallSearchResult class. /// </returns> private WebCallResult GetRoutingRule(string pObjectId, string pDisplayName) { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { strObjectId = GetObjectIdFromName(pDisplayName); if (string.IsNullOrEmpty(strObjectId)) { return(new WebCallResult { Success = false, ErrorText = "Could not find routing rule by display name:" + pDisplayName }); } } string strUrl = string.Format("{0}routingrules/{1}", HomeServer.BaseUrl, strObjectId); //issue the command to the CUPI interface var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fetches a greeting stream off a directory handler /// </summary> /// <param name="pDirectoryHandlerObjectId"> /// The objectID of the directory handler that owns the greeting to be fetched. /// </param> /// <param name="pLanguageCode"> /// Language of the stream file to fetch /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public WebCallResult GetGreetingStreamFile(string pDirectoryHandlerObjectId, int pLanguageCode) { string strUrl = string.Format("{0}handlers/directoryhandlers/{1}/directoryhandlerstreamfiles/{2}", HomeServer.BaseUrl, pDirectoryHandlerObjectId, pLanguageCode); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fills the current instance of RestrictionTable in with properties fetched from the server. If both the display name and ObjectId /// parameters are provided, the ObjectId is used for the search. /// </summary> /// <param name="pObjectId"> /// Unique GUID of the RT to fetch - can be blank if the display name is passed in. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetRestrictionTablePattern(string pObjectId) { //when fetching a RT use the query construct in both cases so the XML parsing is identical string strUrl = string.Format("{0}restrictiontables/{1}/restrictionpatterns/{2}", HomeServer.BaseUrl, RestrictionTableObjectId, pObjectId); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetches a greeting stream off a post greeting recording /// </summary> /// <param name="pPostRecordingGreetingObjectId"> /// The objectID of the post greeting recording that owns the greeting to be fetched. /// </param> /// <param name="pLanguageCode"> /// Language of the stream file to fetch /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public WebCallResult GetGreetingStreamFile(string pPostRecordingGreetingObjectId, int pLanguageCode) { string strUrl = string.Format("{0}postgreetingrecordings/{1}/postgreetingrecordingstreamfiles/{2}", HomeServer.BaseUrl, pPostRecordingGreetingObjectId, pLanguageCode); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetches a greetingstreamfile option object filled with all the properties for a specific entry identified with the ObjectId /// of the call handler that owns it and the name of the greeting rule (Standard, Alternate, OffHours...) /// </summary> /// <param name="pCallHandlerObjectId"> /// The objectID of the call handler that owns the greeting stream to be fetched. /// </param> /// <param name="pGreetingType"> /// The name of the greeting option to fetch (Standard, Alternate, OffHours...) /// </param> /// <param name="pLanguageCode"> /// Language of the stream file to fetch /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public WebCallResult GetGreetingStreamFile(string pCallHandlerObjectId, GreetingTypes pGreetingType, int pLanguageCode) { string strUrl = string.Format("{0}handlers/callhandlers/{1}/greetings/{2}/greetingstreamfiles/{3}", HomeServer.BaseUrl, pCallHandlerObjectId, pGreetingType.Description(), pLanguageCode); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fills the current instance of Mwi in with properties fetched from the server. /// </summary> /// <param name="pObjectId"> /// GUID that identifies the user that owns the device /// </param> /// <param name="pUserObjectId"> /// GUID that identifies the device itself. /// </param> /// <returns></returns> private WebCallResult GetMwi(string pUserObjectId, string pObjectId) { string strUrl = string.Format("{0}users/{1}/mwis/{2}", HomeServer.BaseUrl, pUserObjectId, pObjectId); //issue the command to the CUPI interface var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fetches a transfer option object filled with all the properties for a specific entry identified with the ObjectId /// of the call handler that owns it and the name of the transfer rule (Standard, Alternate, Off Hours) /// </summary> /// <param name="pTransferOptionType"> /// The name of the transfer option to fetch (Standard, Alternate, Off Hours) /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> public WebCallResult GetTransferOption(TransferOptionTypes pTransferOptionType) { string strUrl = string.Format("{0}handlers/callhandlers/{1}/transferoptions/{2}", HomeServer.BaseUrl, CallHandlerObjectId, pTransferOptionType.Description()); //issue the command to the CUPI interface var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fills the current instance of Credential in with properties fetched from the server. /// </summary> /// <param name="pUserObjectId"> /// GUID that identifies the user that owns the credential itself. /// </param> /// <param name="pCredentialType"> /// Credential type to fetch (PIN or Password) /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetCredential(string pUserObjectId, CredentialType pCredentialType) { string strUrl; if (pCredentialType == CredentialType.Password) { strUrl = string.Format("{0}users/{1}/credential/password", HomeServer.BaseUrl, pUserObjectId); } else { strUrl = string.Format("{0}users/{1}/credential/pin", HomeServer.BaseUrl, pUserObjectId); } return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetch details for a single port by ObjectId and populate the local instance's properties with it /// </summary> /// <param name="pObjectId"> /// Unique identifier for port to fetch /// </param> /// <returns> /// Instance of the WebCallResults class with details of the fetch results. /// </returns> private WebCallResult GetPort(string pObjectId) { if (string.IsNullOrEmpty(pObjectId)) { return(new WebCallResult { ErrorText = "Empty ObjectId encountered in GetPort" }); } string strUrl = string.Format("{0}ports/{1}", HomeServer.BaseUrl, pObjectId); //issue the command to the CUPI interface var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fills the current instance of RoutineRuleCondition in with properties fetched from the server. If both the display name and ObjectId /// parameters are provided, the ObjectId is used for the search. /// </summary> /// <param name="pObjectId"> /// Unique GUID of the routing rule condition to fetch - can be blank if the display name is passed in. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetRoutingRuleCondition(string pObjectId) { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { return(new WebCallResult { Success = false, ErrorText = "Empty objectId passed to GetRoutingRuleCondition" }); } string strUrl = string.Format("{0}routingrules/{1}/routingruleconditions/{2}", HomeServer.BaseUrl, RoutingRuleObjectId, strObjectId); return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fills the current instance of GetSchedule in with properties fetched from the server. If both the display name and ObjectId /// parameters are provided, the ObjectId is used for the search. /// </summary> /// <param name="pObjectId"> /// Unique GUID of the schedule to fetch - can be blank if the display name is passed in. /// </param> /// <param name="pDisplayName"> /// Display name of schedule set to fetch /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetScheduleSet(string pObjectId, string pDisplayName) { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { strObjectId = GetObjectIdFromName(pDisplayName); if (string.IsNullOrEmpty(strObjectId)) { return new WebCallResult { Success = false, ErrorText = "Could not find schedule set by DisplayName=" + pDisplayName }; } } string strUrl = string.Format("{0}schedulesets/{1}", HomeServer.BaseUrl, strObjectId); return HomeServer.FillObjectWithRestGetResults(strUrl,this); }
/// <summary> /// Fills the current instance of Schedule in with properties fetched from the server. If both the display name and ObjectId /// parameters are provided, the ObjectId is used for the search. /// </summary> /// <param name="pObjectId"> /// Unique GUID of the schedule to fetch - can be blank if the display name is passed in. /// </param> /// <param name="pDisplayName"> /// Display name to search on a schedule by. Can be blank if the ObjectId parameter is provided. /// </param> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetSchedule(string pObjectId, string pDisplayName = "") { string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { strObjectId = GetObjectIdFromName(pDisplayName); if (string.IsNullOrEmpty(strObjectId)) { return(new WebCallResult { Success = false, ErrorText = "No schedule found by name=" + pDisplayName }); } } string strUrl = string.Format("{0}schedules/{1}", HomeServer.BaseUrl, strObjectId); return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetch details for a single port group by ObjectId/name and populate the local instance's properties with it /// </summary> /// <param name="pObjectId"> /// Unique identifier for port group to fetch /// </param> /// <param name="pDisplayName"> /// Optional display name to search for a port group by /// </param> /// <returns> /// Instance of the WebCallResults class with details of the fetch results. /// </returns> private WebCallResult GetPortGroup(string pObjectId, string pDisplayName) { string strObjectId; //when fetching a phone system prefer the ObjectId if provided if (!string.IsNullOrEmpty(pObjectId)) { strObjectId = pObjectId; } else if (!string.IsNullOrEmpty(pDisplayName)) { //fetch the ObjectId for the name if possible strObjectId = GetObjectIdByPortGroupName(pDisplayName); if (string.IsNullOrEmpty(strObjectId)) { return(new WebCallResult { Success = false, ErrorText = "No port group found for display name passed into GetPortGroup:" + pDisplayName }); } } else { return(new WebCallResult { Success = false, ErrorText = "No value for ObjectId or display name passed to GetPortGroup." }); } string strUrl = string.Format("{0}portgroups/{1}", HomeServer.BaseUrl, strObjectId); //issue the command to the CUPI interface var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Helper function to fill in the user instance with data from a user by their objectID string or their alias string. /// </summary> /// <param name="pObjectId"></param> /// <param name="pAlias"></param> /// <returns></returns> private WebCallResult GetGlobalUser(string pObjectId, string pAlias = "") { //when fetching a base user use the query construct (which returns less data and is quicker) than the users/(objectid) format for //UserFull object. string strObjectId = pObjectId; if (string.IsNullOrEmpty(pObjectId)) { strObjectId = GetObjectIdFromAlias(pAlias); if (string.IsNullOrEmpty(strObjectId)) { return(new WebCallResult { Success = false, ErrorText = "No global user found with alias = " + pAlias }); } } string strUrl = string.Format("{0}globalusers/{1}", HomeServer.BaseUrl, strObjectId); //issue the command to the CUPI interface return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Fetch details for a single external service by ObjectId/name and populate the local instance's properties with it /// </summary> /// <param name="pObjectId"> /// Unique identifier for service to fetch /// </param> /// <param name="pDisplayName"> /// Optional display name to search for a service system for /// </param> /// <returns> /// Instance of the WebCallResults class with details of the fetch results. /// </returns> private WebCallResult GetExternalService(string pObjectId, string pDisplayName) { string strObjectId; if (!string.IsNullOrEmpty(pObjectId)) { strObjectId = pObjectId; } else if (!string.IsNullOrEmpty(pDisplayName)) { //fetch the ObjectId for the name if possible strObjectId = GetObjectIdByServiceName(pDisplayName); if (string.IsNullOrEmpty(strObjectId)) { return(new WebCallResult { Success = false, ErrorText = "No external service found for display name passed into GetExternalService:" + pDisplayName }); } } else { return(new WebCallResult { Success = false, ErrorText = "No value for ObjectId or display name passed to GetObjectIdByServiceName." }); } string strUrl = string.Format("{0}externalservices/{1}", HomeServer.BaseUrl, strObjectId); var res = HomeServer.FillObjectWithRestGetResults(strUrl, this); ClearPendingChanges(); return(res); }
/// <summary> /// Fills the current instance of ScheduleDetail in with properties fetched from the server. Requires both the Id for the schedule and /// the ID for the dtail be passed in /// </summary> /// <returns> /// Instance of the WebCallResults class containing details of the items sent and recieved from the CUPI interface. /// </returns> private WebCallResult GetScheduleDetail(string pScheduleObjectId, string pScheduleDetailObjectId) { string strUrl = string.Format("{0}schedules/{1}/scheduledetails/{2}", HomeServer.BaseUrl, pScheduleObjectId, pScheduleDetailObjectId); return(HomeServer.FillObjectWithRestGetResults(strUrl, this)); }
/// <summary> /// Helper function to fill in the mailbox info instance with data from Connection. /// </summary> /// <returns> /// WebCallResult instance /// </returns> private WebCallResult GetMailboxInfo(string pUserObjectId) { string strUrl = string.Format("{0}mailbox?userobjectid={1}", HomeServer.BaseUrl,pUserObjectId); return HomeServer.FillObjectWithRestGetResults(strUrl,this); }