Skip to content

Fix fax and voice sending under Twig 3 - #28

Merged
tahiralmas merged 1 commit into
ictcorefrom
fix/twig3-set-prefix
Oct 10, 2026
Merged

tahiralmas merged 1 commit into
ictcorefrom
fix/twig3-set-prefix

Conversation

@tahiralmas

Copy link
Copy Markdown
Member

Every outbound fax and voice call has failed to send since the PHP 8.1+ move (#23). POST /transmissions/{id}/send returns:

Unexpected "spaceless" tag (expecting closing tag for the "macro" tag defined near line 2) in "Gateway/Freeswitch/templates/function.twig"

Twig 3 removed both {% spaceless %} and {% for ... if ... %}, and the set_prefix macro used both. That macro renders the dial string in fax.json and voice.json, so nothing could be originated.

The rewrite uses whitespace control and an explicit match flag, and keeps the same behaviour: the first remove|add provider prefix rule that changes the number wins, and a number that matches no rule passes through unchanged.

Tested on the ICTFax image (Twig 3.28):

  • Rule rendering: nine cases pass: empty and null rules, 00|, 0|92, multiple rules, |9, and a bare remove.
  • Sending: a send through the API now reaches FreeSWITCH originate. The lab trunk is fake, so it ends in GATEWAY_DOWN, where before it failed in the template.

This is the only template in the repo using removed Twig syntax.

Note: the published ICTFax image on Docker Hub (built in August with the PHP 8.3 patch) likely has the same fault. It should be rebuilt once this merges.

Since the PHP 8.1+ move (#23) every outbound fax and voice call failed before
dialing: POST /transmissions/{id}/send returned 'Unexpected "spaceless" tag'
from function.twig. Twig 3 removed both {% spaceless %} and "for ... if", and
the set_prefix macro used both. It renders the dial string for fax.json and
voice.json, so nothing could be originated.

Rewritten with whitespace control and an explicit match flag, same behaviour:
the first "remove|add" provider prefix rule that changes the number wins, and
a number with no matching rule passes through unchanged. Checked against nine
cases under Twig 3.28 (empty and null rules, 00|, 0|92, multiple rules, |9,
bare remove), and a send on the ICTFax image now reaches FreeSWITCH originate.
@tahiralmas
tahiralmas merged commit b5804ff into ictcore Oct 10, 2026
1 check passed
tahiralmas pushed a commit to ictinnovations/ictfax that referenced this pull request Oct 10, 2026
Picks up ictinnovations/ictcore#28 (the set_prefix macro rewritten for Twig 3;
every fax and voice send failed with 'Unexpected spaceless tag') and #27
(extension SIP users written on create, force-register-domain).
tahiralmas pushed a commit to ictinnovations/ictdialer that referenced this pull request Oct 10, 2026
Picks up ictinnovations/ictcore#28 (the set_prefix macro rewritten for Twig 3;
every fax and voice send failed with 'Unexpected spaceless tag') and #27
(extension SIP users written on create, force-register-domain).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants