Pin direct_media=no, and correct the "(+) cannot override" claim

Fixkamo-asterisk-support
Shipped
September 3, 2026 at 12:06 AM UTC
Author
Kamo
Commit
a2eebfc

FreePBX's PJSip driver defaults direct_media to YES (generateDefaultDeviceSettings, PJSip.class.php:210) and the GraphQL addExtension mutation has no field to override it, so every extension KamoCRM creates arrives with media allowed to flow endpoint-to-endpoint. All 21 extensions created through the GUI on k1m1 are `no`; the one created through the API was the only `yes`. When direct media is negotiated Asterisk leaves the media path, and the MixMonitor() recording this whole program exists to upload captures silence. The previous commit claimed this could not be fixed from the custom-post file because "a (+) block can only ADD an option, never override — first value wins". That was wrong, and wrong for an embarrassing reason: the experiment behind it used `pjsip reload`, which the very same commit proves does not reprocess (+) appends at all. So the block was never applied and the endpoint kept its original value, which looked exactly like first-value-wins. Re-run properly against an endpoint whose generated config said direct_media=yes, appending direct_media=no and reloading with `module reload res_pjsip.so`: direct_media went true -> false. LAST value wins. No FreePBX database credentials needed, which matters because the agent has none on a customer box. So the reconciler now emits direct_media=no as well. The two concerns are tracked separately per extension rather than inferred from each other: - WebRTC settings are ours only when nobody else has written a block for that extension, because they would otherwise duplicate or contradict the roster. - direct_media is ours unconditionally. A roster block does not set it, so an extension whose WebRTC block someone else owns still records silence without it. Such an extension gets a second (+) block carrying direct_media alone. NORMALIZE_DIRECT_MEDIA defaults ON — unlike the WebRTC block it is safe for every kind of phone, and it is squarely inside what the README already promises ("checks whether your phone system is set up to record calls the way Kamo expects, and makes the changes for you"). It is a pointer so that an explicit false is distinguishable from absent; a plain bool could not be turned off. Verified live: a fresh API-created extension read direct_media=true, and after one reconcile plus one module reload read false, with the other 21 extensions and the Erik_Primary trunk unchanged and the KlusterServices roster preserved byte for byte. All 22 live extensions now read direct_media=false.

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