Asterisk 11.3.0 connect Oracle database issue

Hi,

I have a problem with asterisk connect to oracle database. Please look at some step for configure:

  • Install oracle instantclient:
  • oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
  • oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64.rpm
  • oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
  • Install unixODBC and unixODBC-devel

    • yum -y install unixODBC
    • yum -y install unixODBC-devel
  • Configure:

  • vi /etc/odbc.ini:
    [PRD11R1]
    Application Attributes = T
    Attributes = W
    BatchAutocommitMode = IfAllSuccessful
    BindAsFLOAT = F
    CloseCursor = F
    DisableDPM = F
    DisableMTS = T
    Driver = Oracle
    DSN = PRD11R1
    EXECSchemaOpt =
    EXECSyntax = T
    Failover = T
    FailoverDelay = 10
    FailoverRetryCount = 10
    FetchBufferSize = 64000
    ForceWCHAR = F
    Lobs = T
    Longs = T
    MetadataIdDefault = F
    QueryTimeout = T
    ResultSets = T
    ServerName = 172.16.10.17
    SQLGetData extensions = F
    Translation DLL =
    Translation Option = 0
    DisableRULEHint = T
    UserID =

  • vi /etc/odbcinst.ini
    [Oracle]
    Description = Oracle
    Driver = /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
    Setup =
    FileUsage =
    CPTimeout =
    CPReuse =

[ODBC]
Trace=Yes
TraceFile=/tmp/sql.log
ForceTrace=No
Pooling=No

  • vi /etc/asterisk/cdr_odbc.conf
    [global]
    dsn=PRD11R1
    username=asterisk
    password=asterisk
    loguniqueid=yes
    dispositionstring=yes
    table=astktb1
    ;usegmtime=no ; set to “yes” to log in GMT

  • vi /etc/asterisk/modules.conf
    load => cdr_odbc.so

  • vi /etc/asterisk/res_odbc.conf

[ENV]
ORACLE_HOME=>/var/opt/oracle
TNS_ADMIN=>/var/opt/oracle/network/admin
NLS_LANG=>AMERICAN_AMERICA.AL32UTF8
NLS_NCHAR=>AL32UTF8

[PRD11R1]
enabled=>yes
dsn=>PRD11R1
username=>asterisk
password=>asterisk
pre-connect=>yes

  • Issue log:
    ########
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:792 load_odbc_config: Adding ENV var: ORACLE_HOME=/var/opt/oracle
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:792 load_odbc_config: Adding ENV var: TNS_ADMIN=/var/opt/oracle/network/admin
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:792 load_odbc_config: Adding ENV var: NLS_LANG=AMERICAN_AMERICA.AL32UTF8
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:792 load_odbc_config: Adding ENV var: NLS_NCHAR=AL32UTF8
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:1527 odbc_obj_connect: Connecting PRD11R1
    [Feb 8 23:29:01] WARNING[6327]: res_odbc.c:1552 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Can’t open lib ‘/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1’ : fil
    [Feb 8 23:29:01] WARNING[6327]: res_odbc.c:1367 _ast_odbc_request_obj2: Failed to connect to PRD11R1
    [Feb 8 23:29:01] NOTICE[6327]: res_odbc.c:919 load_odbc_config: Registered ODBC class ‘PRD11R1’ dsn->[PRD11R1]
    – Reloading module ‘res_phoneprov.so’ (HTTP Phone Provisioning)

Please help me, how to solve the problem?

This looks like a problem outside of Asterisk, more specifically in the ODBC layer with the Oracle driver. You should try to get that working first and then Asterisk. As I’ve never dealt with Oracle under ODBC I can’t help with that part.

Thanks for your idea…I will be try to check ODBC.