Passed
Push — develop ( d906b2...768883 )
by Nikolay
05:15 queued 16s
created

sites/admin-cabinet/assets/js/src/PbxAPI/sipAPI.js   A

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 25
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 14
c 0
b 0
f 0
dl 0
loc 25
rs 10
mnd 0
bc 0
fnc 3
bpm 0
cpm 1
noi 1
1
/*
2
 * MikoPBX - free phone system for small business
3
 * Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License along with this program.
16
 * If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
/* global PbxApi, globalTranslate */
20
21
/**
22
 * This module encapsulates a collection of functions related to SIP records
23
 *
24
 * @module SipAPI
25
 */
26
27
const SipAPI= {
0 ignored issues
show
Unused Code introduced by
The constant SipAPI seems to be never used. Consider removing it.
Loading history...
28
    /**
29
     * Get SIP password for selected extension.
30
     * @param {string} number - The number of the extension.
31
     * @param {function} callback - The callback function
32
     */
33
    getSecret( number, callback) {
34
        let secret = '';
35
        $.api({
36
            url: PbxApi.sipGetSecret,
37
            on: 'now',
38
            urlData: {
39
                number: number
40
            },
41
            successTest: PbxApi.successTest,
42
            onSuccess(response) {
43
                callback(response);
44
            },
45
            onFailure(response) {
46
                callback(response);
47
            },
48
        });
49
        return secret;
50
    },
51
}