Cdr report does not show src and dst

“”,“”,“”,“obd_sip”,“”“”" <>“,“SIP/sip1-0000000d”,”“,“Playback”,“demo-congrats”,“2024-03-29 17:20:41”,“2024-03-29 17:20:52”,“2024-03-29 17:20:58”,16,6,“ANSWERED”,“DOCUMENTATION”,“1711713041.39”,”“,13,”“,”“,”"

this is my master.csv log

[obd_sip]
exten = 1000,1,NoOp(“inside obd calls”)
same = n,Set(CALLERID(num)=${CALLERID(num)}) ; Set the caller ID
same = n,Set(TO_ADDR=${SIP_HEADER(TO):5:10}) ; Extract the destination number from SIP header
same = n,Verbose(To address Value is ${TO_ADDR})
same = n,Set(CDR(src)=${CALLERID(num)}) ; Set the source number in CDR
same = n,Set(CDR(dst)=${TO_ADDR}) ; Set the destination number in CDR
same = n,Answer()
same = n,Playback(demo-congrats)
same = n,Hangup()

this is extensions.conf

src and dst is not display in master.csv and mysql

"","","","obd_sip",""""" <>","SIP/sip1-0000000d",,"","Playback","demo-congrats","2024-03-29 17:20:41","2024-03-29 17:20:52","2024-03-29 17:20:58",16,6,"ANSWERED","DOCUMENTATION","1711713041.39","",13,"","",""

Those fields are read-only, although I don’t understand why dst is not set to 1000. src is, correctly empty, as your caller ID has no number.

If you want them to be anything other than standard, you need to make sure that extension reflcts your wished for dst, at the time the CDR is closed, and the caller ID number is the wished for src, at that point.

Only disposition, amaflags, and userfield are user settable, according to Call Detail Records I assume disposition will be overwritten by any DIal call.

[obd_sip]
exten = _X!,1,NoOp(“inside yjtec_obd calls”)
same = n,Set(CALLERID(num)=${SIP_HEADER(Caller-ID)}) ; Fetch the Caller ID from SIP header
same = n,Set(TO_ADDR=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)}) ; Extract the destination number from SIP header
same = n,Verbose(To address Value is ${TO_ADDR})
same = n,Verbose(Caller ID is ${CALLERID(num)})
same = n,Set(CDR(src)=${CALLERID(num)}) ; Set the source number in CDR
same = n,Set(CDR(dst)=${TO_ADDR}) ;
same = n,Answer()
same = n,Playback(demo-congrats)
same = n,Hangup()

Executing [1234@obd_sip:2] Set(“SIP/sip1-00000000”, “CALLERID(num)=”) in new stack
– Executing [1234@obd_sip:3] Set(“SIP/sip1-00000000”, “TO_ADDR=9025167654”) in new stack
– Executing [1234@obd_sip:4] Verbose(“SIP/sip1-00000000”, “To address Value is 9025167654”) in new stack
To address Value is 9025167792
– Executing [1234@obd_sip:5] Verbose(“SIP/sip1-00000000”, "Caller ID is ") in new stack
Caller ID is
– Executing [1234@obd_sip:6] Set(“SIP/sip1-00000000”, “CDR(src)=”) in new stack
[Mar 30 18:04:53] ERROR[6214]: cdr.c:3250 ast_cdr_setvar: Attempt to set the ‘src’ read-only variable!
– Executing [1234@obd_sip:7] Set(“SIP/sip1-00000000”, “CDR(dst)=9025167654”) in new stack
[Mar 30 18:04:53] ERROR[6214]: cdr.c:3250 ast_cdr_setvar: Attempt to set the ‘dst’ read-only variable!
– Executing [1234@obd_sip:8] Answer(“SIP/sip1-00000000”, “”) in new stack
– Executing [1234@obd_sip:9] Playback(“SIP/sip1-00000000”, “demo-congrats”) in new stack
– <SIP/sip1-00000000> Playing ‘demo-congrats.alaw’ (language ‘en’)
== Spawn extension (obd_sip, 1234, 9) exited non-zero on ‘SIP/sip1-00000000’

cannot set src and dst. how to set that?

Read only means you cannot set them. I’ve already explained where the values used come from and that that happens when the CDR is finailised.

If you want arbitrarily defined fields, you either need to use a custom CSV format, or to pack all the values into the userfield.

how to get the call status in dialplan?

That’s too broad a question. Look into the HANGUPCAUSE, DIALSTATUS, and QUEUESTATUS variables, h extensions, hangup handlers, the g option in Dial, and the equivalent one in Queue.

I also noticed that you are trying to access the undefined SIP header “Caller-ID”. Most standard ways of handling caller IDs are handled automatically, if you set the right options, and people should not be using custom headers that don’t begin with “X-”.

Also, you are using chan_sip, but appear to be a newbie. Newbies should not be using chan_sip, as it is unsupported, and is not included in the latest version.

I’d also question why you are even trying to set src to the destination and dst to the source, notwithstanding that you cannot set them. Normally the destination address is taken from the request URI, and becomes the initial extension. If it has to be taken from the To header, the best practice would be to use GoTo to make the dialplan run with the correct destination as the extension.

Thanks for your response, @david551 As like you said i used a custom csv format to capture the tonumber or dst and got it successfully

same = n,Set(TO_ADDR=${CUT(CUT(SIP_HEADER(TO),@,1),:,2)}) ; Extract the destination number from SIP header
same = n,Verbose(To address Value is ${TO_ADDR})
same = n,Set(CDR(tonumber)=${TO_ADDR})

but when i originate a call in command, the dialplan doesn’t proceed to execute the subsequent steps for no answer and busy so i cannot get tonumber for no answer and busy. how to set to number for no answer and busy calls also?

You need to use a local channel, if you want to catch failures on the A side of an Originate.

However, I may drop out as this is beginning to look like cold calling.