Even the b leg cdr is enabled it only remember the final state(channel vars) on the b leg.
session:execute("bridge", dial_string1);
bridge_hangup_cause = session:getVariable("bridge_hangup_cause") or session:getVariable("originate_disposition");
if (bridge_hangup_cause == "NORMAL_TEMPORARY_FAILURE" or bridge_hangup_cause == "NO_ROUTE_DESTINATION" or bridge_hangup_cause == "CALL_REJECTED") then
freeswitch.consoleLog("notice", "Hangup. Cause: [" .. bridge_hangup_cause .. "]. Retry: "
-- database.insert('something')
session:execue("bridge", dial_string2);
if (bridge_hangup_cause == "NORMAL_TEMPORARY_FAILURE" or bridge_hangup_cause == "NO_ROUTE_DESTINATION" or bridge_hangup_cause == "CALL_REJECTED") then
session:execute("bridge", dial_string3);
.... obviously it can be done in a loop
bridge({sip_h_x_xxx=yyy}sofia/gateways/a/...|sofia/gateways/b/...|sofia/gateways/c/...
be sure to give yyy a unique value each time you call, then you can dump all the sip messages and by cross reference of the sip_h_x_xxx and call-ID you can get all the related sip messages(every INVITE will have the same sip_h_x_xxx header and each INVITE related message will have the same call-ID.