SIP device forwarding to PSTN

Hello everyone
Greetings… I need to add one function to my astpp.
I want add two things in the sip devices account.

  1. Always Forward…
    So if someone call this sip number then it will be forward to PSTN number and sip account owner will pay the bill according to the rate card.

  2. SIP not registered…
    So if the SIP is not registered then it will be forwarded to the PSTN number and sip account owner will pay the bill according to the rate card.

Which files in the /opt/ASTPP/freeswitch/
I need to work to achieve this goal.

I have added the relavant column in the sip_devices table

So for 2 function I have added 4 column.

I just need the file name to implement this feature… I can work after this

Thanks