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

chore: Merge develop to main #546

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
12 changes: 5 additions & 7 deletions crm/integrations/exotel/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,22 @@ def make_a_call(to_number, from_number=None, caller_id=None):
return call_details


def get_exotel_endpoint(action=None):
def get_exotel_endpoint(action=None, version="v1"):
settings = get_exotel_settings()
return "https://{api_key}:{api_token}@{subdomain}/v1/Accounts/{sid}/{action}".format(
return "https://{api_key}:{api_token}@{subdomain}/{version}/Accounts/{sid}/{action}".format(
api_key=settings.api_key,
api_token=settings.get_password("api_token"),
subdomain=settings.subdomain,
version=version,
sid=settings.account_sid,
action=action,
)


def get_all_exophones():
endpoint = get_exotel_endpoint("IncomingPhoneNumbers.json")
endpoint = get_exotel_endpoint("IncomingPhoneNumbers", "v2_beta")
response = requests.get(endpoint)
return [
phone.get("IncomingPhoneNumber", {}).get("PhoneNumber")
for phone in response.json().get("IncomingPhoneNumbers", [])
]
return [phone.get("sid") for phone in response.json().get("incoming_phone_numbers", [])]


def get_status_updater_url():
Expand Down
Loading