Register an External Call in Bitrix24 telephony.externalCall.register

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: telephony

Who can execute the method: any user

The method telephony.externalCall.register registers an external call in Bitrix24.

To create a CRM activity for the call, you must also call the method telephony.externalCall.finish.

The method works only in the context of an application.

Method Parameters

Required parameters are marked with *

Name
type

Description

USER_ID*
integer

The identifier of the user for whom the call is registered.

The identifier can be obtained using the user.get method.

USER_PHONE_INNER*
string

The internal number of the user.

The internal number can be obtained using the user.get method.

At least one of the parameters must be specified: USER_ID or USER_PHONE_INNER.

PHONE_NUMBER*
string

The client's phone number.

TYPE*
integer

The type of call.

Possible values:

  • 1 — outgoing
  • 2 — incoming
  • 3 — incoming with redirection
  • 4 — callback
  • 5 — informational call.

CALL_START_DATE
string

The date and time the call started in ISO-8601 format with timezone indication, for example, 2026-03-07T10:20:30+03:00.

By default — the current time on the server.

CRM_CREATE
integer

Automatic creation of a CRM object if no suitable object is found by the number.

Possible values:

  • 0 — do not create
  • 1 — create

By default — 0.

For outgoing calls through an external line, the final behavior also depends on the value of the CRM_AUTO_CREATE parameter set for the line in the methods telephony.externalLine.add and telephony.externalLine.update.

CRM_SOURCE
string

The identifier of the CRM source (the value of the STATUS_ID field).

The list of values can be obtained using the crm.status.list method with the filter ENTITY_ID: 'SOURCE'.

CRM_ENTITY_TYPE
string

The type of CRM object to associate with the call.

Possible values:

  • CONTACT — contact
  • COMPANY — company
  • LEAD — lead.

CRM_ENTITY_ID
integer

The identifier of the CRM object from CRM_ENTITY_TYPE.

The identifier can be obtained using the following methods:

SHOW
integer

Show the call detail form after registration.

Possible values:

  • 0 — do not show
  • 1 — show

By default — 1.

ADD_TO_CHAT
integer

Add a message about the call to the employee's chat.

Possible values:

  • 0 — do not add
  • 1 — add

By default — 1.

CALL_LIST_ID
integer

The identifier of the call list to which the call is linked.

If the call is initiated from a call list, pass the identifier obtained in the ONEXTERNALCALLSTART event.

The list of available call lists can be obtained using the crm.calllist.list method.

LINE_NUMBER
string

The number of the external line.

The line number can be obtained using the telephony.externalLine.get method.

This parameter is not mandatory, but it is recommended to always pass it, especially for incoming calls, to ensure proper line binding and reporting/analytics of telephony.

EXTERNAL_CALL_ID
string

The external identifier of the call on the side of the PBX/integration.

It is recommended to pass a unique value for each physical call to avoid returning an existing CALL_ID when re-registering within 30 minutes.

Features of Re-registration

If the method telephony.externalCall.register is called again within 30 minutes, Bitrix24 may return an existing CALL_ID instead of creating a new registration.

To find an existing registration, the following technical call parameters are used:

  • PHONE_NUMBER
  • TYPE
  • USER_ID or USER_PHONE_INNER
  • LINE_NUMBER (if provided)
  • EXTERNAL_CALL_ID (if provided)

The search is performed within the application and only among registrations made in the last 30 minutes.

The CRM fields and start time are not used as deduplication keys:

  • CRM_ENTITY_TYPE
  • CRM_ENTITY_ID
  • CALL_START_DATE

To ensure that each physical call is registered as separate, pass a unique EXTERNAL_CALL_ID for each call on the side of the PBX/integration.

