My landline is VoIP with aaisp, so I've a small system which rejects calls with caller id starting +91
I run 'baresip' on a Raspberry Pi, and use the 'expect' scripting language
WAV file telling caller they're a spammer
baresip 1.1.0 for 32-bit Raspberry Pi as the baresip package in buster is quite old. This tarball installs in /usr/local. You should remove the distribution's baresip* packages as well as libre0 and librem0.
baresip needs to be configured with a SIP account (in ~/.baresip/accounts) making sure you have a positive regint interval (e.g. ;regint=3600)
baresip needs to play an audio file as outgoing audio. In the config file (~/.baresip/config) you do this by changing audio_source e.g.
#audio_source alsa,default audio_source aufile,"/home/pi/baresip-expect/spammer.wav"and then enabling the aufile.so module in the Audio driver Modules section.
Run baresip. Call the account number from another phone, it should tell you a call is incoming. Press 'a' to accept it, this should play the audio file to the calling phone. Press 'b' to hangup. Essentially the 'expect' script automates this if the caller id matches the naughty list.