﻿# QR Code Scanner API

## Introduction

Cloud Softphone functionality can be extended by custom web browser tabs, which can implement various functionality
like access to account admin area, service configuration, credit top-up, access to company intranet etc.

In case some user input is needed, it may be more convenient to ask the user to scan a qr-code rather than having him
re-type the information. Cloud Softphone app exposes simple javascript API to invoke the QR code scanner from within
the embedded browser page and receive the result.

## API

```javascript
function onQrCodeReceived(qrValue)
{
   alert(qrValue);
}

softphone.openQrCodeScanner(onQrCodeReceived)
```

The QR scanner is invoked by calling softphone.openQrCodeScanner. The function takes single argument - callback
which receives the content of scanned QR code.

## Example

A simple example of invoking the QR scanner is shown at <https: dist.acrobits.net qrtest index.html> You can configure
this URL as a custom web tab, or web registration wizard URL and try it in the app. The example code receives the
scanned QR code and tries to interpret it as QR code from Cloud Softphone portal, described in [qr](../provisioning/qr.md#qr). It should be
very easy to adjust it to suit your needs. Use the "view source" in your browser to see the javascript code.