AGI script to alert server with CLID

What i am trying to do is very similar to what FOP2 does: when a call comes in, i want an alert to go out with the following data: calling number, extension that is ringing.
So i am looking at the full log and after a while i see:
Executing [0123456789@from-trunk:17] Goto("SIP/xxx-pbx05-00000028", "from-did-direct,200,1") in new stack
So what i would like to do patch from-did-direct in such a way that it is not replaced (this is FreePBX). I am guessing that would be something like: from-did-direct-custom in extensions_custom.conf, but i am unable to do something like this. I have tried the following:

include => ext-local-push

exten => 200,1,Noop(CallerID is----------------------------------------------------------------------)
exten => 200,n,Noop(${EXTEN})
exten => 200,n,Noop(${DID})
exten => 200,n,DumpChan()
exten => 200,n,Goto(ext-local,200,1)

But i see nothing in the full-log.
Where can i capture BOTH the incoming CLID and the ringing extension (200).
Thank you in advance!


Peer support for FreePBX is provided at

In general people on the current forum do not have detailed knowledge of the FreePBX provided dialplan.

If you re trying to use the same methodology of FOP2 you must use AMI events instead of dialplan coding, which is the best approach for you as FreePBX dialplan is quite complex if you are not familar with dialplan logic

Thank you. I think that is the way to go indeed. Unfortunately i see every call twice. I don’t have a phone registered and i am listening for ‘Newexten’, ChannelStateDesc=‘Ring’, Context=‘ext-local’, Application=‘Set’

Also: i don’t like a listening application in the background (the process can die). Is it possible to have the AMI “push” to a script, so i don’t have to make sure the process is constantly running?