From c19e41d1beda9ef4d158ded1701c2d1fee953d5a Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:55:45 +0100 Subject: [PATCH 01/16] Added group_device Added group_device method to post.py --- odins_spear/methods/post.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 9edd90b..50817c2 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -92,6 +92,33 @@ def session_switch(self, username: str): #DEPARTMENTS #DEVICE POLICIES #DEVICES + + def group_device(self, service_provider_id: str, group_id: str, device_name: str, device_type: str): + + """Adds a new device to a group. + + Args: + service_provider_id (str): Service provider ID where the device should be built. + group_id (str): Group ID where the device should be built + device_name (str): Name of the new device + device_type (str): Type of device. + + Returns: + JSON data with the details of the newly created device. + """ + + + endpoint = "/groups/devices" + + data = { + "serviceProviderId": service_provider_id, + "groupId": group_id, + "deviceName": device_name, + "deviceType": device_type + } + + return self.requester.post(endpoint, data=data) + #DIAL PLAN POLICY #DIRECTED CALL PICKUP WITH BARGE IN #DIRECTROUTE From 7f68bf4fcb47af69ef552745e1a14c8d814f9df7 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:35:28 +0100 Subject: [PATCH 02/16] Added group_trunk_groups_call_capacity Added the group_trunk_groups_call_capacity method to put.py under #TRUNK GROUPS --- odins_spear/methods/put.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 93477f3..93051a9 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1028,14 +1028,39 @@ def user_services(self, user_id: str, services: list =None, service_packs: list #TIME ZONES #TRUNK GROUPS + def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: str, max_active_calls: int): + + """ + Updates the maximum call capacity for trunk groups in the specified group. + + Args: + service_provider_id (str): Service provider ID where the target group is built + group_id (str): Group ID whose trunk group call capacity needs updating + max_active_calls (int): The updated number of max active calls + + Returns: + JSON: updated trunk group call capacity details + """ + + endpoint = "/groups/trunk-groups/call-capacity" + + data = { + "serviceProviderId": service_provider_id, + "groupId": group_id, + "maxActiveCalls": max_active_calls + } + + return self.requester.put(endpoint, data=data) + + def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls: int, bursting_max_active_calls: int): """ Updates the max active calls and the bursting max active calls for the given service provider. Args: - service_provider_id (str): service provider id for which the max active calls needs to be updated - max_active_calls (int): the updated number of max active calls - bursting_max_active_calls (int): the updated number of bursting max active calls + service_provider_id (str): Service provider ID for which the max active calls needs to be updated + max_active_calls (int): The updated number of max active calls + bursting_max_active_calls (int): The updated number of bursting max active calls """ From df5ae268ccb34f004731381c5d135f3631f30d51 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:52:25 +0100 Subject: [PATCH 03/16] Reworded doc string --- odins_spear/methods/post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 50817c2..0b3c320 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -104,7 +104,7 @@ def group_device(self, service_provider_id: str, group_id: str, device_name: str device_type (str): Type of device. Returns: - JSON data with the details of the newly created device. + JSON: details of the newly created device. """ From 60f202457900c559639c2afad4ed7940aae05c2b Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:26:44 +0100 Subject: [PATCH 04/16] Added group_hunt_group Added group_hunt_group method to post.py --- odins_spear/methods/post.py | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 0b3c320..828394e 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -273,6 +273,46 @@ def service_provider_dns(self, service_provider_id: str, start_of_range_number: #HOTELING GUEST #HOTELING HOST #HUNT GROUPS + + def group_hunt_group(self, service_provider_id: str, group_id: str, service_user_id: str, clid_first_name: str, clid_last_name:str, extension: str, policy: str ="Regular"): + + """ + Builds a hunt group (HG) in the specified group. + "noAnswerNumberOfRings" is a required field which defaults to 5. + "forwardTimeoutSeconds" is a required field which defaults to 0. + + Args: + service_provider_id (str): The service provider ID in which the target group is built. + group_id (str): The group ID where the HG should be built. + service_user_id (str): The ervice user ID for the new HG. + clid_first_name (str): The Calling Line ID first name. + clid_last_name (str): The Calling Line ID last name. + extension (str): The extension number for the HG. This must be entered as a string. + policy (str, optional): Regular, Circular, Simultaneous, Uniform, Weighted. Defaults to Regular. + + Returns: + JSON: HG profile. + """ + + endpoint = "/groups/hunt-groups" + + data = { + "serviceProviderId": service_provider_id, + "groupId": group_id, + "serviceUserId": service_user_id, + "noAnswerNumberOfRings": 5, + "forwardTimeoutSeconds": 0, + "policy": policy, + "serviceInstanceProfile": { + "callingLineIdFirstName": clid_first_name, + "callingLineIdLastName": clid_last_name, + "name": clid_first_name + " " + clid_last_name, + "extension": extension + } + } + + return self.requester.post(endpoint, data=data) + #IN CALL SERVICE ACTIVATION #INSTANT GROUP CALL #INTEGRATED IMP From b78fac7b56b74aac50c8700847687d7274e585a1 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 14 Jun 2024 16:28:37 +0100 Subject: [PATCH 05/16] Added 2 new methods Added group_trunk_group to post.py and group_trunk_group to put.py --- odins_spear/methods/post.py | 64 +++++++++++++++++++++++++++++++++++++ odins_spear/methods/put.py | 23 +++++++++++++ 2 files changed, 87 insertions(+) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 828394e..cbe0a5e 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -374,6 +374,70 @@ def group_hunt_group(self, service_provider_id: str, group_id: str, service_user #THIRD PARTY EMERGENCY CALLING #TIME ZONES #TRUNK GROUPS + + def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name: str, max_active_calls: int): + + """ + Builds a Trunk Group (TG) in the specified group. + Default fields: + "capacityExceededTrapInitialCalls":0, + "capacityExceededTrapOffsetCalls":0, + "clidSourceForScreenedCallsPolicy":"Profile Name Profile Number", + "continuousOptionsSendingIntervalSeconds":30, + "failureOptionsSendingIntervalSeconds":10, + "failureThresholdCounter":1, + "invitationTimeout":6, + "inviteFailureThresholdCounter":1, + "inviteFailureThresholdWindowSeconds":30, + "pilotUserCallOptimizationPolicy":"Optimize For User Services", + "pilotUserCallingLineAssertedIdentityPolicy":"Unscreened Originating Calls", + "pilotUserCallingLineIdentityForEmergencyCallsPolicy":"No Calls", + "pilotUserCallingLineIdentityForExternalCallsPolicy":"No Calls", + "pilotUserChargeNumberPolicy":"No Calls", + "requireAuthentication":"false", + "successThresholdCounter":1, + "useSystemUserLookupPolicy":"true", + "userLookupPolicy":"Basic", + + Args: + service_provider_id (str): The service provider ID in which the target group is built. + group_id (str): The group ID where the HG should be built. + trunk_name (str): The name of the new TG. + max_active_calls (str): The maximum active calls to be set on the TG. + + Returns: + JSON: TG profile. + """ + + endpoint = "/groups/trunk-groups" + + data = { + "capacityExceededTrapInitialCalls":0, + "capacityExceededTrapOffsetCalls":0, + "clidSourceForScreenedCallsPolicy":"Profile Name Profile Number", + "continuousOptionsSendingIntervalSeconds":30, + "failureOptionsSendingIntervalSeconds":10, + "failureThresholdCounter":1, + "invitationTimeout":6, + "inviteFailureThresholdCounter":1, + "inviteFailureThresholdWindowSeconds":30, + "pilotUserCallOptimizationPolicy":"Optimize For User Services", + "pilotUserCallingLineAssertedIdentityPolicy":"Unscreened Originating Calls", + "pilotUserCallingLineIdentityForEmergencyCallsPolicy":"No Calls", + "pilotUserCallingLineIdentityForExternalCallsPolicy":"No Calls", + "pilotUserChargeNumberPolicy":"No Calls", + "requireAuthentication":"false", + "successThresholdCounter":1, + "useSystemUserLookupPolicy":"true", + "userLookupPolicy":"Basic", + "name":trunk_name, + "maxActiveCalls":max_active_calls, + "serviceProviderId":service_provider_id, + "groupId":group_id + } + + return self.requester.post(endpoint, data=data) + #TWO STAGE DIALING #USERS diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 93051a9..6e83b1c 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1051,6 +1051,29 @@ def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: s } return self.requester.put(endpoint, data=data) + + + def group_trunk_group(self, service_provider_id: str, group_id: str, updates: dict): + + """ + Updates trunk group (TG) information. + + Args: + service_provider_id (str): Service provider ID where the target group is built + group_id (str): Group ID whose trunk group call capacity needs updating + updates (dict): Updates to be applied to the TG. + + Returns: + JSON: Updated TG profile. + + """ + + endpoint = "/groups/trunk-groups" + + updates["serviceProviderId"] = [service_provider_id] + updates["groupId"] = [group_id] + + return self.requester.put(endpoint, data=updates) def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls: int, bursting_max_active_calls: int): From 083e020548b110b6166f15fa46187ce4c75957d1 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:55:58 +0100 Subject: [PATCH 06/16] Added method to put.py Added user_call_processing_policy method --- odins_spear/methods/put.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 6e83b1c..c9b9c59 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -451,6 +451,26 @@ def user_call_center_agent_sign_out(self, user_id: str): #CALL PICKUP #CALL POLICIES #CALL PROCESSING POLICIES + + def user_call_processing_policy(self, user_id: str, updates: dict): + + """ + Update the Call Processing Policies for a specified user. + + Args: + user_id (str): The user ID of the user whose call processing policies need updating. + updates (dict): Updates to apply to the specified user. + + Returns: + JSON: Call Processing Policies for the specified user. + """ + + endpoint = '/users/call-processing-policy' + + updates["userID"] = user_id + + return self.requester.put(endpoint, data=updates) + #CALL RECORDING #CALL RECORDS #CALL TRANSFER From 94679a84e49e44c98a3346552f9ef43ac08b36ca Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 21 Jun 2024 08:59:00 +0100 Subject: [PATCH 07/16] Updated group_device and group_hunt_group methods in post.py Made changes following JP's review: - Added payload as an argument to group_device and group_hunt_group - Added agents as an argument to group_hunt_group which will assign users to the group --- odins_spear/methods/post.py | 64 +++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index cbe0a5e..1dffff0 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -93,8 +93,7 @@ def session_switch(self, username: str): #DEVICE POLICIES #DEVICES - def group_device(self, service_provider_id: str, group_id: str, device_name: str, device_type: str): - + def group_device(self, service_provider_id: str, group_id: str, device_name: str, device_type: str, payload: dict ={}): """Adds a new device to a group. Args: @@ -102,22 +101,20 @@ def group_device(self, service_provider_id: str, group_id: str, device_name: str group_id (str): Group ID where the device should be built device_name (str): Name of the new device device_type (str): Type of device. + payload (dict, optional): Device configuration data. Returns: JSON: details of the newly created device. """ - endpoint = "/groups/devices" - data = { - "serviceProviderId": service_provider_id, - "groupId": group_id, - "deviceName": device_name, - "deviceType": device_type - } + payload["serviceProviderId"] = service_provider_id + payload["groupId"] = group_id + payload["deviceName"] = device_name + payload["deviceType"] = device_type - return self.requester.post(endpoint, data=data) + return self.requester.post(endpoint, data=payload) #DIAL PLAN POLICY #DIRECTED CALL PICKUP WITH BARGE IN @@ -274,44 +271,49 @@ def service_provider_dns(self, service_provider_id: str, start_of_range_number: #HOTELING HOST #HUNT GROUPS - def group_hunt_group(self, service_provider_id: str, group_id: str, service_user_id: str, clid_first_name: str, clid_last_name:str, extension: str, policy: str ="Regular"): - + def group_hunt_group(self, service_provider_id: str, group_id: str, service_user_id: str, + clid_first_name: str, clid_last_name:str, extension: str, payload: dict={}, agents: list=[], + policy: str ="Regular", no_answer_number_of_rings: int=5, forward_timeout_seconds: int=0): """ Builds a hunt group (HG) in the specified group. - "noAnswerNumberOfRings" is a required field which defaults to 5. - "forwardTimeoutSeconds" is a required field which defaults to 0. Args: service_provider_id (str): The service provider ID in which the target group is built. group_id (str): The group ID where the HG should be built. - service_user_id (str): The ervice user ID for the new HG. + service_user_id (str): The service user ID for the new HG. This must include the domain of the user. clid_first_name (str): The Calling Line ID first name. clid_last_name (str): The Calling Line ID last name. extension (str): The extension number for the HG. This must be entered as a string. + payload (dict, optional): HG configuration data. + agents (list, optional): List of user IDs (str) that should be assigned to the new HG. The user(s) must already exist in the group. policy (str, optional): Regular, Circular, Simultaneous, Uniform, Weighted. Defaults to Regular. + no_answer_number_of_rings (int, optional): Defaults to 5. + forward_timeout_seconds (int, optional): Defaults to 0. Returns: - JSON: HG profile. + None: This method does not return any specific value. """ endpoint = "/groups/hunt-groups" - data = { - "serviceProviderId": service_provider_id, - "groupId": group_id, - "serviceUserId": service_user_id, - "noAnswerNumberOfRings": 5, - "forwardTimeoutSeconds": 0, - "policy": policy, - "serviceInstanceProfile": { - "callingLineIdFirstName": clid_first_name, - "callingLineIdLastName": clid_last_name, - "name": clid_first_name + " " + clid_last_name, - "extension": extension - } - } + payload["serviceProviderId"] = service_provider_id + payload["groupId"] = group_id + payload["serviceUserId"] = service_user_id + payload["policy"] = policy + payload["noAnswerNumberOfRings"] = no_answer_number_of_rings + payload["forwardTimeoutSeconds"] = forward_timeout_seconds - return self.requester.post(endpoint, data=data) + payload["agents"] = [{'userId': agent_id} for agent_id in agents] + + if 'serviceInstanceProfile' not in payload: + payload.setdefault('serviceInstanceProfile', {}) + + payload["serviceInstanceProfile"]["callingLineIdFirstName"] = clid_first_name + payload["serviceInstanceProfile"]["callingLineIdLastName"] = clid_last_name + payload["serviceInstanceProfile"]["name"] = f"{clid_first_name} {clid_last_name}" + payload["serviceInstanceProfile"]["extension"] = extension + + return self.requester.post(endpoint, data=payload) #IN CALL SERVICE ACTIVATION #INSTANT GROUP CALL From 60f9d8e2ea2d707f1a0dc6184b61c92488228c2f Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:47:39 +0100 Subject: [PATCH 08/16] Corrections to user_call_processing_policy method Changed "userID" to be "userId" Updated the Return in the docstring --- odins_spear/methods/put.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index c9b9c59..60ceaa3 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -462,12 +462,12 @@ def user_call_processing_policy(self, user_id: str, updates: dict): updates (dict): Updates to apply to the specified user. Returns: - JSON: Call Processing Policies for the specified user. + None: This method does not return any specific value. """ endpoint = '/users/call-processing-policy' - updates["userID"] = user_id + updates["userId"] = user_id return self.requester.put(endpoint, data=updates) From 34a49b9b16dbf2fa1111f97d5cf31bf20318456e Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:49:04 +0100 Subject: [PATCH 09/16] Updated the group_trunk_group method Updated the group_trunk_group method in post.py to have payload, sip_authentication_username and sip_authentication_password as arguments --- odins_spear/methods/post.py | 68 +++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 1dffff0..ad033f7 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -377,8 +377,8 @@ def group_hunt_group(self, service_provider_id: str, group_id: str, service_user #TIME ZONES #TRUNK GROUPS - def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name: str, max_active_calls: int): - + def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name: str, max_active_calls: int, payload: dict={}, + sip_authentication_username: str="", sip_authentication_password: str=""): """ Builds a Trunk Group (TG) in the specified group. Default fields: @@ -399,46 +399,56 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name: "requireAuthentication":"false", "successThresholdCounter":1, "useSystemUserLookupPolicy":"true", - "userLookupPolicy":"Basic", + "userLookupPolicy":"Basic" Args: service_provider_id (str): The service provider ID in which the target group is built. group_id (str): The group ID where the HG should be built. trunk_name (str): The name of the new TG. max_active_calls (str): The maximum active calls to be set on the TG. + payload (dict, optional): Configuration for the TG. + sip_authentication_username (str, optional): The SIP authentication username for the TG. This field is required if "requireAuthentication" is set to "true". + sip_authentication_password (str, optional): The SIP authentication password for the TG. You can generate a password for this using get.sip_password_generator. This field is required if "requireAuthentication" is set to "true". Returns: - JSON: TG profile. + None: This method does not return any specific value. """ endpoint = "/groups/trunk-groups" - data = { - "capacityExceededTrapInitialCalls":0, - "capacityExceededTrapOffsetCalls":0, - "clidSourceForScreenedCallsPolicy":"Profile Name Profile Number", - "continuousOptionsSendingIntervalSeconds":30, - "failureOptionsSendingIntervalSeconds":10, - "failureThresholdCounter":1, - "invitationTimeout":6, - "inviteFailureThresholdCounter":1, - "inviteFailureThresholdWindowSeconds":30, - "pilotUserCallOptimizationPolicy":"Optimize For User Services", - "pilotUserCallingLineAssertedIdentityPolicy":"Unscreened Originating Calls", - "pilotUserCallingLineIdentityForEmergencyCallsPolicy":"No Calls", - "pilotUserCallingLineIdentityForExternalCallsPolicy":"No Calls", - "pilotUserChargeNumberPolicy":"No Calls", - "requireAuthentication":"false", - "successThresholdCounter":1, - "useSystemUserLookupPolicy":"true", - "userLookupPolicy":"Basic", - "name":trunk_name, - "maxActiveCalls":max_active_calls, - "serviceProviderId":service_provider_id, - "groupId":group_id - } + payload["name"] = trunk_name + payload["maxActiveCalls"] = max_active_calls + payload["serviceProviderId"] = service_provider_id + payload["groupId"] = group_id - return self.requester.post(endpoint, data=data) + if payload["requireAuthentication"] == "true": + payload["sipAuthenticationUserName"] = sip_authentication_username + payload["sipAuthenticationPassword"] = sip_authentication_password + + default_payload_values = { + "capacityExceededTrapInitialCalls": 0, + "capacityExceededTrapOffsetCalls": 0, + "clidSourceForScreenedCallsPolicy": "Profile Name Profile Number", + "continuousOptionsSendingIntervalSeconds": 30, + "failureOptionsSendingIntervalSeconds": 10, + "failureThresholdCounter": 1, + "invitationTimeout": 6, + "inviteFailureThresholdCounter": 1, + "inviteFailureThresholdWindowSeconds": 30, + "pilotUserCallOptimizationPolicy": "Optimize For User Services", + "pilotUserCallingLineAssertedIdentityPolicy": "Unscreened Originating Calls", + "pilotUserCallingLineIdentityForEmergencyCallsPolicy": "No Calls", + "pilotUserCallingLineIdentityForExternalCallsPolicy": "No Calls", + "pilotUserChargeNumberPolicy": "No Calls", + "successThresholdCounter": 1, + "useSystemUserLookupPolicy": "true", + "userLookupPolicy": "Basic", + "requireAuthentication": "false" + } + for key, default_value in default_payload_values.items(): + payload.setdefault(key, default_value) + + return self.requester.post(endpoint, data=payload) #TWO STAGE DIALING #USERS From eae4149eea829f7c6dcdb21e1bdd2eefffcc9c7c Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:18:30 +0100 Subject: [PATCH 10/16] Corrected group_trunk_groups_call_capacity and _group_trunk_group Corrected group_trunk_groups_call_capacity and _group_trunk_group methods in put.py. Replaced max_active_calls argument with updates --- odins_spear/methods/put.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 60ceaa3..e9da554 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1048,33 +1048,28 @@ def user_services(self, user_id: str, services: list =None, service_packs: list #TIME ZONES #TRUNK GROUPS - def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: str, max_active_calls: int): - + def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: str, updates: dict): """ - Updates the maximum call capacity for trunk groups in the specified group. + Updates the trunking call capacity in the specified group. Args: service_provider_id (str): Service provider ID where the target group is built group_id (str): Group ID whose trunk group call capacity needs updating - max_active_calls (int): The updated number of max active calls + updates (dict): The updates to be applied to the group's trunking call capacity. Returns: - JSON: updated trunk group call capacity details + None: This method does not return any specific value. """ endpoint = "/groups/trunk-groups/call-capacity" - data = { - "serviceProviderId": service_provider_id, - "groupId": group_id, - "maxActiveCalls": max_active_calls - } + updates["serviceProviderId"] = service_provider_id + updates["groupId"] = group_id - return self.requester.put(endpoint, data=data) - + return self.requester.put(endpoint, data=updates) - def group_trunk_group(self, service_provider_id: str, group_id: str, updates: dict): + def group_trunk_group(self, service_provider_id: str, group_id: str, updates: dict): """ Updates trunk group (TG) information. @@ -1084,18 +1079,17 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, updates: di updates (dict): Updates to be applied to the TG. Returns: - JSON: Updated TG profile. - + None: This method does not return any specific value. """ endpoint = "/groups/trunk-groups" - updates["serviceProviderId"] = [service_provider_id] - updates["groupId"] = [group_id] + updates["serviceProviderId"] = service_provider_id + updates["groupId"] = group_id return self.requester.put(endpoint, data=updates) - + def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls: int, bursting_max_active_calls: int): """ Updates the max active calls and the bursting max active calls for the given service provider. From e2fccc12403112a76e0b83cd78eada1101c12e21 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Fri, 21 Jun 2024 16:23:13 +0100 Subject: [PATCH 11/16] Updated service_prvoiders_trunk_group_call_capacity Added a Return to the doc string of service_prvoiders_trunk_group_call_capacity method in put.py --- odins_spear/methods/put.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index e9da554..9f6c39e 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1099,6 +1099,8 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls (int): The updated number of max active calls bursting_max_active_calls (int): The updated number of bursting max active calls + Returns: + None: This method does not return any specific value. """ endpoint = "/service-providers/trunk-groups/call-capacity" From ac38807943d740c95eca873be275dff94031b6b8 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Mon, 24 Jun 2024 08:53:32 +0100 Subject: [PATCH 12/16] Updated service_providers_trunk_group_call_capacity Updated the method to take a dictionary argument so that it can be used when only one of the fields needs to be updated. --- odins_spear/methods/put.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 9f6c39e..bd74d4b 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1090,14 +1090,13 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, updates: di return self.requester.put(endpoint, data=updates) - def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls: int, bursting_max_active_calls: int): + def service_providers_trunk_group_call_capacity(self, service_provider_id: str, updates: dict): """ Updates the max active calls and the bursting max active calls for the given service provider. Args: service_provider_id (str): Service provider ID for which the max active calls needs to be updated - max_active_calls (int): The updated number of max active calls - bursting_max_active_calls (int): The updated number of bursting max active calls + updates (dict): The updates to be applied to the service provider's trunking call capacity Returns: None: This method does not return any specific value. @@ -1105,13 +1104,9 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str, endpoint = "/service-providers/trunk-groups/call-capacity" - data = { - "serviceProviderId": service_provider_id, - "maxActiveCalls": max_active_calls, - "burstingMaxActiveCalls": bursting_max_active_calls - } + updates["serviceProviderId"] = service_provider_id - return self.requester.put(endpoint, data=data) + return self.requester.put(endpoint, data=updates) #TWO STAGE DIALING #USERS From 4c9f060d606225dc1315688b2e688a9d5017510b Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:02:19 +0100 Subject: [PATCH 13/16] Updated grroup_device Updated the return of the group_device method in post.py --- odins_spear/methods/post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index ad033f7..b982574 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -104,7 +104,7 @@ def group_device(self, service_provider_id: str, group_id: str, device_name: str payload (dict, optional): Device configuration data. Returns: - JSON: details of the newly created device. + None: This method does not return any specific value. """ endpoint = "/groups/devices" From 3a58b033263ba52646c929fd62324f25a601b722 Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:28:39 +0100 Subject: [PATCH 14/16] Corrections Corrected some of the eva-builder methods in put.py and post.py. Updated the Returns to state they they return Dicts --- odins_spear/methods/post.py | 7 +++++-- odins_spear/methods/put.py | 33 ++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index b982574..39251a7 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -104,7 +104,7 @@ def group_device(self, service_provider_id: str, group_id: str, device_name: str payload (dict, optional): Device configuration data. Returns: - None: This method does not return any specific value. + Dict: Returns the device profile. """ endpoint = "/groups/devices" @@ -410,8 +410,11 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name: sip_authentication_username (str, optional): The SIP authentication username for the TG. This field is required if "requireAuthentication" is set to "true". sip_authentication_password (str, optional): The SIP authentication password for the TG. You can generate a password for this using get.sip_password_generator. This field is required if "requireAuthentication" is set to "true". + Note: + Several fields are set to have default values. Please refer to the online documentation. + Returns: - None: This method does not return any specific value. + Dict: Returns the Trunk Group profile. """ endpoint = "/groups/trunk-groups" diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index bd74d4b..4076bcb 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -453,7 +453,6 @@ def user_call_center_agent_sign_out(self, user_id: str): #CALL PROCESSING POLICIES def user_call_processing_policy(self, user_id: str, updates: dict): - """ Update the Call Processing Policies for a specified user. @@ -462,7 +461,7 @@ def user_call_processing_policy(self, user_id: str, updates: dict): updates (dict): Updates to apply to the specified user. Returns: - None: This method does not return any specific value. + Dict: Returns the updated call processing policies. """ endpoint = '/users/call-processing-policy' @@ -1048,23 +1047,39 @@ def user_services(self, user_id: str, services: list =None, service_packs: list #TIME ZONES #TRUNK GROUPS - def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: str, updates: dict): + def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: str, max_active_calls: int=None, + max_available_active_calls: int=None, bursting_max_active_calls: int=None, + number_of_bursting_btlus: int=None): """ Updates the trunking call capacity in the specified group. Args: service_provider_id (str): Service provider ID where the target group is built group_id (str): Group ID whose trunk group call capacity needs updating - updates (dict): The updates to be applied to the group's trunking call capacity. + max_active_calls (int, optional): The max active calls for the group. + max_available_active_calls (int, optional): The max available active calls for the group. + bursting_max_active_calls (int, optional): The bursting max active calls for the group. + number_of_bursting_btlus (int, optional): The number of Business Trunking License Units for bursting. Returns: - None: This method does not return any specific value. + Dict: Returns the updated state of the trunk group call capacity. """ endpoint = "/groups/trunk-groups/call-capacity" + + updates = { + "serviceProviderId": service_provider_id, + "groupId": group_id + } - updates["serviceProviderId"] = service_provider_id - updates["groupId"] = group_id + if max_active_calls: + updates["maxActiveCalls"] = max_active_calls + if max_available_active_calls: + updates["maxAvailableActiveCalls"] = max_available_active_calls + if bursting_max_active_calls: + updates["burstingMaxActiveCalls"] = bursting_max_active_calls + if number_of_bursting_btlus: + updates["numberOfBurstingBTLUs"] = number_of_bursting_btlus return self.requester.put(endpoint, data=updates) @@ -1079,7 +1094,7 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, updates: di updates (dict): Updates to be applied to the TG. Returns: - None: This method does not return any specific value. + Dict: Returns the updated Trunk Group profile. """ endpoint = "/groups/trunk-groups" @@ -1099,7 +1114,7 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str, updates (dict): The updates to be applied to the service provider's trunking call capacity Returns: - None: This method does not return any specific value. + Dict: Returns the updated call capacity for the service provider. """ endpoint = "/service-providers/trunk-groups/call-capacity" From 7963e4d4ef30649ecfff829caf1083301afeb30b Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:30:15 +0100 Subject: [PATCH 15/16] added space --- odins_spear/methods/put.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 4076bcb..b30debd 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -1110,7 +1110,7 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str, Updates the max active calls and the bursting max active calls for the given service provider. Args: - service_provider_id (str): Service provider ID for which the max active calls needs to be updated + service_provider_id (str): Service provider ID for which the max active calls needs to be updated updates (dict): The updates to be applied to the service provider's trunking call capacity Returns: From 4e931c826c0aa4b6e4f95b67b375d4754798c72d Mon Sep 17 00:00:00 2001 From: LivCurtis <133100222+LivCurtis@users.noreply.github.com> Date: Tue, 25 Jun 2024 08:29:35 +0100 Subject: [PATCH 16/16] Updated gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e2513ca..4253641 100644 --- a/.gitignore +++ b/.gitignore @@ -159,6 +159,7 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ sandbox.py +os.log # mac *.DS_Store