Fix Asterisk Fatal Error Connecting to MySql

Posted: December 27, 2013 by gngtech in Uncategorized
Tags:

Our lives have become these complicated webs of dependencies, most of which is on electricity. So when the electrical grid starts acting up its like getting a punch right to the gut. You’re dazed, possibly confused a bit, and surely bent over in pain. Okay, so maybe this is a bit of a dramatic analogy, but my point is we need electricity to make all our gizmos work. Until someone can invent some way of running Asterisk without any juice it falls victim to the same whims.

Needless to say we had a power outage. It was one of those nasty brown outs where the electricity sort of works and is probably doing its damnedest to destroy your precious electronics. Once it was over our * server started up and the phones all could not connect. I hopped on to the server and found a fatal error page once again from the FreePBX web page. This time the error indicated it was from not being able to connect to MySQL. Fare enough, worse things have happened.

1) SSH to you * box.
2) Run “mysql”.
3) Observe the error about not being able to connect to mysql.sock.
4) Stop the mysql server.

Image
5) Rename the sock file.

Image
6) Start the mysql server.

Image
7) Start the asterisk server if it isn’t already running.

Image

Hopefully now when you visit the FreePBX web page it will be full of rainbows and unicorns. Oh, and your phones should now be working.

Repairing Asterisk MySql

Posted: November 15, 2013 by gngtech in Uncategorized

It’s 7 PM and your wife calls telling you the phones are acting up. Your mind starts racing going through everything you’ve dealt with in the past. Usually its easy to attribute the phones not working to something you recently messed with when you really shouldn’t have. But every once in a while it is something else entirely, maybe even something you had no control over. This so happened to us when our Trixbox server decided to corrupt one of its MySql tables, leading to all sorts of problems.

In our case visiting the Trixbox home page didn’t reveal something obvious. It was only when we tried navigating to any of our extensions to view the details that we really saw any indication of a problem. We were introduced to a poorly formatted page with SELECT statements and the ever ominous statement “Table ‘./asterisk/extensions’ is marked as crashed.” Crashed sounds like a really bad thing to happen to our extensions table. We weren’t going to let this get us down; we were going to fix this. If this happens to you, these steps may help:

1) SSH to your * box.

2) Run “mysql -u root -p”.

3) The default password for the * MySql is “passw0rd”, sorry folks that 0 is a zero.

SSH-MySql-CLI-Asterisk

4) Now pay attention to the error message because it tells you the database and table that is “crashed.” In our case it’s the asterisk database and extensions table.

5) Type “use asterisk;”. This command will switch the context of MySql to the asterisk database.

SSH-MySql-CLI-Asterisk-2

6) Type “repair table extensions;”. This command will perform the repair.

SSH-MySql-CLI-Asterisk-3

7) Type “select * from extensions;”. This will select from the table and verify the repair was effective.

8) Go try opening the extensions in the web interface.

You should be all set!

For more information on the REPAIR TABLE command take a gander over at the MySql documentation: http://dev.mysql.com/doc/refman/5.0/en/repair-table.html.

Thanks for reading.

Win a trip to space!

Posted: November 2, 2011 by grahamodaniel in Uncategorized

I was over on SqlServerCentral.com today and noticed a huge banner at the top for a contest.  The grand price: a trip to space provided by the company Space Adventures!  I haven’t entered the contest yet but figured I’d throw this on the blog in case anyone else happens to see it.

Here’s the link to the contest site: https://www.dbainspace.com/?utm_source=ssc&utm_medium=pageheader&utm_campaign=dbainspace.

Motorola Droid as SIP phone

Posted: October 31, 2011 by grahamodaniel in SIP
Tags: , ,

If you have an original Droid phone and have since moved on but still wondering what you can do with your old friend, we recently discovered a great option: use it on WiFi as a portable SIP phone around your house and office.

Motorola Droid

Motorola Droid

The Motorola Droid was originally released in 2009 to Verizon Wireless users and represented one of the first forays by Motorola into the Android smartphone segment, which has grown in popularity ever since as Motorola followed up with several more Android-powered smartphones and continues to this day.

But enough about how the Droid came to be and onward to how you can still use your dear friend.

Required Components:

  • Droid or other Android smartphone running Android 2.2 or better
  • WiFi router
  • SIP server or hosted provider
  • A free extension
  • Phone dock (optional)

The Droid shipped with Android 2.1 and has since received updates to bring it up to 2.2 officially.  However, the modding community seems to have embraced the Droid as a worthy candidate and now offers all sorts of releases for rooted phones.  A rooted phone refers to a hacked phone allowing access to otherwise inaccessible parts of the file system.  This allows for replacement of anything from the boot-up animation to the entire OS image (referred to as a ROM).  We’ve tried only two so far: Liquid Smooth and currently Miui.  Miui has proven to be a really good middle-ground between Android and iPhone interfaces, and one we surely recommend you try.  The main reason for using a new ROM is to minimize the amount of bloatware draining the battery as we want the phone to last as long as possible.

With our new OS in tow we moved on to finding a suitable SIP client.  It’s no surprise, with the Android Market growing leaps and bounds within the past few years, our quest started in the Market.  There’s actually quite a bit of SIP clients, and it appears the number of offerings increases periodicaly, both as free apps and paid-for.  The first we tried was Sipdroid and found the interface to be clunky and setup to be troublesome.  Next we tried 3CXPhone and found it was okay but didn’t seem to work reliably.  We finally settled on CSipSimple with its easy configuration and seemingly reliable performance.  CSipSimple also integrates well with the dialer so you don’t have to run the separate app just to make a SIP call.

Shiny new ROM.  Check.  Reliable client.  Check.  All engines ready to launch.  To get the phone going you need to have Asterisk or some other suitable SIP service running to which you can create extensions.  We happen to use Asterisk but there are a number of other SIP provides and servers you can purchase and/or build.  Simply go into your SIP account and configure an extension as you would any other SIP phone.  Pop the same details into the handy configuration screens in CSipSimple and it should show as registered relatively quickly.  From there you can dial your contacts or other extensions just like any other SIP phones on your nextwork.  It really is that simple.

Special thanks to the Miui team for providing an excellent OS and the CSipSimple creators for their awesome free app.

Cisco FXO as Trunk for Asterisk

Posted: January 24, 2011 by gngtech in Asterisk, Cisco, SIP
Tags: , , ,

Do you have a FXO card for your Cisco 1760, 2600, 3600?  Do you have Asterisk and want to use the FXO card as a trunk?  We answered yes to both of these questions and then spent hours trying to make it work.  Lucky for you we want to help, so here’s the quick and dirty on what we used. Read the rest of this entry »