mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 04:27:25 +00:00
FS-7312 #resolve #comment added feature NEEDS_DOC
This commit is contained in:
parent
0a8cc1840b
commit
61e250a49b
@ -71,6 +71,7 @@
|
|||||||
login : null, /// auth login
|
login : null, /// auth login
|
||||||
passwd : null, /// auth passwd
|
passwd : null, /// auth passwd
|
||||||
sessid : null,
|
sessid : null,
|
||||||
|
loginParams : null,
|
||||||
getSocket : function(onmessage_cb) { return self._getSocket(onmessage_cb); }
|
getSocket : function(onmessage_cb) { return self._getSocket(onmessage_cb); }
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
@ -250,15 +251,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.JsonRpcClient.prototype.closeSocket = function() {
|
$.JsonRpcClient.prototype.closeSocket = function() {
|
||||||
|
var self = this;
|
||||||
if (self.socketReady()) {
|
if (self.socketReady()) {
|
||||||
this._ws_socket.onclose = function (w) {console.log("Closing Socket");};
|
self._ws_socket.onclose = function (w) {console.log("Closing Socket");};
|
||||||
this._ws_socket.close();
|
self._ws_socket.close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.JsonRpcClient.prototype.loginData = function(params) {
|
$.JsonRpcClient.prototype.loginData = function(params) {
|
||||||
|
var self = this;
|
||||||
self.options.login = params.login;
|
self.options.login = params.login;
|
||||||
self.options.passwd = params.passwd;
|
self.options.passwd = params.passwd;
|
||||||
|
self.options.loginParams = params.loginParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
$.JsonRpcClient.prototype.connectSocket = function(onmessage_cb) {
|
$.JsonRpcClient.prototype.connectSocket = function(onmessage_cb) {
|
||||||
@ -418,7 +422,7 @@
|
|||||||
if (!self.authing && response.error.code == -32000 && self.options.login && self.options.passwd) {
|
if (!self.authing && response.error.code == -32000 && self.options.login && self.options.passwd) {
|
||||||
self.authing = true;
|
self.authing = true;
|
||||||
|
|
||||||
this.call("login", { login: self.options.login, passwd: self.options.passwd},
|
this.call("login", { login: self.options.login, passwd: self.options.passwd, loginParams: self.options.loginParams},
|
||||||
this._ws_callbacks[response.id].request_obj.method == "login" ?
|
this._ws_callbacks[response.id].request_obj.method == "login" ?
|
||||||
function(e) {
|
function(e) {
|
||||||
self.authing = false;
|
self.authing = false;
|
||||||
|
@ -73,6 +73,7 @@
|
|||||||
tag: null,
|
tag: null,
|
||||||
videoParams: {},
|
videoParams: {},
|
||||||
audioParams: {},
|
audioParams: {},
|
||||||
|
loginParams: {},
|
||||||
iceServers: false,
|
iceServers: false,
|
||||||
ringSleep: 6000
|
ringSleep: 6000
|
||||||
}, options);
|
}, options);
|
||||||
@ -90,6 +91,7 @@
|
|||||||
login: verto.options.login,
|
login: verto.options.login,
|
||||||
passwd: verto.options.passwd,
|
passwd: verto.options.passwd,
|
||||||
socketUrl: verto.options.socketUrl,
|
socketUrl: verto.options.socketUrl,
|
||||||
|
loginParams: verto.options.loginParams,
|
||||||
sessid: verto.sessid,
|
sessid: verto.sessid,
|
||||||
onmessage: function(e) {
|
onmessage: function(e) {
|
||||||
return verto.handleMessage(e.eventData);
|
return verto.handleMessage(e.eventData);
|
||||||
|
@ -885,6 +885,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
|
|||||||
switch_bool_t r = SWITCH_FALSE;
|
switch_bool_t r = SWITCH_FALSE;
|
||||||
const char *passwd = NULL;
|
const char *passwd = NULL;
|
||||||
const char *login = NULL;
|
const char *login = NULL;
|
||||||
|
cJSON *login_params = NULL;
|
||||||
|
|
||||||
if (!params) {
|
if (!params) {
|
||||||
*code = CODE_AUTH_FAILED;
|
*code = CODE_AUTH_FAILED;
|
||||||
@ -940,6 +941,23 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
|
|||||||
switch_event_create(&req_params, SWITCH_EVENT_REQUEST_PARAMS);
|
switch_event_create(&req_params, SWITCH_EVENT_REQUEST_PARAMS);
|
||||||
switch_assert(req_params);
|
switch_assert(req_params);
|
||||||
|
|
||||||
|
if ((login_params = cJSON_GetObjectItem(params, "loginParams"))) {
|
||||||
|
cJSON * i;
|
||||||
|
|
||||||
|
for(i = login_params->child; i; i = i->next) {
|
||||||
|
if (i->type == cJSON_True) {
|
||||||
|
switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "true");
|
||||||
|
} else if (i->type == cJSON_False) {
|
||||||
|
switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "false");
|
||||||
|
} else if (!zstr(i->string) && !zstr(i->valuestring)) {
|
||||||
|
switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, i->valuestring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DUMP_EVENT(req_params);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate");
|
switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate");
|
||||||
|
|
||||||
if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) {
|
if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user