Hi everyone,
we’re trying to use Asterisk 20.6.0 as a middleware to connect SIP.js (WebRTC via WSS) in the browser to our FRITZ!Box SIP trunk.
The goal is:
- Browser → Asterisk (WSS) → FRITZ!Box SIP Trunk → Outbound Call
We want to handle everything via WebRTC/SIP.js without exposing FRITZ!Box credentials to the frontend.
Setup
Environment
-
Asterisk Version: 20.6.0
-
Database: PostgreSQL (Realtime via ODBC)
-
Client: SIP.js
0.21.1 -
Transport:
WSS(Port 8089) -
Browsers Tested: Chrome, Edge
-
Use Case: Outbound calls via FritzBox → Asterisk → Browser
Configuration
pjsip.conf (global)
[global]
type=global
user_agent=Asterisk-KCP
endpoint_identifier_order=auth_username,username,ip
Transport
[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0:8089
allow_reload=yes
Realtime Tables
We’re using PJSIP-Realtime via ODBC (res_odbc_pgsql.conf → working).
Here are the relevant table contents:
ps_auths
| id | auth_type | username | realm | md5_cred |
|---|---|---|---|---|
| sip-user | md5 | User1234 | asterisk | 65b97a58d1b12c151c6357b9a71b369f |
ps_endpoints
| id | transport | aors | auth | context | allow | identify_by |
|---|---|---|---|---|---|---|
| sip-user | transport-wss | sip-user | sip-user | from-internal | opus,ulaw,alaw | auth_username |
ps_aors
| id | max_contacts | support_path |
|---|---|---|
| sip-user | 2 | yes |
Problem
Registration via SIP.js fails. Here’s a snippet from the PJSIP logger:
<--- Received SIP request (477 bytes) from WSS:85.216.xxx.xxx --->
REGISTER sip:sip.dtec-group.de SIP/2.0
Via: SIP/2.0/WSS dsn59428s1on.invalid;branch=z9hG4bK9153338
To: <sip:User1234@sip.dtec-group.de>
From: <sip:User1234@sip.dtec-group.de>;tag=m1mslc52h9
CSeq: 2 REGISTER
Contact: <sip:3tg17l3j@dsn59428s1on.invalid;transport=ws>;expires=600
User-Agent: SIP.js/0.21.1
<--- Transmitting SIP response (473 bytes) --->
SIP/2.0 401 Unauthorized
<--- Received SIP request (753 bytes) from WSS:85.216.xxx.xxx --->
REGISTER sip:sip.dtec-group.de SIP/2.0
Authorization: Digest algorithm=MD5, username="User1234", realm="asterisk", nonce="...", uri="sip:sip.dtec-group.de", response="bed81fbaaf2701922760bc53a948aea3"
[Aug 19 20:56:21] NOTICE[1390753]: res_pjsip/pjsip_distributor.c:673 log_failed_request:
Request 'REGISTER' from '<sip:User1234@sip.dtec-group.de>' failed - Failed to authenticate
What We’ve Already Tried
-
Verified MD5 hash → correct (MD5(User1234:asterisk:Test1234)) -
Added endpoint_identifier_order=auth_username,username,ip→ works -
Set identify_by=auth_usernameinps_endpoints -
Enabled support_path=yesfor WebRTC -
WSS transport works, port 8089 open -
Digest response from browser verified as correct -
Asterisk still returns 401 Unauthorized
Questions to the Community
-
Are there known issues with SIP.js + Asterisk Realtime (ODBC) + WebRTC?
-
Do we need extra configuration in func_odbc.conf or res_odbc.conf for WebRTC auth?
-
Are there additional parameters required for WSS / WebRTC support?
-
Could
endpoint_identifier_orderbe problematic when using Realtime + ODBC?
Goal
We want to achieve:
-
Browser using SIP.js → Asterisk (WSS) → FRITZ!Box SIP Trunk → Outbound Call
-
FRITZ!Box SIP credentials should never be exposed in the frontend
-
WebRTC should run natively via SIP.js
System Info
Asterisk 20.6.0
PostgreSQL 16
res_odbc_pgsql / Realtime enabled
SIP.js 0.21.1
Transport WSS: 8089
Has anyone successfully implemented a similar setup with WebRTC, SIP.js, and Asterisk Realtime?
Any hints, configs, or working examples would be extremely appreciated! ![]()
Thx in advance
Halim