> For the complete documentation index, see [llms.txt](https://tmediadocs.telcobridges.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tmediadocs.telcobridges.com/operations-and-support/troubleshooting/how-to/incoherent-cdr-during-switchover.md).

# Incoherent CDR during switchover

It is worth noting that some CDR records can be lost during transition from active to standby following a system fault. Consequently, a CDR analysis script must handle few "corner" cases:

### A "Start" CDR entry without corresponding "End" entry

This happens if a call was terminated during the switchover period.

\==> In that case, billing the call is not possible, the "End" CDR information was lost.

### A "End" CDR entry without corresponding "Start" entry

This happens if a call was answered just before the HA switchover occurred, and the CDR entry was not yet flushed to disk.

\==> In that case, billing can still be done using the "End" entry's "end time" versus "connected time" (unless connected time is 0, meaning the call was never answered)

### A call with two "End" CDR entries

This case may happen after some partial HA switchover of the Toolpack system:

* The CDR generating application (Gateway) remains alive, but looses it's connection with toolpack\_engine
* After a timeout, it destroys it's call contexts, and thus writes CDR "End" entries.
* Later, connection with toolpack\_engine is re-established, and some calls were still valid and connected
* The Gateway application re-synchronizes with these calls. These call continue normally until they're hung-up
* When hung-up, another "End" CDR entry is written

\==> In that case, billing can be done by using the "end time" of the second CDR entry, minus the "connected time" of the first CDR entry.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://tmediadocs.telcobridges.com/operations-and-support/troubleshooting/how-to/incoherent-cdr-during-switchover.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
