Wrong DID in CDR

There is a wrong DID in the CDR when getting DID from “TO”-Header.
It’s a SIP-Trunk.

You set the CDR(did) too early.
You first set DID=XXXXXX9380
but the real DID is: DID=XXXXXX93813 because it is in the TO-Header.

Idea for a fix: please set CDR(did) later.
This problem might be for other headers as well.

Everything is fine with the call but den CDR(DID) is wrong.

Thank you.

    -- Executing [XXXXXX9380@trk-4-in:1] NoOp("SIP/XXXXXX9380-0000031c", "Incoming call through: XXXXXX9380") in new stack
    -- Executing [XXXXXX9380@trk-4-in:2] Set("SIP/XXXXXX9380-0000031c", "__TRUNK_ID=4") in new stack
    -- Executing [XXXXXX9380@trk-4-in:3] Set("SIP/XXXXXX9380-0000031c", "CDR(trunk)=4") in new stack
    -- Executing [XXXXXX9380@trk-4-in:4] Set("SIP/XXXXXX9380-0000031c", "__DID_NUMBER=XXXXXX9380") in new stack
    -- Executing [XXXXXX9380@trk-4-in:5] Set("SIP/XXXXXX9380-0000031c", "CDR(did)=XXXXXX9380") in new stack
    -- Executing [XXXXXX9380@trk-4-in:6] Set("SIP/XXXXXX9380-0000031c", "DID=XXXXXX9380") in new stack
    -- Executing [XXXXXX9380@trk-4-in:7] NoOp("SIP/XXXXXX9380-0000031c", "Build DID from headers") in new stack
    -- Executing [XXXXXX9380@trk-4-in:8] GotoIf("SIP/XXXXXX9380-0000031c", "1?:did_from_pjsip_channel") in new stack
    -- Executing [XXXXXX9380@trk-4-in:9] Set("SIP/XXXXXX9380-0000031c", "PSEUDODID=<sip:XXXXXX93813@XX.XXX.127.166:5060;user=phone>") in new stack
    -- Executing [XXXXXX9380@trk-4-in:10] Goto("SIP/XXXXXX9380-0000031c", "build_did") in new stack
    -- Goto (trk-4-in,XXXXXX9380,12)
    -- Executing [XXXXXX9380@trk-4-in:12] NoOp("SIP/XXXXXX9380-0000031c", "Start building the DID from To header") in new stack
    -- Executing [XXXXXX9380@trk-4-in:13] Set("SIP/XXXXXX9380-0000031c", "SIPURI=XXXXXX93813@XX.XXX.127.166") in new stack
    -- Executing [XXXXXX9380@trk-4-in:14] Set("SIP/XXXXXX9380-0000031c", "DID=XXXXXX93813") in new stack
    -- Executing [XXXXXX9380@trk-4-in:15] Goto("SIP/XXXXXX9380-0000031c", "default-trunk,XXXXXX93813,1") in new stack

Would be nice to get at least a very short feedback on every issue posted.

Thank you.

Bump.
Any news on this?
Thx

Have you tried this in the latest version?

Yes, 3.1.5-1 same problem. Just tested it again.
And i have found nothing regarding this in the changelog.

@mo10 it looks like they fixed it in 3.1.5-2

