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

Eva builder adjustments #57

Merged
merged 3 commits into from
Jul 2, 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
31 changes: 24 additions & 7 deletions odins_spear/methods/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ def group_hunt_group(self, service_provider_id: str, group_id: str, service_user
payload["noAnswerNumberOfRings"] = no_answer_number_of_rings
payload["forwardTimeoutSeconds"] = forward_timeout_seconds

payload["agents"] = [{'userId': agent_id} for agent_id in agents]

if 'serviceInstanceProfile' not in payload:
payload.setdefault('serviceInstanceProfile', {})

Expand Down Expand Up @@ -456,19 +454,38 @@ def group_trunk_group(self, service_provider_id: str, group_id: str, trunk_name:
#TWO STAGE DIALING
#USERS

def user(self, user):
def user(self, service_provider_id: str, group_id: str, user_id: str, first_name: str, last_name: str,
extension: str, web_auth_password: str, payload: dict):
"""_summary_

Args:
user (_type_): _description_
service_provider_id (str): Service provider ID where Group is loctaed.
group_id (str): Group ID where new user will be built.
user_id (str): Complete User ID including group domain of new user.
first_name (str): First name of new user.
last_name (str): Last name of new user.
extension (str): Extension numebr of new user.
web_auth_password (str): Web authentication password. Note get.password_generate() can be used to get this.
payload (dict): User configuration.

Returns:
_type_: _description_
Dict: New user entity.
"""

endpoint = "users"
endpoint = "/users"

payload["callingLineIdFirstName"] = first_name if not payload["callingLineIdFirstName"] else payload["callingLineIdFirstName"]
payload["callingLineIdLastName"] = last_name if not payload["callingLineIdLastName"] else payload["callingLineIdLastName"]

payload["serviceProviderId"] = service_provider_id
payload["groupId"] = group_id
payload["userId"] = user_id
payload["firstName"] = first_name
payload["lastName"] = last_name
payload["extension"] = extension
payload["password"] = web_auth_password

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

#USER CUSTOM RINGBACK
#VIDEO ADD ON
Expand Down
20 changes: 13 additions & 7 deletions odins_spear/methods/put.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ 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, updates: dict):
def service_providers_trunk_group_call_capacity(self, service_provider_id: str, max_active_calls: int, bursting_max_active_calls: int =None):
"""
Updates the max active calls and the bursting max active calls for the given service provider.

Expand All @@ -1119,10 +1119,16 @@ def service_providers_trunk_group_call_capacity(self, service_provider_id: str,
"""

endpoint = "/service-providers/trunk-groups/call-capacity"

data = {
"maxActiveCalls": max_active_calls,
"serviceProviderId": service_provider_id
}

if bursting_max_active_calls:
data["burstingMaxActiveCalls"] = bursting_max_active_calls

updates["serviceProviderId"] = service_provider_id

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

#TWO STAGE DIALING
#USERS
Expand All @@ -1145,9 +1151,9 @@ def user(self, service_provider_id: str, group_id, user_id: str, updates: dict):

endpoint = "/users"

updates["serviceProviderId"] = [service_provider_id]
updates["groupId"] = [group_id]
updates["userId"] = [user_id]
updates["serviceProviderId"] = service_provider_id
updates["groupId"] = group_id
updates["userId"] = user_id

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

Expand Down