mgetty configuration entries explained:
port ttyAMA0 – specifies port name which is ttyAMA0 on RPi by default
speed 9600 – port speed, by default its 9600, as I don’t need faster connection I don’t care about the speed.
post-init-chat “” ATH0 OK ATS0=0 OK AT+CLIP=1 OK – this is an addition to default modem initialization where ATH0 hangs up all calls which may be in progress, ATS0 will disable automatic answering by the GSM modem, AT+CLIP=1 enables Caller ID so that you can choose which calls to answer and which ones not.
rings 2 – this is for mgetty to answer call after 2 rings. According to the mgetty manual, its minimum number of rings for Caller ID to work.
answer-chat “” ATH0 – this sets custom answer command, instead of usual ATA command it sends ATH0 which ends all calls. Your call will be rejected and you see on your phone that other party is BUSY. If you want to chat with your RPi and pay for the call you may want to do something differently.
cnd-program /root/command.sh – this tells mgetty to run command /root/command.sh just before answering (in this case rejecting) your call. Mgetty waits until that command is successfully finished before answering (rejecting) the call so better start something useful in background using command.sh and exit with code 0 if you want mgetty to answer (with BUSY in this case), exit with code 1 or do something else if you want phone to keep ringing.