The time has come once again to share something that took me hours to fix. Most of the random projects I work on are really only useful to me when I finally have a breakthrough, but on rare occasion I do something that many boredom warriors have attempted, but been left with unanswered threads and no hope in sight. This is one of those occasions. I like to pay it forward in hopes that eventually this will help someone, somewhere in the future.
The project? Hook a Cisco IP phone to a sip trunk. I decided I really don’t need a PBX, so I found a service where I can completely control a call to a few phones instead of putting together my enterprise PBX solution I was planning (by enterprise I mean I set up a Raspberry Pi as a PBX and intended to use that). There was no reason I needed that much functionality (although, I could get any of the PBX functionality from this service, but that will come later). I decided I only really needed to receive and send calls from the IP phone. Plivo, a wonderful service with very fair rates, offers the ability to use any IP phone as a sip endpoint. The issue is that Cisco phones are notorious for having a bajillion unknown options, especially on these older models that are non-XML and have no web interface. Also, I found Plivo to not be the most user friendly to someone who does not know the process. Its much easier, once you get the hang of all their terms, but before then it can be pretty confusing (however their support is PHENOMENAL!, they answered my question when I was having trouble and just left me to figure out how to configure the phone).
So, onto what brought you here. Surely, it was a Google search for Plivo and Cisco, or Plivo and SIP, or Cisco 79XX SIP configuration, you get the point, because you are here. How do we configure this phone, step-by-step to use the service? I have donated my time to make you a nice little guide.
I’m going to assume you have some things. These things are: A Plivo account (there’s a free trial if you want to check it out. Plivo.com), almost all of this information should also work for similar services like Twilio; A Cisco IP Phone in the 7940, 7941, 7960, 7961 range; SIP firmware for the 79XX phones version P0S3-8-12-00, the firmware file itself will be called P003-8-12-00.bin, but you will also need P003-8-12-00.sbn, P0S3-8-12-00.loads, P0S3-8-12-00.sb2, OS79XX.txt that should come with the firmware. (legally this has to be licensed from Cisco… Do what you want with that information).
Step 1: Set up your Plivo account to accept the SIP connection. There will be 3 sub-steps to this process.
- A: Create a SIP endpoint. Make sure the Application is set to DirectDial, the rest can be whatever you want it to be. Like your dreams. Which are gone. They think it’s weird you still call.
- B: Create or modify the existing “Call Forward” app. Mine isn’t really an app, it is just a 5 line XML file. Yes, it is really that easy. Change the callerId value to whatever you want your caller ID to come up as when you get called (this should really be the caller’s callerID, but that would require an app instead of a simple XML file, which is way out of the scope of this article). Change User to whatever the SIP was in your endpoints (hint: Plivo took your Username and added a bunch of numbers to it). You can copy and paste this from the endpoints page (press the little plus by your endpoint to see the whole address). Anyway, save the 5 lines below in a file with a .xml extension and host it online somewhere. I put mine in the public folder of my dropbox then copied the public link. After you do that point your app to the XML file on the apps page. Edit or create an application and put the link to your XML file in the “Answer url” box. Make sure answer method is GET.
<Response> <Dial callerId="18001234567"> <User>sip:Cis0123456789@phone.plivo.com</User> </Dial> </Response>
- C: Finally, point your Plivo number to your call forward app. If you don’t have a Plivo number then buy one. They are like $0.80 a month.
Now I guess is a good time to explain what all of that did. A SIP endpoint is an address Plivo will use to send SIP data. Later your phone will connect to Plivo and tell them “Hey, I am this endpoint, send things to me! or I’ll send you things, like my user’s voice!”. We don’t need an endpoint to forward a call to a cell phone (which you would do by replace the <user>sip:blablabla</user> with <number>18001234567</number>) because a cell phone is a physical number and not a SIP device. You will need an endpoint for every SIP device (or just 1 for your PBX if you are doing that sort of thing).
The Call Forward app is taking a call and sending it somewhere else, either to a SIP endpoint, another app, or a physical phone number (for physical phone number see above paragraph for how to change your XML). In our case, we are sending it to our Cisco phone SIP endpoint, which we will tie to our phone later. The Direct Dial app works very similiar. It takes a call and sends it to a number. Instead of just an XML file, the direct dial app actually has logic hosted somewhere (herokuapp) and will take the number dialed from the SIP endpoint when you call out and place a call to it. It will then connect that call with your endpoint. Use direct dial to call someone (that is why your end point forwards to it. When you dial a number Plivo knows that if it comes from that endpoint that it should go to direct dial). Also, you should look in the settings for Direct Dial and modify the url CallerID value to what you want to show up on the person you are calling’s phone.
Finally, pointing your number at the Call Forward app tells Plivo that when a call comes in on that number, the Call Forward app should handle it. Your Call Forward XML file will then be looked at and it will see that the incoming call should be sent to your SIP endpoint (which will eventually be line 1 of your IP Phone).
Wow, that was a whole lot of text for the easy part of this project. Setting up Plivo is a breeze once you know what an endpoint is and how the built in apps work. Making your own app gives you pretty limitless possibilities, but right now we can pretty much only dial out and receive calls to an endpoint that isn’t actually attached to anything until later.