Hangup with no cdr

Hi, I have a custom context that works with API, but that’s simple: In case when API returns something I’ll push the argument to the trunk to dial, if no argument I want to hangup. I’ve written a simple context for hangup and it works but not writes CDR. What can I change in that context?

exten => _X.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _X.,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => _X.,n,hangup

Enable CDRs for unanswered calls.

can you share a simple context?

It’s not configured in the dialplan, and, in any case people don’t like providing worked examples of dialplan, because they tend to be used without being understood, and because making sure that one gets them right takes significant time.