Reconcile per-extension WebRTC blocks instead of hand-editing a roster

Featurekamo-asterisk-support
Shipped
September 2, 2026 at 11:43 PM UTC
Author
Kamo
Commit
1615467

An extension created through FreePBX's API gets no WebRTC block, so it registers over WSS and then has no DTLS or ICE — the browser softphone shows a connected call carrying no audio. Those settings cannot be expressed anywhere FreePBX will accept them: `dtls_cert_file` and `transport` are not columns in the `sip` table and not fields on the `addExtension` mutation, so they have to be `[<ext>](+)` appends in **************** Until now that file was a hand-maintained roster in a ConfigMap, which meant every new extension was silently broken until somebody remembered to edit it and redeploy (8888 sat unlisted for months). Extension 8777 was the latest. WebRTCReconciler reads the extension list out of the FreePBX-generated pjsip.endpoint.conf and keeps a marker-delimited managed section in step with it, every 30s. Deleted extensions lose their block automatically — a (+) block for a section that no longer exists makes Asterisk log "Section does not exist" on every reload. It only fills gaps: any block written outside our markers (the KlusterServices roster, an administrator) is left exactly as it is, never duplicated and never taken over. Only all-numeric endpoints are touched, so trunks are not pinned to a WS transport with DTLS forced on. A missing pjsip.endpoint.conf is a no-op rather than "zero extensions", which would otherwise strip WebRTC from every extension that has one. OFF by default (MANAGE_WEBRTC_ENDPOINTS), on for k1m1. The block is exactly wrong for a SIP desk phone: it forces DTLS-SRTP the phone cannot do and pins it to a transport it does not speak. Two things measured on the live k1m1 box rather than assumed: - The reload has to be `module reload res_pjsip.so`, not `pjsip reload`. After adding a `[8999](+)` block, `pjsip reload` left the endpoint on webrtc=no; one module reload applied it, and one module reload also reverted it when the block was removed. Using the CLI's own `pjsip reload` here would write a correct file and leave the running config wrong. - A (+) block can only ADD options, never override. Appending `direct_media=yes` to an endpoint whose generated config said `direct_media=no` left it on `no` — first value wins. (`webrtc=yes` is the exception only because it is an additive shorthand, not a stored field.) Anything that must CHANGE a generated value has to be fixed in the FreePBX database. Verified against the real /etc/asterisk: correctly picked out the one uncovered extension from 23, skipped the Erik_Primary trunk, left the existing roster byte-for-byte identical, and was a no-op on the second pass.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing