While running tests on the design up to this point several un-expected results occurred. It seems that the program got out of program once the power was cycled to the base, and sometimes the phone would power off during a conversation. This is why testing is done to work out any hidden bugs.
A basic software error occurred when I put a "goto Start", when the program exited the 1 minute delay and restored the base power. The program is an infinite loop until you put a goto at the end that normally loops back to the beginning. I also shortened the delay from 5 seconds to 3 seconds between the ON hook, and Audio samples.
I made changes to the AUDIO detector that rapidly charged the capacitor, increased the discharge time, eliminated the zener diode from restricting the high level, added a 330 ohm resistor and used the internal input diodes on the Analog input to limit the high level to + 5.7 volts. The Resistor x Capacitor ( T=1 RC ) time is now 220 K ohm x 10 ufd = 2.2 seconds for one time constant. Since it takes 5 time constants to charge and discharge the time for discharge is 2.2 seconds x 5 = 11.0 seconds. The sample rate is now 3 seconds between samples. Also the charge has no limiting resistance and should be fast. Also the design change has raised the DC voltage to around .5 volts with some spikes at approx 1.5 volts with normal audio. The noise on the phone line after "If you would like to make a call, please hang up and try again", does not get detected and decays to DC a level below .025 volts. The program looks for a DC level greater than or equal to .03 volts as audio present. To do this the Analog input is looking for a binary number 7 or higher. How I arrived at that number is the Analog reference voltage is +5.0 volts I usually represent it as 4.999 volts then divide by 1023 to arrive at = .0048866 per 1 unit bit x 7 =.0342. So a binary number equal to 7 up to 1023 is in the audio voltage range. The program is only concerned with the level between 0 and 6 for being NO audio present.
I made changes to the ON HOOK detector to lower the current draw from the phone line as some calls did not ring thru during testing. I changed the 10 K ohm series resistor on the opto LED to 20 K ohm. I expected the opto output transistor ON voltage drop to rise from its near 0 volts, it did rise to 3 volts. I replaced the MCT2E opto isolator with a darlington transistor in the output, by installing a 4N33 opto isolator. The output transistor on voltage is now .6 volts, still in the range for a low logic level. If I need to lower the opto LED current draw more, I should be able to do so.
I also installed a .1 ufd capacitor across the ATTiny 85 power supply pins.
I also supplied the Relay power thru a series 1N4002 diode and on the Relay coil side I also installed a 470 ufd capacitor from the Relay coil high side and ground. This should isolate the ATtiny 85 from any supply drops as the Relay is energized. Once the Relay has pulled in, the hold current draw should be less due to the voltage drop across the series diode.