Dialing out using LOCAL channel and g flag seems to fail

Dear all,

I have the following scenario:

exten => 100,1,NoOp(We are dialing out)
exten => 100,n,Set(number=NUMBERHERE)
exten => 100,n,Dial(LOCAL/${number}@dialout/n,30,Hg)
exten => 100,n,NoOp(We are done)

exten => _X.,1,Dial(SIP/${EXTEN}@CARRIERHERE,30,rgA(notifycallee))
exten => _X.,n,NoOp(Do something after call completes)
exten => _X.,n,Hangup

exten => h,1,NoOp(Do something on hangup)
exten => h,n,Hangup

What happens here is that as soon as the dial in [dialout] becomes connected the call continues in dialplan. It does NOT wait until the call is finished. So the NoOp message in _X. is displayed before jumping straight into the h extension. But I want the callflow to continue AFTER the Dial in [dialout] has finished.

Any help? Am I doing something wrong?

Best, Mark