Why it’s correct
Yes, a is grammatically correct there.
Here's why. A person can hear the phrase reading a book in two ways:
(1) introducing a new book into the conversation, which you will refer to later;
(2) the abstract concept of “reading a book” in which the specific book is abstracted out, and cannot be referred to.
Here’s an example of (1):
I just started reading a book. The book is titled Thirty Days in the Samarkand Desert with the Duchess of Kent.
In this example, book in the second sentence refers to the book introduced in the first sentence, so it must be preceded by the.
Here’s an example of (2):
Reading a book can be very relaxing. Sometimes I read a book in the bathtub.
In this example, the first sentence does not introduce a specific book into the conversation. So, the second sentence could not refer back to it with the. The second sentence must use a.
In your example, even though you were reading a specific book, you mean the abstract sense of reading a book in both sentences. So, you must use a. (As you probably know, in English there is no way to avoid specifying which form of reference you mean when using a noun; you must commit to one, even if it’s not important, just as you must specify the tense of a verb even when time is not important.)
If you said the in the second sentence, then the meaning would be: “I picked this specific book to relieve my boredom.” That requires explanation, so you would probably continue by saying which book it was and why you thought it was a good choice for relieving boredom.
Yes, the choice of the article in the second sentence can retroactively affect the listener’s understanding of reading a book in the first sentence.
More-natural second sentences
The following might shed some more light on how to understand articles in this situation.
If you meant sense (1), referring specifically to the book in the second sentence, then it’s a little more natural to say:
When you called me, I was reading a book. You know, I was reading this/that book because I had nothing to do.
Both this and that mean the same thing here: they mean the same as the!* They both mean “the book already mentioned”. The reason a demonstrative pronoun is more natural here is because the assumes that the listener understood reading a book in the first sentence in sense (1)—an unwarranted assumption, since it’s ambiguous. Demonstrative pronouns can function as “stronger” versions of the. It’s more natural to use a demonstrative pronoun because a listener will understand it correctly even if the listener heard the first sentence in sense (2). The demonstrative pronoun can override the abstractness of sense (2).
Here’s another example of overriding the abstract sense of the indefinite article:
Lunchtime here at the elementary school is like feeding an army. And that army is ready for war!
The phrase “feeding an army” is a cliché, not to be taken literally; a listener doesn’t ordinarily hear it as introducing an army into the conversation that could be referred to later. That in the second sentence announces that, contrary to ordinary expectations, you want to continue the simile—by referring to the army. The army would still be grammatical, but would likely cause the listener a moment of disorientation—“Huh? What army?”—before understanding the playful intent.
Back to your example, if you meant sense (2), the abstract idea of reading a book with no intention to refer to the specific book, then you could also say:
When you called me, I was reading a book. You know, I was reading because I had nothing to do.
This better agrees with the abstract meaning, because you really don’t mention the book again. The second time, reading is enough to imply that you mean reading that book.
Repeating reading a book is not unnatural, though. You’d say it especially if you wanted to emphasize book-reading—as opposed to, say, reading the side of a cereal box, or reading magazines or blogs.
* Actually, this and that mean the same thing here only if the book isn’t nearby. If the book is close enough to gesture to, then (of course) this means it’s close and that means it’s further away. This distracts from the point about articles, so let’s assume that you called the person back and you’re talking on the phone.