0

I am supposed to be implementing a backend Microsoft SQL connection from our Asterisk SIP server for CDR reports. Disclosure: I am a rookie with Asterisk, I am unfamiliar how it was originally setup, and I have limited experience in a Linux(CentOS) environment.

I have been following the link here: http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/installing_configuring_odbc.html

I have the FreeTDS drivers installed and have verified they are visible with the command:

]# odbcinst -q -d
[FreeTDS]

Inside /etc/odbc.ini I have the following defined connector:

[asterisk-connector]
Description = MSSQL connection to 'asterisk' database
Driver = FreeTDS
Database = Asterisk
Address = x.x.x.x
Port = 52199
UserName = <username here>
Password = <password here>
Trace = No
TDS_Version = 7.0

The step after that is to verify that you can connect to the database with the specified connector with the 'isql' command... However, when I just type in "isql -v asterisk-connector" I receive the error:

]# isql -v asterisk-connector
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[28000][unixODBC][FreeTDS][SQL Server]Login incorrect.
[][unixODBC][FreeTDS][SQL Server]Login failed for user ''. The user is not associated with a trusted SQL Server connection.
[ISQL]ERROR: Could not SQLConnect

When I enter in the command and specify the username and password at command line, it is able to connect!

]# isql -v asterisk-connector <username here> <password here>
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

My question: Why will it not pick up my username and password defined in odbc.ini?

Furthermore, the step after that is to recompile the asterisk source files, but there are no source files for Asterisk 1.8 on the server. Like I mentioned before, I do not know how Asterisk was originally installed and setup on this server.

Is there a way I can get source files for Asterisk and recompile them to work with what is already installed and running? If yes, would it erase everything that is currently defined in our phone system such as extensions, ring groups, IVRs, etc.?

Any help would be greatly appreciated! If you need additional information, please let me know and I can retrieve it. I didn't know how much info would be required for this.

ShaneC
  • 27
  • 1
  • 8

1 Answers1

0

Freetds driver work just ok with mssql

But you have note, that it have DIFFERENT driver mode for different mssql versions(see freetds.conf)

Asterisk also work ok with mssql, i did that twice.

You can use this one article

https://technet.microsoft.com/en-us/library/hh568454%28v=sql.110%29.aspx

Usefull option is trace file.

Most likly you need use UID instead of username or something like that.

Note, asterisk also have username&password in res_config_odbc.conf file. So you can try use that(and check trace after use)

Recompilation will not affect any of your settings unless you do "make samples" or not compile needed modules.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • I have tried changing the "UserName" field to: USER, Userid, UID... None of these have worked as well. I do not have the res_config_odbc.conf or cdr_odbc.conf or any other related files in the Asterisk folder. Apparently I need to recompile for these to be populated, but I have no source files to recompile. Can I simply download Asterisk 1.8.20 (this is the version running), and compile it? How does this work? – ShaneC Feb 17 '15 at 20:44
  • you need asterisk module res_odbc.so for use odbc in your asterisk. Yes, you also need config for that module. Otherwise how you think asterisk will select odbc.ini section? – arheops Feb 18 '15 at 01:06