Now Asterisk:
Having installed unixODBC and unixODBC-devel, I download Asterisk and installed it.
./configure
make or make menuselect
make install
Before changing the conf files, I created a table called ‘sip_buddies’ in my database, schema can be found here, I had to make some changes in the schema according to my database. I was planning to test peer registration from database.
On Asterisk, I was interested in dynamic mode of Asterisk Realtime Arcitecture (ARA), based on that, I had to change the following conf files:
/etc/asterisk/modules.conf
/etc/asterisk/res_odbc.conf
/etc/asterisk/extconfig.conf
In modules.conf, I uncommented following two lines:
preload => res_odbc.so
preload => res_config_odbc.so
In res_odbc.conf, I added following context:
[asterisk_oracle]
enabled => yes
dsn => OracleODBC-11g ; the context added to odbc.ini
;username => testdb ;already provided in odbc.ini , may be provided here too
;password => testdb ;already provided in odbc.ini, may be provided here too
pooling => no
limit => 0
pre-connect => yes
Like username and password, there are other parameters in odbc.ini which may be overridden here in this file, as has been mentioned at the above link.
Finally, I changed the extconfig.conf and added the following line:
sippeers => odbc, asterisk_oracle, sip_buddies
‘asterisk_oracle’ is the database as I created in res_odbc.conf. sip_buddies was the table in my database where peers resided.
After running asterisk, I executed following command on CLI
odbc show
The output showed that I was connected to OracleODBC-11g.
Note: I had a little problem here while registering the peer with following output:
chan_sip.c:20603 handle_request_register: Registration from…….. failed for…….. - No
matching peer found.
matching peer found.
It was fixed by populating the ‘defaultip’ field of my table sip_buddies, a null value in this field was creating the problem. This problem has been discussed with a patch that is available here. I hope the future release of Asterisk would have it fixed or you can do it yourself from above link by changing the source.
It’s all worth it. I was successfully able to register my peers without a reload. Everything I did was working fine especially about unixODBC-devel which seemed like a nightmare!!!!!!
You can do more things with this, I hope this long post (splited into four parts) is helpful to all you guys who dealing with the same issue. Let me know, if it is useful for you.