Mango Office IP Telephony Integration

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Mango Office IP Telephony Integration on Website

Mango Office is a Russian virtual PBX for business. It provides cloud telephony, call recording, analytics, and API for integration with your website and CRM.

What Integration Provides

  • Pop-up with customer data on incoming call (manager sees who is calling)
  • Click-to-call: calling button directly in customer card or order
  • Call history linked to order/customer
  • Routing: different department depending on page or product

Webhook on Call

Mango Office sends POST requests on call events (incoming, answered, completed):

Route::post('/webhooks/mango', function (Request $request) {
    $json = json_decode($request->json, true);
    $event  = $json['event'];
    $call   = $json['call_id'];
    $caller = $json['from']['number'];

    if ($event === 'call_arrived') {
        $customer = Customer::where('phone', normalizePhone($caller))->first();
        // Notify manager via WebSocket
        broadcast(new MangoCallArrived($call, $caller, $customer));
    }

    if ($event === 'call_finished') {
        CallRecord::create([
            'mango_call_id' => $call,
            'duration'      => $json['duration'],
            'recording'     => $json['recording_url'] ?? null,
            'caller'        => $caller
        ]);
    }
});

Click-to-Call via API

$response = Http::withHeaders(['X-Mango-VPbxApiKey' => env('MANGO_API_KEY')])
    ->post('https://app.mango-office.ru/vpbx/commands/callback', [
        'json' => json_encode([
            'command_id' => uniqid(),
            'extension'  => $agentExtension,  // agent's extension number in PBX
            'number'     => $customerPhone,
            'line_number'=> env('MANGO_LINE_NUMBER')
        ]),
        'sign' => hash('sha256', env('MANGO_API_KEY') . json_encode([...]) . env('MANGO_SALT'))
    ]);

Getting Call Recordings

$recordings = Http::withHeaders(['X-Mango-VPbxApiKey' => env('MANGO_API_KEY')])
    ->post('https://app.mango-office.ru/vpbx/stats/calls/recording/post_read', [
        'json' => json_encode([
            'start'  => strtotime('today midnight'),
            'end'    => time(),
            'fields' => ['start_time', 'duration', 'direction', 'from_number', 'to_number', 'recording']
        ])
    ])->json();

Phone Number Normalization

The key issue is phone normalization for customer lookup. Mango sends numbers in different formats, and they may be stored differently in the database. A unified normalization function:

function normalizePhone(string $phone): string {
    $phone = preg_replace('/[^0-9]/', '', $phone);
    if (strlen($phone) === 10) $phone = '7' . $phone;
    if (str_starts_with($phone, '8')) $phone = '7' . substr($phone, 1);
    return '+' . $phone;
}

Integration timeline: 2–4 days for full integration with pop-up, click-to-call and call history.