1. Business Requirement
The objective was to improve the visibility and management of phone calls within Odoo by connecting Odoo with the client's FreePBX system.
- Connect Odoo with the FreePBX server using its available APIs.
- Retrieve and associate call recording links with Odoo call records.
- Support both inbound and outbound call workflows.
- Automatically create Odoo activities based on call status.
- Support answered, missed, unanswered, busy and related call scenarios.
- Provide configurable activity statuses for different call outcomes.
- Use webhooks to receive call events from FreePBX.
2. Solution Implemented
A dedicated FreePBX connector module was developed in Odoo. The main implementation included the following:
- Created a FreePBX connector module with configuration options for the required credentials.
- Implemented access-token generation and authentication with the FreePBX server.
- Connected Odoo with FreePBX APIs and tested API requests using Postman.
- Implemented retrieval of call recording information and recording links.
- Displayed call recording links in the Odoo VoIP call views and related activities.
- Added functionality to create activities automatically based on call status.
- Created planned-to-do activities for missed calls and completed activities for answered calls.
- Included the call recording link as a note in the relevant activity.
- Implemented inbound and outbound webhook controllers for receiving call events.
- Added webhook configuration functionality to create, update and remove configured webhooks.
- Added webhook configuration status and tested inbound, outbound, answered and missed-call webhook scenarios.
- Added configurable activity status selection for answered and missed inbound and outbound calls.
3. Call Recording Integration
The integration included functionality to retrieve FreePBX call recordings and connect them with Odoo call history. Because Odoo and FreePBX did not always provide a single direct identifier for matching records, the implementation used available call information such as timestamp and source/destination numbers to synchronize the records.
4. Webhook-Based Call Processing
The workflow was enhanced to process call events through FreePBX webhooks. Webhook configuration and controllers were implemented for inbound and outbound calls, allowing Odoo to receive call-status information and create the appropriate activities.
- Inbound answered calls.
- Inbound missed calls.
- Outbound answered calls.
- Outbound missed or unanswered calls.
- Outbound busy calls.
5. Key Challenges and Resolution
- Call recording synchronization: Matching FreePBX recordings with Odoo VoIP call records was challenging when multiple records existed. The implementation used available timestamps and source/destination numbers to identify corresponding records.
- Webhook configuration: Webhook configuration required investigation of the FreePBX API and documentation. The configuration workflow was implemented and tested through API requests and the Odoo connector.
- Inbound webhook response: Some inbound calls did not initially return the expected webhook response. The case was tested with the client and the inbound webhook configuration and routing were reviewed.
- Call disposition mismatch: The inbound webhook response did not always match the disposition stored in FreePBX. The call details were retrieved using the call UUID so that Odoo could obtain the correct disposition.
- Duplicate activity creation: A case where multiple activities were created for a missed VoIP call was identified and fixed, resulting in automated activity creation based on the intended call status.
- Testing environment and connectivity: WebSocket, login, API and extension-connectivity issues were encountered during testing and were investigated with the client before continuing the integration work.
6. Testing and Validation
The integration was tested progressively during development. API requests were tested using Postman, FreePBX extensions were used for inbound and outbound call testing and different webhook scenarios were verified. The completed application workflow was also tested in a fresh database and pushed to Odoo.sh for workflow validation.
7. Main Odoo Workflow
- Configure FreePBX credentials and integration settings in Odoo.
- Connect Odoo to the FreePBX server and obtain the required access token.
- Configure the required FreePBX webhooks.
- Receive inbound or outbound call events through the webhook controllers.
- Process the call status and identify the related Odoo user/contact.
- Create the configured Odoo activity based on the call outcome.
- Retrieve and associate the relevant call recording link.
- Display the recording information in Odoo for the related call/activity.
8. Outcome
The FreePBX integration provided a structured connection between the client's telephony system and Odoo. The solution supports call-event processing, call recording links, inbound and outbound workflows, automated activity creation and configurable webhook management within Odoo.
9. Conclusion
The project successfully established a FreePBX integration within Odoo, bringing call events, recordings and activity management into the Odoo workflow. The implementation was tested across multiple call and webhook scenarios, documented, demonstrated and validated through the project workflow.