WebRTC embedding scenario
Registering Integration for "client" at each page.
There is an available embedding location available for integration, generated at each Bitrix24 page as an invisible frame. Registration is performed as follows:
'placement.bind', [ 'PLACEMENT' => 'PAGE_BACKGROUND_WORKER', 'HANDLER' => 'http://example.com/placement/?ty=1', 'OPTIONS' => [ 'errorHandlerUrl' => 'http://example.com/logg.php?ty=1', ], 'LANG_ALL' => [ 'en' => [ 'TITLE' => 'test', ] ] ]
Important difference from a standard embedding is the parameter
Options[errorHandlerUrl]. This handler receives the signal to disable the embedding at the specific Bitrix24 account, in case, when the handler, specified in
Handler responds with a significant delay. Because the embedding is generated at each page, it's important to quickly trigger the embedding handler (presently, "slow" is deemed when handler is called 3 times during the period longer than 5 seconds). When disabled, you need to re-register handler in this Bitrix24 account.
You will be working with telephony in the same manner as before. Call registration is performed by the method telephony.externalcall.register. The same method "invokes" the call card, if the WebRTC-client has started to process the call in the abovementioned embedding.
Next, integration can interact with opened call card, managing buttons and clicked buttons events. There are 9 methods to work with call card via placement PAGE_BACKGROUND_WORKER, to get and update card details and 17 events for processing user activity.
Key event is the BackgroundCallCard::initialized. It's thrown when creating a call card, allowing to manage such card. That's why it's recommended to perform all calls from the app inside the handler function of this event.