I want to save the phone number and total talk time when just call is ended or when ringing if not received into sqlite.. I also want to save meesage when sending or receiving message

I got the phone number when receiving call but I could not save it... Can anyoone help me regarding this...