Dial() and "g" option


Here is part of my dialplan:

exten => _XXXX,1,MYSQL(Connect …

exten => _XXXX,n,NoOp(${balans})
; Obrabotka GotoIf
exten => _XXXX,n,GotoIf($[${balans}{<=}0]?fuck:dial)
; Go away
exten => _XXXX,n(fuck),NoCDR()
exten => _XXXX,n,Playback(vm-sorry)
exten => _XXXX,n,Hangup()
; Dial
exten => _XXXX,n(dial),Dial(SIP/${EXTEN:0:4},20,gm)
exten => _XXXX,n,Hangup()
exten => _XXXX,n,NoOp(${CDR(billsec)})

If expression false dialplan go to lable “dial” to Dial(…) with “g” option, but after Hangup() does not go to the next priority NoOp(…).

Where is my mistake?

Adding the Hangup line. That should never be needed after a Dial, as Dial will hangup for itself without the g option. The g stops Dial from hangin up.

Sorry, but I do not understand.
I need that dialplan don’t stop after caller or called party hang up.

exten => _XXXX,n(dial),Dial(SIP/${EXTEN:0:4},20,gm)
exten => _XXXX,n,NoOp(${CDR(billsec)})

But I do not see NoOp in CLI. Why?

You will have to use an h extension. Even then, the rules for CDRs are a bit tricky.

If the callee hangs up, your dialplan will continue, but the call is not complete, so there is no meaningful value for bill seconds.

If the caller hangs up, the main dialplan can never continue, and you must use the h extension to do anything on the calling channel.

I think there are some options that control whether or not CDRs are updated before running h.