From: Chad Phillips Date: Thu, 26 Jul 2018 18:37:32 +0000 (-0500) Subject: FS-11280: Allow overriding permissionCallback per Verto dialog X-Git-Tag: v1.8.2~1^2~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36d9f7bc5e4a1644cdcf8c00df976d5283885ea3;p=thirdparty%2Ffreeswitch.git 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. --- diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index c913ca4140..5db7951d78 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -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(); }