Using two FreePBX FPBX-15.0.16.57(16.9.0) instances. PJSIP trunk between them. One is used as a call generator and one is used as call answerer. The call answerer is a simulated 911 PSAP. The call generator is to be used to simulate “typical” 911 callers and also various 911 system attackers (abusive harassing callers, bot callers, …etc).
I am using a LOCAL channel to launch calls to the call generator. I am providing a channel variable to stipulate how many times a given caller is to call 911. I want to place a call and detect when the called party (i.e. a 911 call taker) hangs up. At hang-up by the call-taker, if this particular caller has not yet placed the max number of calls it is permitted, I wish to repeat the Dial command, wait for the call-taker to answer and eventually hang-up… and so on until the max number of calls have been placed by this caller.
As the topic of this post reflects, the g flag on the Dial command is NOT being triggered by the called party hanging up. I see the BYE request from the call answering PBX. The call gen replies with a 200 OK to the BYE request. Debug shows reception of the BYE and onset of several hangup events (e.g. HangupRequest, SoftHangupRequest, Hangup, DialEnd, …etc). It certainly seems that these events are sufficient to trigger the g flag of the Dial command and proceed to execute the next dialplan statement in the context being executed.
The call record I drop in asterisk’s outgoing folder:
Channel: LOCAL/9111010001@911-sim-calls/n
CallerID: 5617672434
Extension: 9111010001
Context: 911-sim-calls
Priority: 1
Setvar: MAX_NUM_CALLS=3
Setvar: PSAP_MNEMONIC=wspbpdtcp
The dialplan in file extensions_custom.conf I’ve been playing around with.
Note the optional g flag is present in the Dial command.
[911-sim-calls]
exten => _9111010001,1,Set(NUM_CALLS=0)
exten => _9111010001,2,NoOp(Caller matched 9111010001 bot caller pattern. Call and stay on line as long as the call-taker doesn’t hang up. If call-taker hangs up, repeat ${MAX_NUM_CALLS} time. Extension to dial = ${EXTEN}, CID is ${CALLERID(num)}.)
exten => _9111010001,3,Set(NUM_CALLS=$[${NUM_CALLS} + 1])
exten => _9111010001,4,Verbose(NUM_CALLS = ${NUM_CALLS})
exten => _9111010001,5,Verbose(MAX_NUM_CALLS = ${MAX_NUM_CALLS})
exten => _9111010001,6,Verbose(NUM_CALLS > MAX_NUM_CALLS = $[ ${NUM_CALLS} > ${MAX_NUM_CALLS}])
exten => _9111010001,7,GotoIf($[ ${NUM_CALLS} > ${MAX_NUM_CALLS}]?endcall)
exten => _9111010001,8,Dial(PJSIP/${PSAP_MNEMONIC}@call-sim-911-trunk,300,gA(spam))
exten => _9111010001,9,Verbose(Reached dialplan statement after Dial command)
exten => _9111010001,10,Goto(911-sim-calls,9111010001,3)
exten => _9111010001,11(endcall),Hangup()
I’ve searched this forum and elsewhere for a couple of days on-line and have not found anyone else who is encountering this issue where apparently the g flag is not triggering despite the called party hanging up.
Any insight from asterisk and or FreePBX experts would be appreciated.