Bitrix API

Helper

Table of Contents

Constants

EVENT_START_EXTERNAL_CALL  = 'OnExternalCallStart'
EVENT_START_EXTERNAL_CALLBACK  = 'OnExternalCallBackStart'
FILE_FIELD  = 'file'
PLACEMENT_CALL_CARD  = 'CALL_CARD'

Methods

addExternalLine()  : Result
attachRecord()  : Result
attachRecordWithUrl()  : Result
Downloads and attaches record to the existing call.
deleteExternalLine()  : mixed
deleteFile()  : void
finishExternalCall()  : Result
Finishes call, initiated externally and updates crm lead and activity
getExternalCallbackHandlers()  : mixed
Returns array of applications, capable of starting callback
getExternalCallHandler()  : string|false
Returns id of the rest application, set as external call handler, or false if the external call handler is not set.
getExternalCallHandlers()  : mixed
Returns array of applications, capable of creating externally initiated calls
getExternalLines()  : mixed
getRestAppName()  : string|false
Returns rest application name by its client id.
getUserByPhone()  : int|false
Returns user id of the user with given inner phone number, or false if user is not found.
hideExternalCall()  : bool
Hides card with CRM info on a call.
onRestAppDelete()  : mixed
onRestAppInstall()  : mixed
registerExternalCall()  : Result
Register call, started to perform in external PBX. Auto creates
searchCrmEntities()  : mixed
showExternalCall()  : bool
Shows card with CRM info on a call to the user.
startCall()  : Result
Sends event to start call to the configured rest application
startCallBack()  : void
Send event to start callback to the rest application.
updateExternalLine()  : mixed
uploadRecord()  : Result

Constants

EVENT_START_EXTERNAL_CALL

public mixed EVENT_START_EXTERNAL_CALL = 'OnExternalCallStart'

EVENT_START_EXTERNAL_CALLBACK

public mixed EVENT_START_EXTERNAL_CALLBACK = 'OnExternalCallBackStart'

FILE_FIELD

public mixed FILE_FIELD = 'file'

PLACEMENT_CALL_CARD

public mixed PLACEMENT_CALL_CARD = 'CALL_CARD'

Methods

addExternalLine()

public static addExternalLine(array{NUMBER: string, NAME: string, CRM_AUTO_CREATE: string} $externalLine, mixed $restAppId) : Result
Parameters
$externalLine : array{NUMBER: string, NAME: string, CRM_AUTO_CREATE: string}
$restAppId : mixed
Return values
Result

attachRecord()

public static attachRecord(string $callId, string $fileName, string $fileContent, CRestServer $restServer) : Result
Parameters
$callId : string

Id of the call.

$fileName : string

Name of file containing record.

$fileContent : string

Base64-encoded string with file contents.

$restServer : CRestServer

Rest server.

Tags
throws
LoaderException
Return values
Result

attachRecordWithUrl()

Downloads and attaches record to the existing call.

public static attachRecordWithUrl(string $callId, string $recordUrl[, string $fileName = '' ]) : Result
Parameters
$callId : string

Id of the call.

$recordUrl : string

Url of the record.

$fileName : string = ''

[Optional] Name of the file. If omitted, file name will taken from the url.

Return values
Result

deleteExternalLine()

public static deleteExternalLine(mixed $number, mixed $restAppId) : mixed
Parameters
$number : mixed
$restAppId : mixed

deleteFile()

public static deleteFile(mixed $fileId, mixed $userId) : void
Parameters
$fileId : mixed
$userId : mixed

finishExternalCall()

Finishes call, initiated externally and updates crm lead and activity

