Мне удалось это сделать к LUA. Вот моя XML config:
<extension name="public_did">
<condition field="destination_number" expression="^(12345)$">
<action application="answer" />
<action application="set" data="dtmf_type=rfc2833"/>
<action application="start_dtmf" />
<action application="lua" data="basic.lua"/>
</condition>
</extension>
И в /usr/share/freeswitch/scripts/basic.lua
session:sleep(500)
session:execute("playback", "ivr/ivr-douche_telecom.wav");
digits = session:playAndGetDigits(4, 10, 3, 3000, "#", "ivr/ivr-please_enter_the_number_where_we_can_reach_you.wav", "ivr/ivr-invalid_extension_try_again.wav", "\\d+", "digits_received", 1000,
"5000 XML default");
session:execute("playback", "ivr/ivr-thank_you.wav");
api = freeswitch.API();
get_response = api:execute("curl", "https://example/freeswitch-dialin?id=" .. digits);
api:execute("log", get_response);
api:execute("log", digits);
У меня работает. Важно было установить dtmf_type так, чтобы на входящие вызовы из магистрали SIP также приходилось отвечать!