Use data from mysql server.

Discussion in 'General' started by simulatorhck, Jan 9, 2011.

  1. simulatorhck

    Joined:
    Jan 9, 2011
    Messages:
    17
    Likes Received:
    0
    Hi all
    I'm looking for some help for my pbx.
    I'd like to use elastix with a remote db that contains some data about my customers orders (status of the order, tracking number etc).
    I'm triyng to connect asterisk with mysql odbc
    I read some manuals and now I can connect from shell using for example
    isql -v asterisk-connector an I get

    +---------------------------------------+
    | Connected! |
    | |
    | sql-statement |
    | help [tablename] |
    | quit |
    | |
    +---------------------------------------+
    SQL>

    if i write in asterisk shell
    odbc show, I get
    odbc show

    ODBC DSN Settings
    -----------------

    Pbx*CLI>

    I set up /etc/asterisk/res_odbc.conf like this

    ;;; odbc setup file

    ; ENV is a global set of environmental variables that will get set.
    ; Note that all environmental variables can be seen by all connections,
    ; so you can't have different values for different connections.
    [ENV]
    ;INFORMIXSERVER => my_special_database
    ;INFORMIXDIR => /opt/informix
    ;ORACLE_HOME => /home/oracle

    ; All other sections are arbitrary names for database connections.

    dsn => asterisk-connector
    ;username => test
    ;password => test
    pre-connect => yes
    pooling => no
    limit => 0
    ;
    ; What should we execute to ensure that our connection is still alive? The
    ; statement should return a non-zero value in the first field of its first
    ; record. The default is "select 1".
    ;sanitysql => select 1


    [mysql2]
    enabled => no
    dsn => asterisk-connector

    username => test
    password => test
    pre-connect => yes
    pooling => no
    limit => 0
    ;
    ; On some databases, the connection times out and a reconnection will be
    ; necessary. This setting configures the amount of time a connection
    ; may sit idle (in seconds) before a reconnection will be attempted.
    ;idlecheck => 3600

    ; Certain servers, such as MS SQL Server and Sybase use the TDS protocol, which
    ; limits the number of active queries per connection to 1. By telling res_odbc
    ; not to share connections, Asterisk can be made to work with these servers.
    [sqlserver]
    enabled => no
    dsn => mickeysoft
    share_connections => no
    limit => 5
    username => oscar
    password => thegrouch
    pre-connect => yes
    sanitysql => select count(*) from systables
    ; forcecommit => no ; Default to committing uncommitted transactions?
    ; Note: this is NOT the autocommit flag; this
    ; determines the end result of transactions which
    ; are not explicitly committed or rolled back. By
    ; default, such transactions are rolled back if the
    ; call ends without an explicit commit.
    ; isolation => read_committed ; Isolation level; supported levels are:
    ; read_uncommitted, read_committed, repeatable_read,
    ; serializable. Note that not all databases support
    ; all isolation levels (e.g. Postgres only supports
    ; repeatable_read and serializable). See database
    ; documentation for further information.
    ;
    ; Many databases have a default of '\' to escape special characters. MS SQL
    ; Server does not.
    backslash_is_escape => no


    Where is the problem?
    How can i use the data from the db?
    Thanks a lot
     

Share This Page