There are two more pitfalls on this way:
1. Callsigns from ADS-B data and flight numbers from database are not always identical. Currently it is nearly identical for flight number LH839 and callsign DLH839, but not for flight LH2285 and callsign DLH6AC.
2. If the flight number belongs to a codeshare flight, even the operator ID may differ between database entry and callsign.
Flightaware offers an API, where the first 500 calls/month are for free. It may help to identifiy codeshare flights and to get the time window for a certain flight.