# Configuring webRTC client SIMPL5

## PBX Configuration <a href="#nastrojka_ats" id="nastrojka_ats"></a>

To ensure the proper functioning of WebRTC in most browsers, a trusted SSL certificate is required. We recommend using the additional module [Let's Encrypt Module](https://docs.mikopbx.com/mikopbx/english/modules/miko/module-get-ssl-lets-encrypt). For the module to work, the PBX must be accessible via a public IP address.

1. Create a new employee [**account**](https://docs.mikopbx.com/mikopbx/english/manual/telephony/extensions).
2. **Option 1.** For each internal number, set it to work only over the RTC protocol. In the "**Advanced Settings**" section - "**Extra options**", add the following options:

```
[endpoint]
webrtc=yes
```

Click "**Save**". From this moment, this internal number will work *only* using the WebRTC protocol.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F3qbMZG3DKXKr35ViJOED%2FadditionalParameterExtension.png?alt=media&#x26;token=f2d8aa14-96ff-4167-9ccc-a66018f460b5" alt=""><figcaption><p>Extra options in employee settings</p></figcaption></figure>

\
**Option 2.** Set up all internal numbers to work *both via PJSIP and WebRTC protocols.*\
To do this, go to **System → General Settings → SIP** and enable the "**Use WebRTC**" toggle switch.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FeSLtbWxJ5K6r552MAXI8%2FrtcBtn.png?alt=media&#x26;token=86bcfa71-6634-439c-9758-2e873e946b8f" alt=""><figcaption><p>Switch "Use WebRTC"</p></figcaption></figure>

3. In MikoPBX, go to **Network & Firewall** → **Firewall**, and add the subnet 0.0.0.0 with a mask of 0.0.0.0. Enable access via AJAM.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FIFOG3Le1QsMl6y5jdWgR%2FajamSwitch.png?alt=media&#x26;token=ea865f3d-2da3-4450-9bbe-0b65e2120cb0" alt=""><figcaption><p>Address, mask, AJAM switch in firewall settings</p></figcaption></figure>

4. Go to **System** → **General Settings** → **AMI & AJAM**. Ensure the "**AJAM Port with Encryption**" is set to **8089.**

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FpjTNOUyfwk1eFird8jeh%2FajamPort.png?alt=media&#x26;token=32b929cf-c6bd-4d5b-b6c9-52ef922bdeaa" alt=""><figcaption><p>Encrypted AJAM port</p></figcaption></figure>

5. In the [**General Settings**](https://docs.mikopbx.com/mikopbx/english/manual/system/general-settings) section, specify the STUN server address. For example, **stun.sipnet.ru**.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fv68udCdoTTsLLFDj5wpN%2FstunServer.png?alt=media&#x26;token=09dec4c5-a71e-4fb6-ad6f-a8b62ab14254" alt=""><figcaption><p>Stun server</p></figcaption></figure>

6. Open the link in your browser: [**https://PBX\_ADDRESS:8089/asterisk/ws**](https://xn--_-7sbbof9dici:8089/asterisk/ws). Use Chrome, as other browsers may have issues. If the certificate is self-signed, you might see a warning "**Connection is not secure**", ignore it and click "**Proceed to the website**."

You should see the following message:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FPpDT2V5UIIZohe2z9TgN%2Faddress.png?alt=media&#x26;token=ffb65051-7fc2-4e94-926d-f6a352248def" alt=""><figcaption></figcaption></figure>

If Asterisk responds, the setup was successful.

## WebRTC Client Setup <a href="#nastrojka_web_rtc_klienta" id="nastrojka_web_rtc_klienta"></a>

1. Go to the website [https://sipml5.org](https://sipml5.org/). You will be redirected to <https://www.doubango.org/sipml5/>. Follow the link "[Enjoy our live demo](https://www.doubango.org/sipml5/call.htm?svn=252)".
2. Set up the WebRTC client:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FsPrWx6ggPNxo7iivgFZJ%2Fimage.png?alt=media&#x26;token=a371652b-a6b3-4874-a4f2-de73e0012c4f" alt=""><figcaption></figcaption></figure>

In the "**Public Identity**" field, enter the following template:

```
sip:INTERNAL_NUMBER@PBX_ADDRESS
```

**When you enable** the [Use WebRTC](https://docs.mikopbx.com/mikopbx/english/manual/system/general-settings#sip) option

```
sip:INTERNAL_NUMBER-WS@PBX_ADDRESS
```

Click on the "**Expert mode?**" button and proceed with the additional configuration:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FT0OlbxK1zY9iSXo4eL1w%2Fimage.png?alt=media&#x26;token=ee92ca44-6c04-4db6-bc65-69ea15e453c8" alt=""><figcaption></figcaption></figure>

In the **"WebSocket Server URL"** field, enter the following format:

<pre><code><strong>wss://PBX_ADDRESS:8089/asterisk/ws
</strong></code></pre>

Click **Login**. You can now start making calls.
