Saturday, January 8, 2011

Asterisk with Oracle


Note:  As I mentioned previously, this is not a step by step guide of integration of Asterisk with Oracle, I am just writing down everything which I did to make this integration work, which means some of the things I did may not be necessary i.e. there might be some extra steps I did. I didn’t have the opportunity and the time to identify which steps are exactly required. Also in this discussion, I am using absolute paths to referring to directories and files which I had on my system. You can adjust your paths accordingly or just use the ones I did, they are standard places.

Problems and Solutions:
Asterisk works with any RDBMS through ODBC. I was working on Linux CentOS 5, so I used unixODBC—an ODBC implementation for UNIX based Operating Systems. For more details see here. unixODBC (or any implementation of ODBC) needs a driver to communicate with the RDBMS e.g. in my case, I needed Oracle Driver for unixODBC that allows it to communicate with Oracle. There is one Oracle Driver available from easysoft but for this you have to purchase the license- A Problem!!!!!!

So I decided to use Oracle Instant Client with two of its packages—Basic and ODBC Supplement (see here). These two together solve my first problem of a free Oracle Driver. However, somewhere on the web (I can’t remember the link), I read that Oracle Instant Client 10g works only with specific distros of Linux and CentOS wasn’t there in the list-Another Problem!!!!

For which I opted to use Oracle Instant Client 11g—ver:11.2.0.2.0 (available here), this solves both of my problems.

As I said earlier, Asterisk needs unixODBC (an implementation of ODBC), it also needs unixODBC-devel to communicate with the RDBMS. You have to have both these packages installed on your Linux box before you make/install Asterisk if you intend to make Asterisk communicate with a RDBMS. On executing ‘yum’ command to install both these packages (yum install unixODBC unixODBC-devel), I was able to install unixODBC 2.2.11 and unixODBC-devel 2.2.11 packages. The worst thing I came to know: Oracle Instant Client does not work with unixODBC 2.2.11, it needs unixODBC > 2.2.11 and the latest available on CentOS’s repository was 2.2.11. (I also checked at Ubuntu’s Repository on another machine, it was same as CentOS)-Yet Another Problem!!!!

Okay fine!!! I decided to use unixODBC 2.3.0 available here, this fixes my problem but I didn’t find the corresponding devel package anywhere on the web (I was assuming it would be something like unixODBC -devel 2.3.0)-Problem after Problem!!!

After doing quite a lot search for some work around, I decided to go with unixODBC -devel 2.2.11 and unixODBC 2.3.0. I tried to install unixODBC -devel 2.2.11 using ‘yum’ command (yum install unixODBC -devel). This also tries to install unixODBC 2.2.11 showing there is a dependency of unixODBC -devel upon unixODBC -PROBLEMS!!!!!!!!!

Now the new task I had was to identify the dependencies of unixODBC -devel 2.2.11 upon unixODBC 2.2.11 and map them to unixODBC 2.3.0 instead of unixODBC 2.2.11. That means I was going to use unixODBC 2.3.0 and satisfy unixODBC -devel 2.2.11 from unixODBC 2.3.0 for what it needed from unixODBC 2.2.11. If there still are dependencies unresolved from unixODBC 2.3.0, I resolved them through unixODBC 2.2.11 as you see later.

Luckily, this proved to be the last problem that I had to resolve. Following discussion describes how I actually did all the above things.



 

No comments: