Skip to content

Calls

Calls

Voice call system supporting WebRTC and pma-voice call channels. Handles call initiation, acceptance, rejection, ending, ICE candidate relay, airplane mode, hidden numbers, emergency SOS, and call history persistence.

Database Tables

TablePurpose
phone_callsCall history -- owner, num, incoming, accepts, duration, hidden, time
phone_numbersRead -- resolves phone number, call_ringtone, audio_profile per player

Server Callbacks

CallbackPurpose
gcphone:getCallHistoryReturns the last 100 call records for the player
gcphone:deleteCallHistoryDeletes call records between the player and a specific number
gcphone:clearCallHistoryDeletes all call records for the player
gcphone:startCallInitiates a call to a target number (supports hidden prefix #, emergency, fixed phones)
gcphone:acceptCallAccepts an incoming call, sets pma-voice call channel
gcphone:emergencySOSSends an SOS notification with GPS coords to all emergency contacts

Net Events (Server)

EventPurpose
gcphone:setAirplaneModeToggles airplane mode for the player (blocks calls)
gcphone:rejectCallRejects or cancels a call
gcphone:endCallEnds an active call
gcphone:sendIceCandidateRelays WebRTC ICE candidates between call participants

Config Options

lua
Config.Calls = {
    UseWebRTC          = true,
    MaxCallDuration    = 3600,
    HiddenNumberPrefix = '#',
    RTCConfig          = { iceServers = { { urls = 'stun:stun.l.google.com:19302' } } },
}

Config.Phone.Setup.EmergencyContacts = {
    { label = 'Policia', number = '911' },
    { label = 'EMS',     number = '912' },
}

Config.FixePhone = { ['911'] = { name = '...', coords = vector3(...) } }

Exports

ExportSignaturePurpose
GetActiveCalls() -> table<int, table>Returns the currently active calls map
GetCallHistory(identifier, requestSource) -> table[]Returns call history for a player (access-checked)

Hooks

The module fires the following phone hooks via TriggerPhoneHook:

  • numberDialed -- when a number is dialed
  • callStarted -- when a call begins
  • emergencyCallStarted -- when an emergency call begins

Released under GPL-3.0 License