fix: added subdomain field

This commit is contained in:
Shariq Ansari 2025-01-20 15:03:31 +05:30
parent 7da03d0293
commit 0315220857
3 changed files with 14 additions and 3 deletions

View File

@ -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",

View File

@ -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:

View File

@ -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,
)