Installed pfSense Router, DTMF not working correctly

Hello everyone, we recently onboarded a new IT client that had an internal FreePBX system that sat behind a Fortinet Fortigate Firewall. everything worked fine.

I recently just installed a Netgate pfSense router and DTMF does work. Calls in and out are working fine.

for DTMF in bound, scenario Calling in to hit AH IVR, initially DTMF will not work, once the greeting plays once and begins playing again then the DTMF works.

for DTMF outbound meaning Calling a business with an IVR, the DTMF will never work.

My pfSense has port forwards to the PBX for SIP and RTP Ports.

once thing i am waiting to try tonight is to create a rule for the outbound source port.
just looking to see if anyone has had those same type of problems (couldn’t find in search)

Thanks in advance.

How are you handling DTMF? (inband, RFC, … ?. Turn on DTMF logging to see)

Ok got the logging enabled, in the first set (initial greeting plays, i dialed 1001, and then 9. Does not go through, after the greeting plays or plays again for that matter the DTMF tones will work. which has me confused. It shows multiple entries for 1 key press.

– Goto (app-announcement-1,s,1)
– Executing [[email protected]:1] GotoIf(“SIP/FlowRouteOut-0000005e”, “0?begin”) in new stack
– Executing [[email protected]:2] Answer(“SIP/FlowRouteOut-0000005e”, “”) in new stack
> 0x7fb61c005bc0 – Strict RTP switching to RTP target address X.x.x.x:47444 as source
– Executing [[email protected]:3] Wait(“SIP/FlowRouteOut-0000005e”, “1”) in new stack
– Executing [[email protected]:4] NoOp(“SIP/FlowRouteOut-0000005e”, “Playing announcement Business Hours”) in new stack
– Executing [[email protected]:5] Playback(“SIP/FlowRouteOut-0000005e”, “custom/businesshours,noanswer”) in new stack
– <SIP/FlowRouteOut-0000005e> Playing ‘custom/businesshours.slin’ (language ‘en’)
> 0x7fb61c005bc0 – Strict RTP learning complete - Locking on source address x.x.x.x:47444
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘1’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘1’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘1’ received on SIP/FlowRouteOut-0000005e, duration 276 ms
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘1’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘0’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘0’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘0’ received on SIP/FlowRouteOut-0000005e, duration 262 ms
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘0’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘0’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:12] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘0’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘0’ received on SIP/FlowRouteOut-0000005e, duration 255 ms
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘0’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘1’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘1’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘1’ received on SIP/FlowRouteOut-0000005e, duration 266 ms
[2023-01-14 13:22:13] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘1’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:15] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘9’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:15] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘9’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:16] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘9’ received on SIP/FlowRouteOut-0000005e, duration 267 ms
[2023-01-14 13:22:16] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘9’ on SIP/FlowRouteOut-0000005e
– Executing [[email protected]:6] Goto(“SIP/FlowRouteOut-0000005e”, “ivr-1,s,1”) in new stack
– Goto (ivr-1,s,1)
– Executing [[email protected]:1] Set(“SIP/FlowRouteOut-0000005e”, “TIMEOUT_LOOPCOUNT=0”) in new stack
– Executing [[email protected]:2] Set(“SIP/FlowRouteOut-0000005e”, “INVALID_LOOPCOUNT=0”) in new stack
– Executing [[email protected]:3] Set(“SIP/FlowRouteOut-0000005e”, “_IVR_CONTEXT_ivr-1=”) in new stack
– Executing [[email protected]:4] Set(“SIP/FlowRouteOut-0000005e”, “_IVR_CONTEXT=ivr-1”) in new stack
– Executing [[email protected]:5] Set(“SIP/FlowRouteOut-0000005e”, “__IVR_RETVM=”) in new stack
– Executing [[email protected]:6] GotoIf(“SIP/FlowRouteOut-0000005e”, “1?skip”) in new stack
– Goto (ivr-1,s,9)
– Executing [[email protected]:9] Set(“SIP/FlowRouteOut-0000005e”, “IVR_MSG=custom/businesshours”) in new stack
– Executing [[email protected]:10] Set(“SIP/FlowRouteOut-0000005e”, “TIMEOUT(digit)=3”) in new stack
– Digit timeout set to 3.000
– Executing [[email protected]:11] ExecIf(“SIP/FlowRouteOut-0000005e”, “1?Background(custom/businesshours)”) in new stack
– <SIP/FlowRouteOut-0000005e> Playing ‘custom/businesshours.slin’ (language ‘en’)
[2023-01-14 13:22:27] DTMF[7752][C-00000072]: channel.c:4152 __ast_read: DTMF begin ‘9’ received on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:27] DTMF[7752][C-00000072]: channel.c:4156 __ast_read: DTMF begin ignored ‘9’ on SIP/FlowRouteOut-0000005e
[2023-01-14 13:22:28] DTMF[7752][C-00000072]: channel.c:4066 __ast_read: DTMF end ‘9’ received on SIP/FlowRouteOut-0000005e, duration 267 ms
[2023-01-14 13:22:28] DTMF[7752][C-00000072]: channel.c:4136 __ast_read: DTMF end passthrough ‘9’ on SIP/FlowRouteOut-0000005e
– Executing [[email protected]:1] Set(“SIP/FlowRouteOut-0000005e”, “__ivrreturn=0”) in new stack
– Executing [[email protected]:2] Goto(“SIP/FlowRouteOut-0000005e”, “directory,1,1”) in new stack
– Goto (directory,1,1)
– Executing [[email protected]:1] Answer(“SIP/FlowRouteOut-0000005e”, “”) in new stack
– Executing [[email protected]:2] Wait(“SIP/FlowRouteOut-0000005e”, “1”) in new stack
– Executing [[email protected]:3] AGI(“SIP/FlowRouteOut-0000005e”, “directory.agi,dir=1,retivr=false”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/directory.agi
– <SIP/FlowRouteOut-0000005e> Playing ‘cdir-welcome.slin’ (language ‘en’)
– <SIP/FlowRouteOut-0000005e>AGI Script directory.agi completed, returning 4
== Spawn extension (directory, 1, 3) exited non-zero on ‘SIP/FlowRouteOut-0000005e’
– Executing [[email protected]:1] Macro(“SIP/FlowRouteOut-0000005e”, “hangupcall,”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/FlowRouteOut-0000005e”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [[email protected]:3] ExecIf(“SIP/FlowRouteOut-0000005e”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [[email protected]:4] Hangup(“SIP/FlowRouteOut-0000005e”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/FlowRouteOut-0000005e’ in macro ‘hangupcall’
== Spawn extension (directory, h, 1) exited non-zero on ‘SIP/FlowRouteOut-0000005e’
MMP-AST-VM01*CLI>

Trunk Sip settings

type=friend
secret=XXXXXXX
username=xxxxxx
host=us-east-va.sip.flowroute.com
port=5160
dtmfmode=rfc2833
context=from-trunk
canreinvite=no
allow=ulaw
;allow=g729 ;uncomment this line if you have G.729 licenses installed.
insecure=port,invite
fromdomain=us-east-va.sip.flowroute.com

Little update,
I believe the outgoing DTMF (Client calling outside) is working now. i had to make an outbound NAT to not rewrite the source port.
I am not onsite but remotely attached a softphone to the PBX and made some test calls. DTMF tones work. so hoping its the same from local phones.

So if that is solved i still have the issue of DTMF tones when people call in and hit the IVR.
I made a test Ring group to get to the IVR, and i called it from my remote soft phone, to bypass going over the flow route trunk. and pressing the digit works fine.

But when calling from the outside, going over flow route the DTMF will not work unless you wait for the ivr greeting to play again.