Dial Busy save custom field to CDR

Hello, please help to save custom-field value to CDR db when dial finished with BUSY Dialstatus

exten => s,1,Verbose(1, User ${CALLERID(num)} dialed ${ARG1})
same => n,Dial(PJSIP/${ARG1}${INTERNAL_DIAL_OPT})
same => n,Set(CDR(custom_disposition)=${DIALSTATUS})
same => n,ResetCDR()
same => n,NoCDR()
same => n,GoSub(sub-no-answered-call-finished,s-${DIALSTATUS},1)
same => n,Hanguup()

exten => s-NOANSWER,1,Set(CDR(custom_disposition)=NOANSWER)
exten => s-NOANSWER,n,Playback(on-no-answer)
exten => s-NOANSWER,n,Hangup()

exten => s-CONGESTION,1,Set(CDR(custom_disposition)=CONGESTION)
exten => s-CONGESTION,n,Playback(please-try-again)
exten => s-CONGESTION,n,Congestion(3)

exten => s-BUSY,1,Set(CDR(custom_disposition)=BUSY)
exten => s-BUSY,n,Playback(is-curntly-busy)
exten => s-BUSY,n,Hangup()

I’ve tried to did:
same => n,ResetCDR()
same => n,NoCDR()

but CDR saved to db without custom_disposition field(aught for CONGESTION is good)

Without NoCDR() CDR is saved 2 records to db.

too tried to se options on cdr_adaptive_odbc.conf

 Executing [s@sub-dial-users:2] Dial("PJSIP/2001-0000000c", "PJSIP/2000,90,TU(sub-record-call,s,1)") in new stack
    -- Called PJSIP/2000
[Oct  6 12:47:32] NOTICE[854432]: res_pjsip_geolocation.c:497 handle_outgoing_request:  PJSIP/2000-0000000d: Endpoint has no geoloc_outgoing_call_profile. Skipping.
    -- PJSIP/2000-0000000d is ringing
  == Everyone is busy/congested at this time (1:1/0/0)
    -- Executing [s@sub-dial-users:3] Set("PJSIP/2001-0000000c", "CDR(userfield)=17") in new stack
    -- Executing [s@sub-dial-users:4] Set("PJSIP/2001-0000000c", "CDR(custom_disposition)=BUSY") in new stack
    -- Executing [s@sub-dial-users:5] ResetCDR("PJSIP/2001-0000000c", "") in new stack
    -- Executing [s@sub-dial-users:6] NoCDR("PJSIP/2001-0000000c", "") in new stack
    -- Executing [s@sub-dial-users:7] Gosub("PJSIP/2001-0000000c", "sub-no-answered-call-finished,s-BUSY,1") in new stack
    -- Executing [s-BUSY@sub-no-answered-call-finished:1] Set("PJSIP/2001-0000000c", "CDR(custom_disposition)=BUSY") in new stack
    -- Executing [s-BUSY@sub-no-answered-call-finished:2] Playback("PJSIP/2001-0000000c", "is-curntly-busy") in new stack
       > 0x7fc48049fd80 -- Strict RTP learning after remote address set to:
       > 0x7fc48049fd80 -- Strict RTP learning after ICE completion
       > 0x7fc48049fd80 -- Strict RTP learning after remote address set to:
       > 0x7fc48049fd80 -- Strict RTP switching to RTP target address as source
    -- <PJSIP/2001-0000000c> Playing 'is-curntly-busy.slin' (language 'en')
    -- Executing [s-BUSY@sub-no-answered-call-finished:3] Hangup("PJSIP/2001-0000000c", "") in new stack

Have you checked the database logs and made sure that the field is defined in the db?

I am also not sure whether you are about to reinvent the wheel, as there is already the “dispostion” field.

yes, db has field and asterisk success save to custom_disposion in call CONGESTION

select clid,disposition, custom_disposition from cdr where custom_disposition = ‘CHANUNAVAIL’;
clid | disposition | custom_disposition

I need to playback audio if calls not answered,busy, channel unavailable, and in that cases cdr placed ANSWERED status so not good for call stats

I do not really understand what you are trying to do. CDRs are certainly not the right tool to deal with the status of a call. You never know when you can access them as they might be some buffering.

If you need to do “something” immediately in case a call is not answered by the other side, then simply continue after the Dial Application returns.

as you can see on dialplan and call scrren after dial dialplan continued. I’d like to do simple thing. When extension Call to number, if number was Busy or CHANUNAVAIL, play audio and save to cdr correct status. Its great works for CHANUNAVAIL but for busy cdr_adaptive_odbc save record before.

if you mean g options of dial - I’ve tried that. no luck.

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