Asterisk WebRTC: signalling, trust and media requirements
A browser call needs a supported client application, an appropriate signalling connection, a trusted service identity and a reachable protected media path. A web page loading successfully answers only the first part of that chain.
Source-reviewed, 19 October 2026. Prepared from the cited documentation. No browser/client combination has been independently tested by Phone Guides. Scope: Asterisk 22/PJSIP with a source-reviewed JsSIP 3.10.0 browser example. No browser/OS compatibility matrix or working call path has been independently tested by Phone Guides.
Separate the components
| Component | What to establish |
|---|---|
| Browser application | Supported browser/OS/library versions and account handling |
| Signalling | The documented secure WebSocket and SIP path |
| Service identity | Trusted certificate chain and matching hostname |
| PJSIP endpoint | Account, codec and WebRTC-related settings |
| Media traversal | ICE and any required STUN/TURN/network design |
| User controls | Microphone permission, device selection and call state |
The official WebRTC configuration guide explains the Asterisk components. Its examples include older branch references and certificate-exception suggestions. Use current branch options and a valid trust arrangement rather than reproducing a browser-warning bypass.
Verify the required endpoint options
Use the Asterisk 22 PJSIP reference for webrtc and related media/transport options. Determine what the convenience setting changes and what remains a separate transport, certificate or account decision. Do not paste a WebRTC option into an ordinary UDP account and assume the rest is configured.
Check codec/module requirements against the actual browser client and build. A library listed in an old tutorial does not establish current maintenance or support for every browser version. Record both the client application and underlying browser version in any future results.
Interpret the endpoint switch
For an existing endpoint deliberately assigned to a browser client, the relevant option fragment is:
webrtc=yes
This belongs in that endpoint's configuration, not an auth, AOR or ordinary transport object. It is not a full account definition. Avoid changing a shared desk-phone endpoint solely to test a browser: its media policy may no longer match the phone.
The branch-22 option description specifies a group of WebRTC-related defaults. Review the effective RTCP multiplexing, AVPF/ICE and DTLS settings, including any explicit overrides in the actual endpoint. Defaults must be checked against the installed patch release and modules.
The reference separately describes automatic DTLS certificates. A media-session certificate generated under that arrangement is a different trust question from the certificate the browser sees when establishing HTTPS/WSS. Enabling the endpoint switch does not create a publicly trusted browser-facing certificate or justify bypassing a certificate warning.
Walk through a JsSIP audio client
This worked example uses the JsSIP 3.10.0 API shape from its tagged source and the project's 3.8.x API guide. The official API documents the same WebSocketInterface, UA, start() and call() pattern. The repository's current branch and the older versioned documentation are separate sources; pin the package version in your application lockfile and review its matching documentation before adopting later changes. This example is an authoring reference, not a tested browser build.
The browser application assumes a page served from HTTPS, a trusted WSS endpoint such as wss://pbx.example.invalid:8089/ws, an Asterisk PJSIP account with a matching WebSocket transport and dialplan context, and an allowed internal destination such as sip:[email protected]. Replace all example hosts and identities. Obtain the SIP password from the application's account flow; do not commit a real value or put an administrator credential in browser code.
const socket = new JsSIP.WebSocketInterface('wss://pbx.example.invalid:8089/ws');
const ua = new JsSIP.UA({
sockets: [socket],
uri: 'sip:' + accountUser + '@' + sipDomain,
password: sipPassword,
register: true
});
ua.on('connected', () => console.info('SIP WebSocket connected'));
ua.on('disconnected', event => console.error('SIP WebSocket disconnected', event));
ua.on('registered', () => console.info('SIP account registered'));
ua.on('registrationFailed', event => console.error('SIP registration failed', event));
ua.start();
function callInternalUser() {
const session = ua.call('sip:' + destinationUser + '@' + sipDomain, {
mediaConstraints: { audio: true, video: false },
eventHandlers: {
progress: () => console.info('Call is ringing or progressing'),
confirmed: () => console.info('SIP session confirmed'),
failed: event => console.error('Call failed', event.data.cause),
ended: event => console.info('Call ended', event.data.cause)
}
});
return session;
}
The event messages are observations from the client API. A connected event is the WebSocket transport state; registered is the SIP registration result; confirmed is call signalling state. None alone proves that remote audio arrived. For a usable application, add explicit incoming-call handling with newRTCSession, answer controls, local/remote audio elements, session termination controls and cleanup. The library does not supply the page's call interface or account-security policy.
The WebSocket address must match the actual Asterisk HTTP TLS listener and /ws handler. Asterisk's WebRTC guide describes the HTTP service, WSS transport and PJSIP endpoint objects. Its sample credentials and older-version installation details are not copied here. Confirm the branch-22 option reference for webrtc, codecs and certificate paths before configuring the account. Asterisk has separate browser-facing WSS TLS and media DTLS-SRTP certificate roles.
Diagnose one stage at a time
| Observation | Check next |
|---|---|
| The page cannot access the microphone | Browser permission, page secure context and selected input device |
JsSIP emits disconnected |
WSS hostname, TLS trust, listener port and /ws path; then proxy/firewall WebSocket forwarding |
| WSS connects but registration fails | SIP URI domain, authentication username/secret, Asterisk endpoint/AOR, contact limit and registration response |
| Registration succeeds but call setup fails | Dialplan destination/context, endpoint codec offer and SIP response on the INVITE |
| Call signalling confirms but audio is missing or one-way | Browser media permission, ICE candidates, advertised RTP addresses, firewall and any STUN/TURN relay path |
| The other party hears audio but DTMF does not work | Check the negotiated DTMF method and application behaviour separately; a connected media session does not prove digits |
Collect client version, browser/OS version, WSS hostname, relevant SIP response codes and media candidate summaries with secrets and full personal addresses removed. Use the existing registration failure and no-audio guides for the Asterisk-side checks. The client source and Asterisk documentation do not establish universal browser interoperability, NAT success, carrier behaviour or audio quality.
Inspect the path in order
On the server, start with read-only status commands available from the installed modules:
http show status
module show like websocket
pjsip show endpoints
Use CLI help if a command is unavailable. The upstream WebRTC setup guide identifies the HTTP/WebSocket and PJSIP components. An HTTP listener alone does not prove that the intended WebSocket handler, TLS service identity and account work.
| Stage | Evidence to collect privately |
|---|---|
| Client page | Actual origin, browser version and secure-context requirements |
| WSS connection | Destination hostname, trusted certificate and successful connection |
| SIP account | Intended authentication identity, registration exchange and resulting contact |
| Call/media | Negotiated formats, selected media addresses and two-way audio |
| Controls | Microphone permission, selected device, digits and hangup |
Keep the first failed stage as the next investigation. If the browser rejects the service identity, repeatedly changing account credentials cannot establish the later stages. If registration succeeds but audio does not, inspect media traversal and permissions rather than treating the registration result as a complete WebRTC result.
Keep network and trust decisions explicit
A certificate failure occurs before later authentication/media steps can be evaluated reliably. Correct the service name and trust chain through the approved deployment path. A successful WSS connection then needs a separate account and call-path check.
For media, inspect the actual candidate/address selection and firewall topology. Asterisk and a browser behind different NAT devices can need a different traversal arrangement from two local endpoints. Use NAT and RTP and the client implementation's own documentation; do not solve every media failure by exposing more signalling ports.
Protect the browser-facing application
Distinguish a browser's SIP user account from privileged PBX-management credentials. Keep administrative ARI/AMI credentials on the application server. Authenticate application users and authorise the operations they may request. A cross-origin setting is not a substitute for those decisions.
Record which origin hosts the client, which service it connects to and how secrets are stored and rotated. Do not place a shared administrator account in a downloadable configuration file or bundled JavaScript.
Reader checks
On your own supported client matrix, inspect certificate trust, WSS connection, SIP registration, call setup, microphone permission, two-way audio, DTMF and hangup separately. Include a changed network, denied microphone access and a disconnected/reconnected client.
Report results for the exact browser/client path exercised. Success of a desktop SIP phone does not establish the browser path, and browser audio does not establish remote call-control features. Return to Asterisk documentation.