Dialplan customization - How/Where to insert?

I’d appreciate a bit of help in determining where to insert a small customization into my dialplan which sets a VarSet (called SCREENPOP) which I can query remotely via AMI.

I simply want to write the inbound callerID (name & number) and extension number to VarSet and I believe the following would work:

same=> n,Set(SCREENPOP=${CALLERID(num)}:${CALLERID(name)}:${EXTEN})

I really only need this for one of my inbound routes, which routes external calls to a specific number through to a specific extension (in my case, ext 201).

Where would be the best place to insert this custom fragment and how do I ensure it won’t be overwritten by FreePBX?

Many thanks in anticipation

See my comment in this thread from earlier today - you would use essentially the same method to insert your code:

Script to monitor call failures NOT TRUNK

The inbound route would go to the custom destination, and the custom destination would go to your extension after returning from your custom code.

Perfect, thank you so much!

The SCREENPOP variable is being written as it should and the call is then being passed to the ring group. The only trouble is I need to be able to pass a valid ‘channel’ to AMI Getvar in order to successfully return the caller ID info otherwise the value of SCREENPOP is reported as null

The trouble is I don’t know what the channel ‘name’ is at this stage. Do you have any suggestions as to how I might do this?

Thanks again

${CHANNEL} * - Current channel name


Thanks again for your help, I really do appreciate it.

I understand that ${CHANNEL} gives the current channel name, but if I use something like Exten => s,1,Set(MyVar=${CHANNEL}), the current channel name is indeed written to MyVar… but, it’s written as a channel variable and unless I pass the correct channel name with the AMI action Getvar, I cannot successfully return the value of MyVar. The trouble is I do not know the channel name to pass at this time.

Is there anyway I can set MyVar as a global variable which I can access without knowing the channel name?

Thanks again.

The very first google result from “Asterisk Global Variables” yields this page:

Awesome… I have no idea how I missed that… I must need more coffee… lots of it!

Kindly forgive my stupidity… I shall leave immediately for a remote area of the Himalayas where I shall spend the rest of my days as a goatherd.

Thanks again :smile:

1 Like