when it works I get a dial tone, and then when it's not working, the phone light on the spa112 comes on flashing but there is no dial tone at all and if I dial my number from my mobile it says that the number is not available.
I assume you are using most recent firmware.
Have you (outgoing) proxy configured using IP address, or you are using DNS name here ?
It seems your's SPA112 is not registered.
Turn on syslog&debug in Voice application and capture them. Also, capture of SIP packets may help.
This is kernel log of SPA112. You hav eno issue with kernel but with Voice application running on it, thus this log have little value for us.
We need syslog and debug from Voice application. Read Debug and syslog Messages from SPA1x2 and SPA232D ATA for instructions.
Once it happen try to capture SIP packets between it and proxy. I wish to see ATA's REGISTER request and proxy's response to it.
If there's a NAT between ATA and proxy then disclose NAT Settings of ATA and configured value of Register Expires option.