exten => _[+*#0-9A-Za-z].,1,NoOp(Incoming call through: Trunk)
 same => n,Set(__TRUNK_ID=3)
 same => n,Set(CDR(trunk)=3)
 same => n,Set(__DID_NUMBER=${EXTEN})
 same => n,Set(CDR(did)=${EXTEN})
 same => n,Set(DID=${EXTEN})
 same => n,NoOp(Build DID from headers)
 same => n,GotoIf($["${CHANNEL(channeltype)}"="SIP"]?:did_from_pjsip_channel)
 same => n,Set(PSEUDODID=${SIP_HEADER(To)})
 same => n,Goto(build_did)
 same => n(did_from_pjsip_channel),Set(PSEUDODID=${PJSIP_HEADER(read,To)})
 same => n(build_did),NoOp(Start building the DID from To header)
 same => n,Set(SIPURI=${CUT(PSEUDODID,:,2)})
 same => n,Set(DID=${CUT(SIPURI,@,1)})
 same => n,Set(CDR(did)=${DID})
 same => n,Goto(default-trunk,${DID},1)
2 Likes

@EINM thanks a lot for letting me know.
I did not know there is a version -2 already and there is nothing in the changelog about it.

I will have to check it out soon.

Sadly, it’s not working. Just checked it again.

Do you not have the same => n,Set(CDR(did)=${DID}) at line 15, or is it there but still not updating the CDR?

It is there in line 15 but it does not help.

Here is a sip trace again with latest Version 3.1.5 -2:

 -- Executing [XXXXXX80@trk-4-in:1] NoOp("SIP/XX_XXXXXX80-00000004", "Incoming call through: XXXXXX80") in new stack
    -- Executing [XXXXXX80@trk-4-in:2] Set("SIP/XX_XXXXXX80-00000004", "__TRUNK_ID=4") in new stack
    -- Executing [XXXXXX80@trk-4-in:3] Set("SIP/XX_XXXXXX80-00000004", "CDR(trunk)=4") in new stack
    -- Executing [XXXXXX80@trk-4-in:4] Set("SIP/XX_XXXXXX80-00000004", "__DID_NUMBER=XXXXXX80") in new stack
    -- Executing [XXXXXX80@trk-4-in:5] Set("SIP/XX_XXXXXX80-00000004", "CDR(did)=XXXXXX80") in new stack
    -- Executing [XXXXXX80@trk-4-in:6] Set("SIP/XX_XXXXXX80-00000004", "DID=XXXXXX80") in new stack
    -- Executing [XXXXXX80@trk-4-in:7] NoOp("SIP/XX_XXXXXX80-00000004", "Build DID from headers") in new stack
    -- Executing [XXXXXX80@trk-4-in:8] GotoIf("SIP/XX_XXXXXX80-00000004", "1?:did_from_pjsip_channel") in new stack
    -- Executing [XXXXXX80@trk-4-in:9] Set("SIP/XX_XXXXXX80-00000004", "PSEUDODID=<sip:XXXXXX809@YY.YYY.YYY.166:5060;user=phone>") in new stack
    -- Executing [XXXXXX80@trk-4-in:10] Goto("SIP/XX_XXXXXX80-00000004", "build_did") in new stack
    -- Goto (trk-4-in,XXXXXX80,12)
    -- Executing [XXXXXX80@trk-4-in:12] NoOp("SIP/XX_XXXXXX80-00000004", "Start building the DID from To header") in new stack
    -- Executing [XXXXXX80@trk-4-in:13] Set("SIP/XX_XXXXXX80-00000004", "SIPURI=XXXXXX809@YY.YYY.YYY.166") in new stack
    -- Executing [XXXXXX80@trk-4-in:14] Set("SIP/XX_XXXXXX80-00000004", "DID=XXXXXX809") in new stack
    -- Executing [XXXXXX80@trk-4-in:15] Set("SIP/XX_XXXXXX80-00000004", "CDR(did)=XXXXXX809") in new stack
    -- Executing [XXXXXX80@trk-4-in:16] Goto("SIP/XX_XXXXXX80-00000004", "default-trunk,XXXXXX809,1") in new stack
    -- Goto (default-trunk,XXXXXX809,1)

So you are right but i guess another problem is here:

[s@sub-set-call-vars:11] Set("SIP/XX_XXXXXX80-00000004", "CDR(did)=XXXXXX80") in new stack

extensions__20-baseplan.conf

[sub-set-call-vars]
exten => s,1,NoOp(Setting Call Vars)
 same => n,Set(_TENANT=${ARG1})
 same => n,Set(_CALL_DESTINATION=${ARG2})
 same => n,Set(_COS_ID=${ARG3})
 same => n,Set(_COS_NAME=${ARG4})
 same => n,Set(__TRANSFER_CONTEXT=${COS_NAME})
 same => n,Set(_ARS=${ARG5})
 same => n,Set(CDR(tenant)=${DB(${TENANT}/name)})
 same => n,Set(CDR(destination)=${CALL_DESTINATION})
 same => n,Set(CDR(trunk)=${TRUNK_ID})
 same => n,Set(CDR(did)=${DID_NUMBER})
 same => n,Set(__CALLID=${UNIQUEID})
 same => n,ExecIf($["${LEN(${INBOUND_LANGUAGE})}"!="0"]?Set(CHANNEL(language)=${INBOUND_LANGUAGE}))
 same => n,ExecIf($[$["${LEN(${DIVERSION_ORIGIN})}"!="0"]&$["${LEN(${INBOUND_LANGUAGE})}"="0"]]?Set(CHA$
 same => n,Return()


So this is the issue in extensions__50-1-dialplan.conf:

same => n,Set(__DID_NUMBER=${EXTEN})

Set too early again or needs to be set later again:
same => n,Set(__DID_NUMBER=${DID})

@miguel could you please fix it? I guess we finally found it all. Thanks

We have addressed this issue on VitalPBX 3.1.5 R4

1 Like

Perfect, working now. Thanks.