# Simulation of external calls

A useful tool for configuring MikoPBX is to simulate incoming and outgoing external calls without connecting a real provider, thus saving costs.

## Creating a New SIP Provider on the PBX

1. Go to **"Call Routing"** → **"Telephony Providers"**:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F2FewZi67eDKPfEYvLZYd%2FTelephonyProvidersSectionMikoPBX.jpg?alt=media&#x26;token=5ee9f717-a8ab-4251-87d6-1e6d60762d16" alt=""><figcaption><p>"Telephony providers" section</p></figcaption></figure>

2. Add a new **SIP Provider**:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FxJmzjPLfPrLzpJ8nIA1J%2FconnectSIPProviderButton.jpg?alt=media&#x26;token=b5e92721-a12a-4283-9feb-36f9cd380388" alt=""><figcaption><p>Adding a new SIP provider</p></figcaption></figure>

3. Specify the following parameters for the new provider:

* **Name** – arbitrary
* **Account Type** – "Incoming Registration"
* **DTMF Mode** – "auto"

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fjoa5Mb8k5t3Z1QjAqsve%2FImitationProviderParameters&#x27;.jpg?alt=media&#x26;token=3b23e37a-9184-418f-acf3-0ee8e63f0b90" alt=""><figcaption><p>Imitation Provider parameters</p></figcaption></figure>

4. In the provider creation menu, go to **"Advanced Settings"**:

Disable the **"fromuser"** field.

In **"Additional Options,"** add:

```php
[endpoint]
callerid = 66179878899 <66179878899>
```

{% hint style="success" %}
You can replace **"66179878899"** with any desired number.
{% endhint %}

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FOWDrdgUSBAyNPlNe78GN%2FadvancedParameters.jpg?alt=media&#x26;token=437fa249-bdc3-4c27-be89-93176879807b" alt=""><figcaption><p>Additional Parameters</p></figcaption></figure>

Save your settings and note:

* The provider ID, e.g., **"SIP-TRUNK-704CB9B8"**, which you can find in the address bar or in the provider details.
* The password.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F39DoBQGVA9x6v15sCSXA%2FProviderParameters.jpg?alt=media&#x26;token=3afd5eb7-d76b-4ad2-890d-799858ec84d3" alt=""><figcaption><p>ID and Password of Provider</p></figcaption></figure>

## Connecting a Softphone for Call Simulation

To make calls with a simulated number, you need to connect the provider to a softphone. In this example, we’ll use Zoiper.

1. Enter the following credentials:
   * **Login** – `"ProviderID@MikoPBXIPAddress"`
   * **Password** – The password from the provider’s settings.

{% hint style="info" %}
Replace:

* **ProviderID** with the ID of your provider.
* **MikoPBXIPAddress** with the IP address of your PBX.
  {% endhint %}

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FC7cI93uBPHJJYH1ZnpeZ%2FzoiperParameters.jpg?alt=media&#x26;token=c003ee67-6626-4693-b1c3-e563e16e17c0" alt=""><figcaption><p>Zoiper credetionals</p></figcaption></figure>

2. Complete the authorization process by clicking through “**Next**.” You can verify the successful connection by checking the provider’s status indicator:

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F7AgMV0DybZ5yMrTXV64v%2FconnectionIndicatorMikoPBX.jpg?alt=media&#x26;token=1959027a-c725-4186-a650-7a89901548a9" alt=""><figcaption><p>Connection Indicator</p></figcaption></figure>

## Routing Configuration

For the simulation provider to work properly, you must define both incoming and outgoing routes. Below are examples used in this guide.

### Incoming Routing

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F3CsHASMbYvk1nPuyMSfb%2FincomingCallsRouting.jpg?alt=media&#x26;token=3151490f-a7e9-48fe-b256-d8f6e3769cf4" alt=""><figcaption><p>Incoming Calls routing</p></figcaption></figure>

### Outbound Routing

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FY8wjKurvpdyoIJvNIZkN%2FoutgoingTemplate.jpg?alt=media&#x26;token=47313ba9-4c7a-49dd-9b25-0910ad048e24" alt=""><figcaption><p>Outgoing Template</p></figcaption></figure>

Alternatively, you can manually describe a route for simulating external calls (add this at the end of the **"extensions.conf"** file in **"System file customization"**):

```php
[SIP-TRUNK-0CDC0182-22-outgoing]
exten => _X!,1,NoOp(Outgoing call to ${EXTEN})
same => n,Set(CALLERID(num)=66179878899)
same => n,Dial(PJSIP/${EXTEN}@SIP-TRUNK-0CDC0182)
same => n,Return()
```

In this example, the route applies to calls through the **"SIP-TRUNK-0CDC0182"** provider, and the displayed caller number is **"66179878899"**.

{% hint style="danger" %}
&#x20;In the context above, change **"**&#x53;IP-TRUNK-0CDC018&#x32;**"** to your actual provider ID and 66179878899 to your number.
{% endhint %}
