Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio in chrome extension - user denied access to microphone

I am new to chrome extension. Is there a possibility of providing a microphone access permission to chrome extension by manual (javascript) or using manifest configurations.

I have included twilio successfully by downloading the twilio.js and changed the protocol to "https" for using in background.html of chrome extension.

Manifest.js fields are follows :

 "permissions":["http://*/*", "https://*/*", "*://mail.google.com/*", "storage", "unlimitedStorage", "contextMenus", "cookies", "tabs", "notifications", "activeTab", "background","identity", "*://*.twilio.com/*"],

"content_security_policy": "script-src 'self' 'unsafe-eval' https://apis.google.com https://*.twilio.com; object-src 'self' https://*.twilio.com",

Now,when extension made/receive a call using twilio and accepts the connection. It throws error from Twilio.Device.error method as follows

   error.message is **User denied access to microphone**.

Could anyone please help me to resolve this error ?

like image 315
Krish Lakshmanan Avatar asked Oct 21 '25 06:10

Krish Lakshmanan


1 Answers

I have found an work-around way to enable twilio in the chrome extension's background page.

First time, when we install the extension into chrome app. Just create a new tab with dummy html from the extension directory as below code snippet and make a test call.

    chrome.tabs.create({'url': chrome.extension.getURL('/telephony.html')}, function(tab) {
        console.debug("Telephony Tab details are - ",tab);
    });

It will prompt the user for microphone access and provide allow permission. Once call connected, send a message to background page and setup the Twilio in background. Form the next time you can able to receive the calls in the background.

like image 156
Krish Lakshmanan Avatar answered Oct 23 '25 20:10

Krish Lakshmanan