SIP trunk registration indication to other module


I have a home gateway on this, I am running asterisk1.8. The HG has an FXS port to which my telephone is connected.

Asterisk registers itself as a trunk to a VOIP provider. When it fails, I would like the telephone to give me a busy dialtone.

How can I check when trunk registration fails in another module. Dialplan is only executed when all the numbers are dialled from my telephone and then from Dialplan I can check whether the state of the channel is unavailable or not.

I can hack in to the code as well but I would like to have a decent solution. Maybe I am missing something.


Try using the DEVICE_STATE() function.