public static finishExternalCall(array<string|int, mixed> $fields) : Result
Parameters
$fields : array<string|int, mixed>
  • CALL_ID
  • USER_ID
  • DURATION - call duration in seconds
  • COST - call's cost
  • COST_CURRENCY
  • STATUS_CODE
  • FAILED_REASON
  • RECORD_URL
  • VOTE
  • ADD_TO_CHAT
  • Return values
    Result

    getExternalCallbackHandlers()

    Returns array of applications, capable of starting callback

    public static getExternalCallbackHandlers() : mixed

    getExternalCallHandler()

    Returns id of the rest application, set as external call handler, or false if the external call handler is not set.

    public static getExternalCallHandler(int $userId) : string|false
    Parameters
    $userId : int

    Id of the user.

    Return values
    string|false

    getExternalCallHandlers()

    Returns array of applications, capable of creating externally initiated calls

    public static getExternalCallHandlers() : mixed

    getExternalLines()

    public static getExternalLines(mixed $restAppId) : mixed
    Parameters
    $restAppId : mixed

    getRestAppName()

    Returns rest application name by its client id.

    public static getRestAppName(string $clientId) : string|false
    Parameters
    $clientId : string

    Application's client id.

    Return values
    string|false

    getUserByPhone()

    Returns user id of the user with given inner phone number, or false if user is not found.

    public static getUserByPhone(string $phoneNumber) : int|false
    Parameters
    $phoneNumber : string

    Inner phone number.

    Tags
    throws
    ArgumentException
    Return values
    int|false

    hideExternalCall()

    Hides card with CRM info on a call.

    public static hideExternalCall(array<string|int, mixed> $params) : bool
    Parameters
    $params : array<string|int, mixed>

    Function parameters:

  • CALL_ID
  • USER_ID
  • Return values
    bool

    onRestAppDelete()

    public static onRestAppDelete(mixed $params) : mixed
    Parameters
    $params : mixed

    onRestAppInstall()

    public static onRestAppInstall(mixed $params) : mixed
    Parameters
    $params : mixed

    registerExternalCall()

    Register call, started to perform in external PBX. Auto creates

    public static registerExternalCall(array<string|int, mixed> $fields) : Result
    Parameters
    $fields : array<string|int, mixed>
  • EXTERNAL_CALL_ID string | optional
  • USER_ID int
  • PHONE_NUMBER string
  • LINE_NUMBER string
  • TYPE int
  • CALL_START_DATE date
  • CRM bool
  • CRM_CREATE bool
  • CRM_SOURCE
  • CRM_ENTITY_TYPE
  • CRM_ENTITY_ID
  • CRM_ACTIVITY_ID
  • CRM_BINDINGS
  • REST_APP_ID
  • SHOW
  • CALL_LIST_ID
  • Return values
    Result

    searchCrmEntities()

    public static searchCrmEntities(mixed $phoneNumber) : mixed
    Parameters
    $phoneNumber : mixed

    showExternalCall()

    Shows card with CRM info on a call to the user.

    public static showExternalCall(array<string|int, mixed> $params) : bool
    Parameters
    $params : array<string|int, mixed>

    Function parameters:

  • CALL_ID
  • USER_ID
  • Return values
    bool

    startCall()

    Sends event to start call to the configured rest application

    public static startCall(string $number, int $userId[, mixed $lineId = '' ][, array<string|int, mixed> $parameters = array() ]) : Result
    Parameters
    $number : string

    Phone number to call.

    $userId : int

    User id of the user, initiated the call.

    $lineId : mixed = ''
    $parameters : array<string|int, mixed> = array()

    Additional parameters.

    Return values
    Result

    startCallBack()

    Send event to start callback to the rest application.

    public static startCallBack(array<string|int, mixed> $parameters) : void
    Parameters
    $parameters : array<string|int, mixed>

    Array of parameters.

    updateExternalLine()

    public static updateExternalLine(mixed $number, mixed $updatingFields, mixed $restAppId) : mixed
    Parameters
    $number : mixed
    $updatingFields : mixed
    $restAppId : mixed

    uploadRecord()

    public static uploadRecord(string $callId) : Result
    Parameters
    $callId : string
    Tags
    throws
    SystemException
    Return values
    Result
    
            
    On this page

    Search results