From dd3d296fb7cbc0476d73f92537dafcf45a7d4857 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Tue, 12 May 2026 00:10:23 -0400 Subject: [PATCH] v2.1: wire hooks for desk integration: hooks.py --- voxtelesys_integration/hooks.py | 78 ++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/voxtelesys_integration/hooks.py b/voxtelesys_integration/hooks.py index a16ff29..5cb75ee 100644 --- a/voxtelesys_integration/hooks.py +++ b/voxtelesys_integration/hooks.py @@ -1,6 +1,82 @@ +""" +Frappe app hooks for voxtelesys_integration. + +This file is what Frappe reads on `bench install-app` / `bench migrate` to wire +the app into the framework. Until v2.1 most of the runtime registrations were +missing here, which meant the click-to-call popup, agent routing, and call +log syncing never actually ran in the desk UI — even though the code existed. +""" + app_name = "voxtelesys_integration" app_title = "Voxtelesys Integration" app_publisher = "Broadcast Management Group" -app_description = "3CX inbound call webhook that auto-creates Frappe Helpdesk tickets" +app_description = ( + "Voxtelesys Voice + SMS integration for ERPNext / Frappe Helpdesk. " + "Supports direct Voxtelesys API (outbound click-to-call, inbound VoXML, " + "SMS, agent routing, call recording) and a legacy 3CX webhook path." +) app_email = "it@broadcastmgmt.com" app_license = "MIT" +app_version = "2.1.0" + +# ----------------------------------------------------------------------------- +# Desk assets +# ----------------------------------------------------------------------------- +# These bundle the call popup + click-to-call hook into the standard desk JS. +# Without them, frappe.phone_call.handler is never overridden and the realtime +# incoming-call popup never subscribes. +app_include_js = [ + "/assets/voxtelesys_integration/js/voxtelesys_call_popup.js", +] +app_include_css = [ + "/assets/voxtelesys_integration/css/voxtelesys_call_popup.css", +] + +# ----------------------------------------------------------------------------- +# Per-doctype form JS — click-to-call button, SMS button, call/SMS history +# ----------------------------------------------------------------------------- +doctype_js = { + "HD Ticket": "public/js/hd_ticket.js", + "Contact": "public/js/contact.js", + "Lead": "public/js/lead.js", +} + +# ----------------------------------------------------------------------------- +# Boot session — exposes Voxtelesys config to the browser so the popup JS +# knows whether the integration is enabled and what caller-id to use. +# ----------------------------------------------------------------------------- +boot_session = "voxtelesys_integration.api.voxtelesys.boot_session" + +# ----------------------------------------------------------------------------- +# Scheduled jobs +# ----------------------------------------------------------------------------- +scheduler_events = { + "cron": { + # Reconcile any Call Log rows stuck in Ringing/In Progress because a + # status webhook was missed. Runs every 5 minutes. + "*/5 * * * *": [ + "voxtelesys_integration.api.voxtelesys.sync_pending_call_logs", + ], + }, +} + +# ----------------------------------------------------------------------------- +# Fixtures — installed custom fields go in fixtures/custom_field.json so they +# survive `bench migrate` and can be exported back out. +# ----------------------------------------------------------------------------- +fixtures = [ + { + "doctype": "Custom Field", + "filters": [ + [ + "name", + "in", + [ + "User-custom_voxtelesys_number", + "HD Ticket-custom_voxtelesys_call_sid", + "HD Ticket-custom_3cx_call_id", + ], + ] + ], + }, +]