forked from Mirrors/freeswitch
FS-11280: Allow overriding permissionCallback per Verto dialog
Currently the 'permissionCallback' object is only available at the Verto instance level. This is problematic in multi-call scenarios, where an individual call dialog needs access to the onGranted/onDenied callback functions. The patch adds a check for existence of onGranted/onDenied callback functions at the dialog level, with a fallback to the original behavior of calling onGranted/onDenied from the Verto instance if it's not available on the dialog. This preserves backwards compatibility while allowing per-dialog overrides going forward.
This commit is contained in:
parent
d5af929660
commit
36d9f7bc5e
@ -2053,7 +2053,11 @@
|
||||
};
|
||||
|
||||
RTCcallbacks.onStream = function(rtc, stream) {
|
||||
if (dialog.verto.options.permissionCallback &&
|
||||
if (dialog.callbacks.permissionCallback &&
|
||||
typeof dialog.callbacks.permissionCallback.onGranted === 'function') {
|
||||
dialog.callbacks.permissionCallback.onGranted(stream);
|
||||
}
|
||||
else if (dialog.verto.options.permissionCallback &&
|
||||
typeof dialog.verto.options.permissionCallback.onGranted === 'function'){
|
||||
dialog.verto.options.permissionCallback.onGranted(stream);
|
||||
}
|
||||
@ -2061,7 +2065,11 @@
|
||||
};
|
||||
|
||||
RTCcallbacks.onError = function(e) {
|
||||
if (dialog.verto.options.permissionCallback &&
|
||||
if (dialog.callbacks.permissionCallback &&
|
||||
typeof dialog.callbacks.permissionCallback.onDenied === 'function') {
|
||||
dialog.callbacks.permissionCallback.onDenied();
|
||||
}
|
||||
else if (dialog.verto.options.permissionCallback &&
|
||||
typeof dialog.verto.options.permissionCallback.onDenied === 'function'){
|
||||
dialog.verto.options.permissionCallback.onDenied();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user