Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated group_trunk_groups_call_capacity #64

Merged
merged 3 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 4 additions & 23 deletions odins_spear/methods/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,6 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name:
sip_authentication_username: str="", sip_authentication_password: str=""):
"""
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.
Expand All @@ -424,10 +405,6 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name:
payload["serviceProviderId"] = service_provider_id
payload["groupId"] = group_id

if payload["requireAuthentication"] == "true":
payload["sipAuthenticationUserName"] = sip_authentication_username
payload["sipAuthenticationPassword"] = sip_authentication_password

default_payload_values = {
"capacityExceededTrapInitialCalls": 0,
"capacityExceededTrapOffsetCalls": 0,
Expand All @@ -451,6 +428,10 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name:
for key, default_value in default_payload_values.items():
payload.setdefault(key, default_value)

if payload["requireAuthentication"] == "true":
payload["sipAuthenticationUserName"] = sip_authentication_username
payload["sipAuthenticationPassword"] = sip_authentication_password

return self.requester.post(endpoint, data=payload)

#TWO STAGE DIALING
Expand Down
11 changes: 5 additions & 6 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,16 +1048,15 @@ def user_services(self, user_id: str, services: list =None, service_packs: list
#TRUNK GROUPS

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):
bursting_max_active_calls: int=None, number_of_bursting_btlus: int=None):
"""
Updates the trunking call capacity in the specified group.
NOTE: The max available active calls cannot be changed here. Please see service_providers_trunk_group_call_capacity to update this.

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, 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.

Expand All @@ -1074,8 +1073,6 @@ def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: s

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:
Expand All @@ -1084,13 +1081,14 @@ def group_trunk_groups_call_capacity(self, service_provider_id: str, group_id: s
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, trunk_group_name: 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
trunk_group_name (str): The name of the trunk group that is being updated.
updates (dict): Updates to be applied to the TG.

Returns:
Expand All @@ -1101,6 +1099,7 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, updates: di

updates["serviceProviderId"] = service_provider_id
updates["groupId"] = group_id
updates["name"] = trunk_group_name

return self.requester.put(endpoint, data=updates)

Expand Down