Dialplan:
; REVERSE-AUTOPATCH - REPEATER RECEIVES INCOMING CALLS
[reverse-autopatch]
; Show the incoming call in the console
exten => _X.,1,NoOp(Incoming reverse-autopatch from ${CALLERID(num)})
; Answer the incoming call.
exten => _X.,n,Answer()
; Wait for 1 second to ensure the line is stable before playing the prompt.
exten => _X.,n,Wait(1)
; Optional: Bypass PIN for trusted caller
; Uncomment the below line to enable this feature:
; exten => _X.,n,GotoIf($["${CALLERID(num)}" = "5551234567"]?connect,1)
; Initialize an attempt counter
exten => _X.,n,Set(ATTEMPTS=0)
; Play a message that asks the caller to enter their PIN followed by the pound/hash key.
exten => _X.,n(start),Playback(confbridge-pin)
; Wait for the caller to enter a 4-digit PIN.
exten => _X.,n,Read(PIN,beep,4,,,5)
; Check if the entered PIN is one of the valid PINs.
exten => _X.,n,GotoIf($["${PIN}" = "1234"]?wait-for-pound)
; Increment the attempt counter
exten => _X.,n,Set(ATTEMPTS=$[${ATTEMPTS}+1])
; If the PIN is invalid, play a message saying it was incorrect.
exten => _X.,n,Playback(confbridge-invalid)
; Check if the attempt counter has reached 3
exten => _X.,n,GotoIf($[${ATTEMPTS} >= 3]?too-many-failures)
; Go back to the start and ask the user to enter the PIN again.
exten => _X.,n,Goto(start)
; If the user fails to enter a valid PIN after 3 attempts, play a message saying they have entered too many invalid PINs.
exten => _X.,n(too-many-failures),Playback(confbridge-pin-bad)
; Hang up the call after the failure message.
exten => _X.,n,Hangup()
; After the valid PIN is entered, wait for the user to press the "#" key.
exten => _X.,n(wait-for-pound),WaitExten(5)
; If the user presses "#", go to the "connect" label.
exten => #,1,Goto(connect,1)
; If "#" is not pressed, go to the start label.
exten => _X.,99,Goto(start)
; If the correct PIN was entered and "#" was pressed, play a message confirming the connection.
exten => connect,1,Playback(rpt/welcome)
; Connect the caller to the repeater using the "rpt" command.
exten => connect,n,rpt(${NODE}|P)
; Hang up the call after the connection is made.
exten => connect,n,Hangup()
Console when accepting a reverse-autopatch call:
CLI> core set verbose 10
Console verbose was OFF and is now 10.
-- Accepting AUTHENTICATED call from xxx.xxx.xxx.xxx:4569:
-- > requested auth methods = (MD5),
-- > actual auth method = MD5,
-- > encrypted = no,
-- > requested format = ulaw,
-- > requested prefs = (ulaw|g729),
-- > actual format = ulaw,
-- > host prefs = (ulaw|g726aal2|gsm),
-- > priority = mine
-- Executing [1234567890@reverse-autopatch:1] NoOp("IAX2/voipms-2735", "Incoming reverse-autopatch from 0987654321") in new stack
-- Executing [1234567890@reverse-autopatch:2] Answer("IAX2/voipms-2735", "") in new stack
-- Executing [1234567890@reverse-autopatch:3] Wait("IAX2/voipms-2735", "1") in new stack
-- Executing [1234567890@reverse-autopatch:4] Set("IAX2/voipms-2735", "ATTEMPTS=0") in new stack
-- Executing [1234567890@reverse-autopatch:5] Playback("IAX2/voipms-2735", "confbridge-pin") in new stack
-- <IAX2/voipms-2735> Playing 'confbridge-pin.ulaw' (language 'en')
-- Executing [1234567890@reverse-autopatch:6] Read("IAX2/voipms-2735", "PIN,beep,4,,,5") in new stack
-- Accepting a maximum of 4 digits.
-- <IAX2/voipms-2735> Playing 'beep.ulaw' (language 'en')
[2024-10-15 13:37:29.469] DTMF[772936][C-000000d3]: channel.c:4008 __ast_read: DTMF begin '1' received on IAX2/voipms-2735
[2024-10-15 13:37:29.469] DTMF[772936][C-000000d3]: channel.c:4012 __ast_read: DTMF begin ignored '1' on IAX2/voipms-2735
[2024-10-15 13:37:29.549] DTMF[772936][C-000000d3]: channel.c:3894 __ast_read: DTMF end '1' received on IAX2/voipms-2735, duration 0 ms
[2024-10-15 13:37:29.549] DTMF[772936][C-000000d3]: channel.c:3963 __ast_read: DTMF end accepted without begin '1' on IAX2/voipms-2735
[2024-10-15 13:37:29.549] DTMF[772936][C-000000d3]: channel.c:3983 __ast_read: DTMF end passthrough '1' on IAX2/voipms-2735
[2024-10-15 13:37:29.989] DTMF[772936][C-000000d3]: channel.c:4008 __ast_read: DTMF begin '2' received on IAX2/voipms-2735
[2024-10-15 13:37:29.989] DTMF[772936][C-000000d3]: channel.c:4012 __ast_read: DTMF begin ignored '2' on IAX2/voipms-2735
[2024-10-15 13:37:30.069] DTMF[772936][C-000000d3]: channel.c:3894 __ast_read: DTMF end '2' received on IAX2/voipms-2735, duration 0 ms
[2024-10-15 13:37:30.069] DTMF[772936][C-000000d3]: channel.c:3963 __ast_read: DTMF end accepted without begin '2' on IAX2/voipms-2735
[2024-10-15 13:37:30.069] DTMF[772936][C-000000d3]: channel.c:3983 __ast_read: DTMF end passthrough '2' on IAX2/voipms-2735
[2024-10-15 13:37:30.569] DTMF[772936][C-000000d3]: channel.c:4008 __ast_read: DTMF begin '3' received on IAX2/voipms-2735
[2024-10-15 13:37:30.569] DTMF[772936][C-000000d3]: channel.c:4012 __ast_read: DTMF begin ignored '3' on IAX2/voipms-2735
[2024-10-15 13:37:30.648] DTMF[772936][C-000000d3]: channel.c:3894 __ast_read: DTMF end '3' received on IAX2/voipms-2735, duration 0 ms
[2024-10-15 13:37:30.649] DTMF[772936][C-000000d3]: channel.c:3963 __ast_read: DTMF end accepted without begin '3' on IAX2/voipms-2735
[2024-10-15 13:37:30.649] DTMF[772936][C-000000d3]: channel.c:3983 __ast_read: DTMF end passthrough '3' on IAX2/voipms-2735
[2024-10-15 13:37:31.168] DTMF[772936][C-000000d3]: channel.c:4008 __ast_read: DTMF begin '4' received on IAX2/voipms-2735
[2024-10-15 13:37:31.168] DTMF[772936][C-000000d3]: channel.c:4012 __ast_read: DTMF begin ignored '4' on IAX2/voipms-2735
[2024-10-15 13:37:31.229] DTMF[772936][C-000000d3]: channel.c:3894 __ast_read: DTMF end '4' received on IAX2/voipms-2735, duration 0 ms
[2024-10-15 13:37:31.229] DTMF[772936][C-000000d3]: channel.c:3963 __ast_read: DTMF end accepted without begin '4' on IAX2/voipms-2735
[2024-10-15 13:37:31.229] DTMF[772936][C-000000d3]: channel.c:3983 __ast_read: DTMF end passthrough '4' on IAX2/voipms-2735
-- User entered '1234'
-- Executing [1234567890@reverse-autopatch:7] GotoIf("IAX2/voipms-2735", "1?wait-for-pound") in new stack
-- Goto (reverse-autopatch,1234567890,14)
-- Executing [1234567890@reverse-autopatch:14] WaitExten("IAX2/voipms-2735", "5") in new stack
[2024-10-15 13:37:34.069] DTMF[772936][C-000000d3]: channel.c:4008 __ast_read: DTMF begin '#' received on IAX2/voipms-2735
[2024-10-15 13:37:34.069] DTMF[772936][C-000000d3]: channel.c:4012 __ast_read: DTMF begin ignored '#' on IAX2/voipms-2735
[2024-10-15 13:37:34.219] DTMF[772936][C-000000d3]: channel.c:3894 __ast_read: DTMF end '#' received on IAX2/voipms-2735, duration 0 ms
[2024-10-15 13:37:34.219] DTMF[772936][C-000000d3]: channel.c:3963 __ast_read: DTMF end accepted without begin '#' on IAX2/voipms-2735
[2024-10-15 13:37:34.219] DTMF[772936][C-000000d3]: channel.c:3983 __ast_read: DTMF end passthrough '#' on IAX2/voipms-2735
-- Executing [#@reverse-autopatch:1] Goto("IAX2/voipms-2735", "connect,1") in new stack
-- Goto (reverse-autopatch,connect,1)
-- Executing [connect@reverse-autopatch:1] Playback("IAX2/voipms-2735", "rpt/welcome") in new stack
-- <IAX2/voipms-2735> Playing 'rpt/welcome.slin' (language 'en')
-- Executing [connect@reverse-autopatch:2] Rpt("IAX2/voipms-2735", "1999|P") in new stack
-- Hungup 'IAX2/voipms-2735'
-- Hungup 'DAHDI/pseudo-761606412'