secubox-openwrt/package/secubox/luci-app-voip/htdocs/luci-static/resources/voip/api.js
CyberMind-FR e416fa14a6 feat(jabber): Add VoIP integration to LuCI dashboard
Add Jingle VoIP, SMS Relay, and Voicemail Notifications sections to
the Jabber overview.js. Expose 9 new RPC methods in api.js for VoIP
control. Also includes remaining VoIP package updates (dialer view,
asterisk-config.sh) from previous session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-19 14:37:17 +01:00

131 lines
3.0 KiB
JavaScript

'use strict';
'require rpc';
var callStatus = rpc.declare({
object: 'luci.voip',
method: 'status',
expect: {}
});
var callExtensions = rpc.declare({
object: 'luci.voip',
method: 'extensions',
expect: { extensions: [] }
});
var callCalls = rpc.declare({
object: 'luci.voip',
method: 'calls',
expect: { calls: [] }
});
var callVoicemails = rpc.declare({
object: 'luci.voip',
method: 'voicemails',
expect: { voicemails: [] }
});
var callTrunkStatus = rpc.declare({
object: 'luci.voip',
method: 'trunk_status',
expect: {}
});
var callInstall = rpc.declare({
object: 'luci.voip',
method: 'install',
expect: {}
});
var callStart = rpc.declare({
object: 'luci.voip',
method: 'start',
expect: {}
});
var callStop = rpc.declare({
object: 'luci.voip',
method: 'stop',
expect: {}
});
var callRestart = rpc.declare({
object: 'luci.voip',
method: 'restart',
expect: {}
});
var callReload = rpc.declare({
object: 'luci.voip',
method: 'reload',
expect: {}
});
var callExtAdd = rpc.declare({
object: 'luci.voip',
method: 'ext_add',
params: ['number', 'name', 'password'],
expect: {}
});
var callExtDel = rpc.declare({
object: 'luci.voip',
method: 'ext_del',
params: ['number'],
expect: {}
});
var callExtPasswd = rpc.declare({
object: 'luci.voip',
method: 'ext_passwd',
params: ['number', 'password'],
expect: {}
});
var callOriginate = rpc.declare({
object: 'luci.voip',
method: 'call_originate',
params: ['from_ext', 'to_number'],
expect: {}
});
var callHangup = rpc.declare({
object: 'luci.voip',
method: 'call_hangup',
params: ['channel'],
expect: {}
});
var callTrunkTest = rpc.declare({
object: 'luci.voip',
method: 'trunk_test',
expect: {}
});
var callVmDelete = rpc.declare({
object: 'luci.voip',
method: 'vm_delete',
params: ['extension', 'msg_id'],
expect: {}
});
return L.Class.extend({
getStatus: function() { return callStatus(); },
getExtensions: function() { return callExtensions(); },
getCalls: function() { return callCalls(); },
getVoicemails: function() { return callVoicemails(); },
getTrunkStatus: function() { return callTrunkStatus(); },
install: function() { return callInstall(); },
start: function() { return callStart(); },
stop: function() { return callStop(); },
restart: function() { return callRestart(); },
reload: function() { return callReload(); },
addExtension: function(num, name, pwd) { return callExtAdd(num, name, pwd); },
delExtension: function(num) { return callExtDel(num); },
setExtPassword: function(num, pwd) { return callExtPasswd(num, pwd); },
originateCall: function(from, to) { return callOriginate(from, to); },
hangupCall: function(ch) { return callHangup(ch); },
testTrunk: function() { return callTrunkTest(); },
deleteVoicemail: function(ext, id) { return callVmDelete(ext, id); }
});