Search code examples
pythonnetwork-programmingmodemserial-communicationlow-level

Get the phone number when someone calls


I'll describe a scenario that I want to implement but I don't know if it is possible with my equipment and my knowledge about this topic.

Suppose, that one calls me on the telephone at home. If I have an appropriate device then I can see his number on the phone device. How, could I get the phone number (using a simple modem) to the computer?

Is there any python library that could work on this ?

Could you propose me some resources from which I can learn some terminology and technical things ?

EDIT

I have found this python library https://pypi.org/project/python-gsmmodem/ but it is not related with my problem since I haven't got gsm modem and actually, I don't want to call someone from the computer. I just want to find a way for showing the caller number in the computer.


Solution

  • Several ideas and some terminology:

    • the device attached to a line is serial modem, where serial stands for a method of connection to a computer (port type)
    • you can also attach a cellular phone to a computer, term to look for is GSM modem
    • a set of low-level commands to manipulate a serial modem is called AT commands, like pick / send call
    • low-level means that you have to learn quite a bit of internals about settings, port, etc - be prepared it can be a bit of a pain. Part of the pain is that people do not use this functionslity as much, so reading documentation needs care, some things perhaps outdated.
    • there us a cloud-based service called Twilio and a high-level python library for it, that makesit easier to send/recieve calls, but parts of the service is paid, it will not help with a localline either

    Hope it is good enough for a start.

    Update: for determining the caller number you have to look for caller ID capability in your modem, similar to described here. For program to listen to the the port you wrap it in eternal loop and print the number after a call, for example.