I am a phone engineer, sorry to be a downer, but this is absolutely terrible, you cannot do this. An Arduino would be a circuit switched telephone device - something invented in the 1950s, why would you re-invent a device of the 1950s?? 20 years ago everything switched to "packet switched". Phone lines typically go from 48-90 volts when going from onhook to ringing - an Arduino is a poor device for this.
If the Panasonic is not doing what you need dump it in the garbage, you cannot take a 1950s Chevrolet and convert it to a hybrid, forget about old technology and buy something current. Build yourself an Asterisk phone system, it can work with Voip, analog, or digital. You can build a high quality $10,000 enterprise grade phone system for under $1,500 easily.
What you need to do:
Either get VoIP service and quality internet, high speed is not important, low latency is important, and a router that can give QOS priority to Voip, or if that is not an option, convert your analog trunks to VoIP inside your office using an ATA device such as Obitalk.
Get a computer of proper server grade, something like a Dell R410 or R420 Server with H7xx RAID card, they are around $300 on ebay, does not need huge memory or CPU, 4GB RAM and a slow Xeon are fine, a small 64gb SSD, ideally 2 SSD mirrored (phone service is usually important), these also come with dual power supplies, so it could be more reliable than your panasonic if you do it right - dont try to build something less reliable, people will be mad. Install FreePBX Distro. Get Aastra 55i or Polycom 550 phones, they are very affordable used. FreePBX will allow you to easily setup automated messages and menus, music on hold using mp3s (no external music box needed), and as many voicemail boxes as you desire.
To convert up to 4 analog trunks (from phone the company), use a OBi544vs it will handle 4 trunk lines, and 4 analog extensions, use the extensions to handle things like gate opener, paging or a cordless phone. Some gate openers are designed for trunk side connection, check the current Panasonic wiring to know which side it wants - trunk or extension. Existing paging should plug right in to this also, if you dont have paging, use UAP-AC-EDU Voip paging speakers/AP. The rest of your extensions should be proper voip phones like Polycom.
This system can be programmed and customized to do ANYTHING you can imagine, if you want to use it to control relays, there are devices from Cyberdata, and others, or you can use analog extensions and products from Valcom or Viking for telephone relay control, or if you wanted to attempt Arduino integration, this is something worthy of it.
If you dont know much about computers, you could easily find someone to help you source/prep a standard server grade machine, ask them to burn the install CD and load it up, takes 5 minutes, once up and running find a VoIP engineer that knows Asterisk, posting on the FreePBX forums is a great start to see if anyone is interested in remoting in and setting it up, or there are tons of options near India.