fix: Create error log if something goes wrong while call log creation (#19055)

* fix: Create error log if something goes wrong while call log creation

- For better debbugging

* fix: Rollback if any error occurs during call log creation
diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py
index 09c399e..167fcb7 100644
--- a/erpnext/erpnext_integrations/exotel_integration.py
+++ b/erpnext/erpnext_integrations/exotel_integration.py
@@ -1,5 +1,6 @@
 import frappe
 import requests
+from frappe import _
 
 # api/method/erpnext.erpnext_integrations.exotel_integration.handle_incoming_call
 # api/method/erpnext.erpnext_integrations.exotel_integration.handle_end_call
@@ -7,19 +8,24 @@
 
 @frappe.whitelist(allow_guest=True)
 def handle_incoming_call(**kwargs):
-	exotel_settings = get_exotel_settings()
-	if not exotel_settings.enabled: return
+	try:
+		exotel_settings = get_exotel_settings()
+		if not exotel_settings.enabled: return
 
-	call_payload = kwargs
-	status = call_payload.get('Status')
-	if status == 'free':
-		return
+		call_payload = kwargs
+		status = call_payload.get('Status')
+		if status == 'free':
+			return
 
-	call_log = get_call_log(call_payload)
-	if not call_log:
-		create_call_log(call_payload)
-	else:
-		update_call_log(call_payload, call_log=call_log)
+		call_log = get_call_log(call_payload)
+		if not call_log:
+			create_call_log(call_payload)
+		else:
+			update_call_log(call_payload, call_log=call_log)
+	except Exception as e:
+		frappe.db.rollback()
+		frappe.log_error(title=_('Error in Exotel incoming call'))
+		frappe.db.commit()
 
 @frappe.whitelist(allow_guest=True)
 def handle_end_call(**kwargs):
@@ -101,4 +107,4 @@
 		api_token=settings.api_token,
 		sid=settings.account_sid,
 		action=action
-	)
\ No newline at end of file
+	)