> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-dispatch/configuration/framework-and-bridges.md).

# Framework and Bridges

How the framework and notification bridges resolve, and how to force one.

Mango Dispatch talks to your server through two small bridges. Both are configured in `config/bridge.lua`:

```lua
Config.Bridge = {
    -- Providers: esx, qbcore, qbox, custom
    Framework = 'auto',

    -- Providers: mango_notify, ox_lib, esx, custom
    Notifications = 'auto',
}
```

Each value is one of:

| Value      | Meaning                                                                 |
| ---------- | ----------------------------------------------------------------------- |
| `'auto'`   | Detect. Each provider is asked in order whether its resource is running |
| `'<name>'` | Bind `bridge/<category>/<name>.lua` exactly, no detection               |
| `'none'`   | Turn the bridge off entirely                                            |

### Framework bridge

Detection order is **ESX, Qbox, QBCore**. The bridge provides four things, and nothing else:

| Function               | Used for                                                        |
| ---------------------- | --------------------------------------------------------------- |
| `GetIdentifier(src)`   | The key every responder record is stored against                |
| `GetPlayerName(src)`   | Caller and responder names                                      |
| `GetJob(src)`          | `Config.Recipients.jobs` matching and the `requireOnDuty` check |
| `GetPhone(identifier)` | The caller number on a `/911` call. Optional                    |

That is the entire surface. There is no inventory, money, or item handling anywhere in this resource, which is why an unusual framework is usually a ten-minute job to support - see [Custom Framework Bridge](/mango5m-docs/resources/mango-dispatch/developer-guide/custom-framework-bridge.md).

{% hint style="info" %}
If no framework is detected, identifiers fall back to the player's `license:` identifier and everything still works except job-based recipients. In that case run `Config.Recipients.mode = 'registered'`.
{% endhint %}

#### Phone numbers

| Framework | Where the number comes from                                                                           |
| --------- | ----------------------------------------------------------------------------------------------------- |
| ESX       | The `users` table, via oxmysql, **only if `MySQL` happens to be loaded**. oxmysql is not a dependency |
| QBCore    | `PlayerData.charinfo.phone` for the matching citizenid                                                |
| Qbox      | As QBCore                                                                                             |

A missing number is shown as `Unknown`. Nothing breaks.

### Notifications bridge

Detection order is **`mango_notify`, then `ox_lib`**, with a built-in fallback that always works.

| Provider       | Behaviour                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------- |
| `mango_notify` | Sends through `exports['mango_notify']:Notify` with the title "Dispatch"                          |
| `ox_lib`       | `ox_lib:notify`, top-right, titled "Dispatch"                                                     |
| `builtin`      | The resource's own toast, drawn in its own NUI. Always available, used when nothing else is found |
| `custom`       | Yours - edit `bridge/notifications/custom.lua` and set `Notifications = 'custom'`                 |

Wiring your own is four one-line functions:

```lua
local function notify(message, kind)
    TriggerEvent('my_notify:show', kind, message)
end

function Provider.Success(message) notify(message, 'success') end
function Provider.Error(message)   notify(message, 'error') end
function Provider.Info(message)    notify(message, 'info') end
function Provider.Warning(message) notify(message, 'warning') end
```

Notifications are always drawn on the client, even when the server triggers them - the bridge relays them for you.

### Checking what resolved

At start-up the console prints the active framework:

```
[mango_dispatch] ready - esx
```

For the full picture, run this in the **server console** (it is console-only, not a player command):

```
mango_dispatch_bridges
```

```
[mango_dispatch] Bridges:
[mango_dispatch]   Framework      esx                    (available: custom, esx, qbcore, qbox)
[mango_dispatch]   Notify         mango_notify           (available: builtin, custom, mango_notify, ox_lib)
```

{% hint style="info" %}
Bridges re-resolve automatically whenever any other resource starts or stops, so starting `ox_lib` after this resource does not require a restart to pick it up.
{% endhint %}
