Astersk CDR data from leg B

Hello!
I’m using cdr_adaptive_odbc module to collect RTCP data of the call to table.
More or less it looks like this:

 ...

; usual Dial

same => n,Set(CHANNEL(hangup_handler_push)=qos_leg_a,s,1)

same => n,Dial(${destinationStr},,b(set_qos_handler_b^s^1))
...

[qos_leg_a]
exten => s,1,Noop(Channel: ${CHANNEL(name)}, QoS stats RTCP: ${CHANNEL(rtcp,all)})
    same => n,Set(CDR(sip_callid)=${CHANNEL(pjsip,call-id)})
    same => n,GotoIf($["${CHANNEL(rtcp,all)}"==""]?end)
    same => n,Set(CDR(rtcp_a_all)=${CHANNEL(rtcp,all)})
    same => n,Set(CDR(rtcp_a_all_jitter)=${CHANNEL(rtcp,all_jitter)})
    same => n,Set(CDR(rtcp_a_all_loss)=${CHANNEL(rtcp,all_loss)})
    same => n,Set(CDR(rtcp_a_all_rtt)=${CHANNEL(rtcp,all_rtt)})
    same => n(end),Return()

[qos_leg_b]
exten => s,1,Noop(Channel: ${CHANNEL(name)}, QoS stats RTCP: ${CHANNEL(rtcp,all)})
    same => n,GotoIf($["${CHANNEL(rtcp,all)}"==""]?end)
    same => n,Set(CDR(rtcp_b_all)=${CHANNEL(rtcp,all)})
    same => n,Set(CDR(rtcp_b_all_jitter)=${CHANNEL(rtcp,all_jitter)})
    same => n,Set(CDR(rtcp_b_all_loss)=${CHANNEL(rtcp,all_loss)})
    same => n,Set(CDR(rtcp_b_all_rtt)=${CHANNEL(rtcp,all_rtt)})
    same => n(end),Return()

[set_qos_handler_b]

exten => s,1,Set(CHANNEL(hangup_handler_push)=qos_leg_b,s,1)
    same => n,Return()

It works like a charm if you have in ${destinationStr} something like PJSIP/${EXTEN}. But when it’s a complex string, like PJSIP/${EXTEN}&Local/whatever@else I see commands are running on a legB, but no CDR extra data is being written to the table. For A leg it’s all fine, but not for B. It’s just setting NULL for all legB data, although I can see in the dialplan variables are set.

What hints are possible here to get this info in database without additional external scripting (which is possible, but adding extra layer)?

1 Like

Did you notice any difference between answering by Local channel and PJSIP using PJSIP/${EXTEN}&Local/whatever@else ?

Actually for me Local/whatever@else is never answering. It consists only on one NoOp(), but it’s needed for some other tricks (2-stage early-media, I described here).
So it’s always PJSIP/${EXTEN} is answering.

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