In click-to-call scenarios, where the call is created by Bitrix24 itself, the internal registration call is performed without EXTERNAL_CALL_ID. Therefore, in the statistics for such calls, the EXTERNAL_CALL_ID field is usually empty.

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"USER_ID":1269,"PHONE_NUMBER":"79062195047","TYPE":2,"CRM_ENTITY_TYPE":"CONTACT","CRM_ENTITY_ID":797,"SHOW":1,"LINE_NUMBER":"3","EXTERNAL_CALL_ID":"asterisk-1710140185.18441","auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/telephony.externalCall.register
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of the payload returned in result (match the "response handling" section of the page)
        type ExternalCallRegisterResult = {
          CALL_ID: string
          CRM_CREATED_LEAD: number | null
          CRM_CREATED_ENTITIES: { ENTITY_TYPE: string; ENTITY_ID: number }[]
          CRM_ENTITY_TYPE: string
          CRM_ENTITY_ID: number
          LEAD_CREATION_ERROR?: string
        }
        
        try {
          const response = await $b24.actions.v2.call.make<ExternalCallRegisterResult>({
            method: 'telephony.externalCall.register',
            params: {
              USER_ID: 1269,
              PHONE_NUMBER: '79062195047',
              TYPE: 2,
              CRM_ENTITY_TYPE: 'CONTACT',
              CRM_ENTITY_ID: 797,
              SHOW: 1,
              LINE_NUMBER: '3',
              EXTERNAL_CALL_ID: 'asterisk-1710140185.18441',
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info(result.CALL_ID, result.CRM_ENTITY_TYPE, result.CRM_ENTITY_ID)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function registerExternalCall() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              const response = await $b24.actions.v2.call.make({
                method: 'telephony.externalCall.register',
                params: {
                  USER_ID: 1269,
                  PHONE_NUMBER: '79062195047',
                  TYPE: 2,
                  CRM_ENTITY_TYPE: 'CONTACT',
                  CRM_ENTITY_ID: 797,
                  SHOW: 1,
                  LINE_NUMBER: '3',
                  EXTERNAL_CALL_ID: 'asterisk-1710140185.18441',
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info(result.CALL_ID, result.CRM_ENTITY_TYPE, result.CRM_ENTITY_ID)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', registerExternalCall)
        </script>
        
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.telephony.external_call.register(
                user_id=1269,
                phone_number="79062195047",
                call_type=2,
                crm_entity_type="CONTACT",
                crm_entity_id=797,
                show=1,
                line_number="3",
                external_call_id="asterisk-1710140185.18441",
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'telephony.externalCall.register',
                    [
                        'USER_ID' => 1269,
                        'PHONE_NUMBER' => '79062195047',
                        'TYPE' => 2,
                        'CRM_ENTITY_TYPE' => 'CONTACT',
                        'CRM_ENTITY_ID' => 797,
                        'SHOW' => 1,
                        'LINE_NUMBER' => '3',
                        'EXTERNAL_CALL_ID' => 'asterisk-1710140185.18441'
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error registering call: ' . $e->getMessage();
        }
        
BX24.callMethod(
            "telephony.externalCall.register",
            {
                USER_ID: 1269,
                PHONE_NUMBER: '79062195047',
                TYPE: 2,
                CRM_ENTITY_TYPE: 'CONTACT',
                CRM_ENTITY_ID: 797,
                SHOW: 1,
                LINE_NUMBER: '3',
                EXTERNAL_CALL_ID: 'asterisk-1710140185.18441'
            },
            function(result)
            {
                if (result.error())
                {
                    console.error(result.error(), result.error_description());
                }
                else
                {
                    console.log(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'telephony.externalCall.register',
            [
                'USER_ID' => 1269,
                'PHONE_NUMBER' => '79062195047',
                'TYPE' => 2,
                'CRM_ENTITY_TYPE' => 'CONTACT',
                'CRM_ENTITY_ID' => 797,
                'SHOW' => 1,
                'LINE_NUMBER' => '3',
                'EXTERNAL_CALL_ID' => 'asterisk-1710140185.18441'
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "telephony.externalCall.register", b24.Params{
        	"USER_ID":          1269,
        	"PHONE_NUMBER":     "79062195047",
        	"TYPE":             2,
        	"CRM_ENTITY_TYPE":  "CONTACT",
        	"CRM_ENTITY_ID":    797,
        	"SHOW":             1,
        	"LINE_NUMBER":      "3",
        	"EXTERNAL_CALL_ID": "asterisk-1710140185.18441",
        })
        if err != nil {
        	return fmt.Errorf("telephony.externalCall.register: %w", err)
        }
        
        var item struct {
        	CallID        string `json:"CALL_ID"`
        	CRMEntityType string `json:"CRM_ENTITY_TYPE"`
        	CRMEntityID   b24.ID `json:"CRM_ENTITY_ID"`
        }
        if err := json.Unmarshal(res.Result, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.CallID, item.CRMEntityType)
        

Response Handling

HTTP Status: 200

{
            "result": {
                "CALL_ID": "externalCall.716f1cb73def9700a23842adf9c4c568.1773130779",
                "CRM_CREATED_LEAD": null,
                "CRM_CREATED_ENTITIES": [],
                "CRM_ENTITY_TYPE": "CONTACT",
                "CRM_ENTITY_ID": 797
            },
            "time": {
                "start": 1773130778,
                "finish": 1773130779.120838,
                "duration": 1.120837926864624,
                "processing": 1,
                "date_start": "2026-03-10T11:19:38+03:00",
                "date_finish": "2026-03-10T11:19:39+03:00",
                "operating_reset_at": 1773131378,
                "operating": 0.22185301780700684
            }
        }
        

Returned Data

Name
type

Description

result
object

The root element of the response.

CALL_ID
string

The identifier of the call.

CRM_CREATED_LEAD
integer

The identifier of the automatically created lead.

CRM_CREATED_ENTITIES
array

An array of automatically created CRM entities.

CRM_ENTITY_TYPE
string

The type of the main CRM object of the call.

CRM_ENTITY_ID
integer

The identifier of the main CRM object of the call.

LEAD_CREATION_ERROR
string

The error message during lead auto-creation (if any).

time
time

Information about the request execution time.

CRM_CREATED_ENTITIES Object

Name
type

Description

ENTITY_TYPE
string

The type of the created CRM object.

ENTITY_ID
integer

The identifier of the created CRM object.

Error Handling

HTTP Status: 400, 403

{
            "error": "ERROR_CORE",
            "error_description": "Unknown TYPE"
        }
        

Name
type

Description

error
string

String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only error_description shows the reason

error_description
string

Error message for the developer. Do not show it to the end user without processing

Possible Error Codes

Code

Description

Value

WRONG_AUTH_TYPE

Current authorization type is denied for this method.

Method called outside the application context.

ERROR_CORE

USER_ID or USER_PHONE_INNER should be set.

USER_ID and USER_PHONE_INNER not provided.

ERROR_CORE

Unknown TYPE.

Invalid value for TYPE provided.

ERROR_CORE

CALL_START_DATE should be in the ISO-8601 format.

Incorrect format for CALL_START_DATE.

ERROR_CORE

Unsupported phone number format.

Incorrect format for PHONE_NUMBER.

ERROR_CORE

User is not found or is not active.

User not found or inactive.

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning