diff --git a/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.json b/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.json index a4fc1bf6..82a9a45f 100644 --- a/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.json +++ b/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.json @@ -10,6 +10,7 @@ "record_call", "section_break_kfez", "account_sid", + "subdomain", "column_break_qwfn", "webhook_verify_token", "section_break_iuct", @@ -83,12 +84,19 @@ "fieldtype": "Data", "label": "Webhook Verify Token", "mandatory_depends_on": "enabled" + }, + { + "depends_on": "enabled", + "fieldname": "subdomain", + "fieldtype": "Data", + "label": "Subdomain", + "mandatory_depends_on": "enabled" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-01-19 22:19:20.713970", + "modified": "2025-01-20 15:00:51.096985", "modified_by": "Administrator", "module": "FCRM", "name": "CRM Exotel Settings", diff --git a/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.py b/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.py index c72fc5e9..c21c777f 100644 --- a/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.py +++ b/crm/fcrm/doctype/crm_exotel_settings/crm_exotel_settings.py @@ -14,7 +14,9 @@ class CRMExotelSettings(Document): def verify_credentials(self): if self.enabled: response = requests.get( - "https://api.exotel.com/v1/Accounts/{sid}".format(sid=self.account_sid), + "https://{subdomain}/v1/Accounts/{sid}".format( + subdomain=self.subdomain, sid=self.account_sid + ), auth=(self.api_key, self.get_password("api_token")), ) if response.status_code != 200: diff --git a/crm/integrations/exotel/handler.py b/crm/integrations/exotel/handler.py index 555b903b..45f0e19d 100644 --- a/crm/integrations/exotel/handler.py +++ b/crm/integrations/exotel/handler.py @@ -132,9 +132,10 @@ def make_a_call(to_number, from_number=None, caller_id=None): def get_exotel_endpoint(action=None): settings = get_exotel_settings() - return "https://{api_key}:{api_token}@api.exotel.com/v1/Accounts/{sid}/{action}".format( + return "https://{api_key}:{api_token}@{subdomain}/v1/Accounts/{sid}/{action}".format( api_key=settings.api_key, api_token=settings.get_password("api_token"), + subdomain=settings.subdomain, sid=settings.account_sid, action=action, )