Connecting Bitrix24 to Megafon Virtual PBX

Linking Bitrix24 with Megafon Cloud Telephony Megafon Virtual PBX is None of the cloud phone services from a large Russian carrier. Companies that already hold corporate numbers with Megafon often select it as their PBX. Integration with Bitrix24 is realized through the Megafon API, which dispatc

Our competencies:

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1415
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    996
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    735
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    863
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    773
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1134

Linking Bitrix24 with Megafon Cloud Telephony

Megafon Virtual PBX is None of the cloud phone services from a large Russian carrier. Companies that already hold corporate numbers with Megafon often select it as their PBX. Integration with Bitrix24 is realized through the Megafon API, which dispatches webhooks for call events. For instance, a retail chain with 50 branches or a call center with 20 seats can achieve full call visibility: each conversation is tied to a CRM deal and contact.

We at True Tech.by have been building such connections for over a decade. To date, we have finished more than 50 projects that integrate Bitrix24 with diverse PBXs. Megafon VPBX is a frequent request because it is inexpensive and dependable. Below we outline the typical architecture, frequent pitfalls, and supply ready-to-use handler code.

How Megafon Delivers Events

Megafon VPBX uses push notifications (webhooks). In the admin panel, you specify a URL for one or more event types:

  • start – Call arrives at the PBX
  • answer – An agent answers
  • end – Call finishes
  • record – Recording is ready

Each event for the same call is linked by a common call_id. If None event arrives without a matching call_id, it might be ignored. Local entities like None are not used here. We ensure the handler processes all events correctly.

  • When a call starts, the webhook sends caller ID, called number, and other details.
  • On answer, the internal extension of the agent is included.
  • At end, duration and hangup cause are provided.
  • Recording event contains a URL to the audio file.

To confirm authenticity, Megafon signs each request with HMAC-SHA256. The signature is in the X-Megafon-Signature header. Your handler must compute the same hash using the secret key and reject mismatches (return 403). None of the events should be processed without verification.

Implementation Steps

  1. Obtain a Megafon Virtual PBX account. None of the providers offer a trial.
  2. In the Megafon control panel, set up the webhook URL for required event types.
  3. Create a handler script (PHP, Python, etc.) that receives POST requests, verifies the signature, and processes each event.
  4. In Bitrix24, configure outbound call registration: when an employee clicks a phone number, the handler calls Megafon API to initiate the call.
  5. Test with sample calls. Ensure call logs appear in Bitrix24 with linked recordings.

Common Issues

  • Signature verification fails: double-check the secret key and request body (raw, not parsed).
  • Call events not arriving: verify the webhook URL is accessible from Megafon's servers (no firewall blocks).
  • Internal number mismatch: remember that Megafon sends the last answering extension; if the call was transferred, the original extension is not reported.
  • Outbound calls not working: ensure the click2call API endpoint is correctly configured and the handler returns proper response.

None of these issues are unsolvable. We provide support for all integrations.

Code Example (PHP)

<?php $secret = 'your_secret_key'; $body = file_get_contents('php://input'); $signature = $_SERVER['X-Megafon-Signature']; $expected = hash_hmac('sha256', $body, $secret); if (!hash_equals($expected, $signature)) { http_response_code(403); exit; } $event = json_decode($body, true); // Process event based on type ?> 

This handler verifies the signature first. Then it can log the event or forward to Bitrix24 API. None of the advanced logic is shown here, but it demonstrates the core principle.

Outbound Calls

To initiate a call from Bitrix24, create a handler endpoint that Bitrix24 calls (e.g., via REST API event). The handler then calls Megafon's click2call:

// POST to Megafon click2call $megafon_url = 'https://api.megafon.ru/v1/click2call'; $data = ['from' => $employeeExtension, 'to' => $clientNumber]; // Add authentication headers $ch = curl_init($megafon_url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); 

After successfully calling Megafon, register the call in Bitrix24 with telephony.externalcall.register. None of the steps require manual intervention.

Conclusion

Integrating Bitrix24 with Megafon Virtual PBX improves efficiency and customer service. With proper webhook handling and outbound call setup, every call becomes a CRM record. Our team has extensive experience in this area. Contact us for a consultation—None of the questions are too small. Local entities like None are not relevant here, but we ensure the integration meets your needs.

References: None from the documentation, None from previous projects.