DND Status in CDR Userfield Using Dial Plan

I would like to log to the CDR Userfield when an ext is on DND.

I have the following DialPlan which shows up in the Asterisk Log File successfully, but it doesn’t actually put anything in the Userfield.

I included it within “from-internal-custom” because I am interested specially when a user in a ring group is in DND and the call bypasses that user because they are on DND.


Dial plan from orignal post removed. See soultion for working dial plan.

Should I be including the macro somewhere else?

You don’t want _X. in from-internal, that will be unpredictable. Use the dialplan hooks described here:

1 Like

I re-read your post and the part that helped me the most was When do I use a dialplan hook and when do I use a Custom Destination?

So I edited my extensions_custom.conf to the following:

exten => s,1,NoOp(Checking if DND is ON for Extension 5001)
exten => s,n,Set(DND_STATUS=${DB(DND/5001)})
exten => s,n,GotoIf($["${DND_STATUS}" = "YES"]?dnd_on:dnd_off)
exten => s,n(dnd_on),Set(CDR(userfield)=DND_ON)
exten => s,n,NoOp(Do Not Disturb is ON for Extension 5001)
exten => s,n,Goto(end)
exten => s,n(dnd_off),NoOp(Do Not Disturb is OFF for Extension 5001)
exten => s,n(end),Return()

Then I created a custom destination, set the target as the macro. (Is this the correct term here?)

Finally, I set the inbound route to this custom destination, and once the call hits the custom destination, it goes to the ring group as set in the custom destination.

Now, the CDR Userfield does populate with “DND_ON” if the internal user in the ring group is on DND.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.