> For the complete documentation index, see [llms.txt](https://oph3zdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oph3zdev.gitbook.io/docs/free/phone/exports/server.md).

# Server

Server side exports

Every server export takes the player's `source` as its first argument.

### GetCitizenId

```lua
local cid = exports['oph3z-phone']:GetCitizenId(source)
```

The identifier the phone stores data under. This is your framework's citizenid or identifier.

### GetPhoneNumber

```lua
local number = exports['oph3z-phone']:GetPhoneNumber(source)
```

The formatted number, e.g. `555-0142`. Use this when showing a number to a player.

### GetPhoneNumberRaw

```lua
local digits = exports['oph3z-phone']:GetPhoneNumberRaw(source)
```

Digits only, e.g. `5550142`. Use this when comparing or storing numbers — every export that takes a number accepts either form, but raw digits are what the phone matches on internally.

### GetLanguage

```lua
local lang = exports['oph3z-phone']:GetLanguage(source)
```

The player's language code, so you can translate your own notifications to match their phone.

### GetContacts

```lua
local contacts = exports['oph3z-phone']:GetContacts(source)
```

The player's saved contacts:

```lua
{ { id, name, number, notes, img, favorite }, ... }
```

### ResolveContact

```lua
local contact = exports['oph3z-phone']:ResolveContact(source, '555-0142')
```

Looks up one contact by number, formatted or raw. Returns the contact table, or `nil` if that number is not saved.

Handy for showing the player's own name for a caller instead of a bare number.

### GetPhotos

```lua
local photos = exports['oph3z-phone']:GetPhotos(source)
```

The player's gallery:

```lua
{ { id, url, type, thumb, favorite, ts }, ... }
```

`type` is `image` or `video`. Useful for evidence systems, ID photos or anything that needs a picture the player took.

### GetRecents

```lua
local recents = exports['oph3z-phone']:GetRecents(source)
```

Call history, newest first:

```lua
{ { id, number, name, img, direction, missed, ts, video }, ... }
```

`direction` is `in` or `out`. Capped at `Config.MaxRecents`.

### IsAirplaneMode

```lua
local away = exports['oph3z-phone']:IsAirplaneMode(source)
```

`true` if the player has airplane mode on, meaning they cannot be called or messaged.

### GetBlockedNumbers

```lua
local blocked = exports['oph3z-phone']:GetBlockedNumbers(source)
```

The player's block list, keyed by raw digits:

```lua
{ ['5550142'] = { number, name, ts }, ... }
```

### IsBlocked

```lua
local isBlocked = exports['oph3z-phone']:IsBlocked(source, '555-0142')
```

Whether that player has blocked the given number. Accepts formatted or raw.

{% hint style="info" %}
Check this and `IsAirplaneMode` before sending anything from your own script if you want to respect the player's settings. The phone's own message, call and mail exports already respect them.
{% endhint %}

### PushNotification

```lua
exports['oph3z-phone']:PushNotification(source, {
    app   = 'wallet',
    title = 'Paycheck',
    body  = 'You received $500',
    icon  = nil,                -- optional, overrides the app icon
    route = { app = 'wallet' }, -- optional, where tapping it goes
})
```

Sends a notification to that player's phone. Unlike `Toast`, it is saved and stays in their notification list.

Returns `true` if it was pushed. Respects the player's notification settings, so it is silently skipped if they have notifications turned off.

### SendMessage

```lua
exports['oph3z-phone']:SendMessage(source, '555-0142', 'On my way')
```

Sends a message **from** that player to another number. The last argument can be a plain string, or a table for anything richer:

```lua
{ type = 'text', body = 'On my way', meta = nil }
```

Returns the created message table, or `nil` if the number was invalid. The recipient gets it live if they are online, and it is saved to both sides either way.

### PlaceCall

```lua
exports['oph3z-phone']:PlaceCall(source, '555-0142')
```

Starts a call **from** that player. The phone opens on their screen showing the outgoing call, exactly as if they had dialled it.

Returns the call id, or `nil` if the call could not start — invalid number, the player is already in a call, the other side is offline, busy, blocked, or either party is in airplane mode.

### SendMail

```lua
exports['oph3z-phone']:SendMail(source, {
    from        = 'DMV',             -- display name
    fromAddress = 'noreply@dmv.com', -- optional
    subject     = 'Licence renewed',
    body        = 'Your licence is valid for another year.',
    attachments = { { url = '...', type = 'image' } }, -- optional, max 6
})
```

Sends an email **to** that player, shown as a System mail.

Returns the created mail item, or `nil` if it failed. The player gets a Mail notification automatically.
