Before Deployment on vm:
I successfully ran my app with the Twilio Voice SDK to enable voice communication over the internet. It worked flawlessly when tested locally using ngrok for IP forwarding.
Hosting on Virtual Machine:
After confirming everything was functioning correctly locally, I hosted the application on a server along with the required dependencies. The server operates over HTTP, and I could access the endpoints of my Twilio app through HTTP requests (http://ip:port/endpoint) for both POST and GET requests to specific endpoints. Everything remained the same; the only change I made was the URL from ngrok to the server's URL.
The problem arises when I attempt to make a call after hosting; it fails and disconnects immediately. The token generation is correct, and the Device is initialized successfully. I also updated the requested URL in the TwiML application to point to the endpoint (/voice generate TwiML response).
The line where it seems to get stuck is const call = await device.connect({To: number}). Could this issue be related to using HTTP? Does Twilio only allow connections to servers running over HTTPS?