diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp index 31554b1f..4c3de52a 100644 --- a/apps/conference/Conference.cpp +++ b/apps/conference/Conference.cpp @@ -2,6 +2,7 @@ * $Id$ * * Copyright (C) 2002-2003 Fhg Fokus + * Copyright (C) 2007 Juha Heinanen (USE_MYSQL parts) * * This file is part of sems, a free SIP media server. * @@ -74,11 +75,11 @@ int get_audio_file(string message, string domain, string language, if (language.empty()) { if (domain.empty()) { *audio_file = string("/tmp/") + APP_NAME + "_" + message + ".wav"; - query_string = "select audio from " + string(DEFAULT_AUDIO_TABLE) + " where application='" + APP_NAME + "' and message='" + message + "' and language is null"; + query_string = "select audio from " + string(DEFAULT_AUDIO_TABLE) + " where application='" + APP_NAME + "' and message='" + message + "' and language=''"; } else { *audio_file = "/tmp/" + domain + "_" + APP_NAME + "_" + message + ".wav"; - query_string = "select audio from " + string(DOMAIN_AUDIO_TABLE) + " where application='" + APP_NAME + "' and message='" + message + "' and domain='" + domain + "' and language is null"; + query_string = "select audio from " + string(DOMAIN_AUDIO_TABLE) + " where application='" + APP_NAME + "' and message='" + message + "' and domain='" + domain + "' and language=''"; } } else { if (domain.empty()) { diff --git a/apps/voicemail/AnswerMachine.cpp b/apps/voicemail/AnswerMachine.cpp index 9376ff29..1ee7f757 100644 --- a/apps/voicemail/AnswerMachine.cpp +++ b/apps/voicemail/AnswerMachine.cpp @@ -93,11 +93,11 @@ int get_audio_file(string message, string domain, string user, if (domain.empty()) { *audio_file = string("/tmp/") + MOD_NAME + "_" + message + ".wav"; - query_string = "select audio from " + string(DEFAULT_AUDIO_TABLE) + " where application='" + MOD_NAME + "' and message='" + message + "' and language is null"; + query_string = "select audio from " + string(DEFAULT_AUDIO_TABLE) + " where application='" + MOD_NAME + "' and message='" + message + "' and language=''"; } else { *audio_file = string("/tmp/") + domain + "_" + MOD_NAME + "_" + message + ".wav"; - query_string = "select audio from " + string(DOMAIN_AUDIO_TABLE) + " where application='" + MOD_NAME + "' and message='" + message + "' and domain='" + domain + "' and language is null"; + query_string = "select audio from " + string(DOMAIN_AUDIO_TABLE) + " where application='" + MOD_NAME + "' and message='" + message + "' and domain='" + domain + "' and language=''"; } } else { if (domain.empty()) { @@ -175,7 +175,7 @@ int AnswerMachineFactory::loadEmailTemplatesFromMySQL() unsigned long length = row["template"].size(); string tmp_file, tmpl_name; row = res.at(i); - if (string(row["language"]) == "NULL") { + if (string(row["language"]) == "") { tmp_file = "/tmp/voicemail_email.template"; tmpl_name = DEFAULT_MAIL_TMPL; } else { @@ -217,7 +217,7 @@ int AnswerMachineFactory::loadEmailTemplatesFromMySQL() unsigned long length = row["template"].size(); string tmp_file, tmpl_name; row = res.at(i); - if (string(row["language"]) == "NULL") { + if (string(row["language"]) == "") { tmp_file = "/tmp/" + string(row["domain"]) + "_voicemail_email.template"; tmpl_name = string(row["domain"]); diff --git a/doc/Readme.conference b/doc/Readme.conference index 83389ec7..ac74456f 100644 --- a/doc/Readme.conference +++ b/doc/Readme.conference @@ -73,7 +73,7 @@ CREATE TABLE default_audio ( id int(10) unsigned NOT NULL auto_increment, application varchar(32) NOT NULL, message varchar(32) NOT NULL, - `language` char(2) default NULL, + `language` char(2) NOT NULL default '', audio mediumblob NOT NULL, PRIMARY KEY (id), UNIQUE KEY application (application,message,`language`) @@ -84,7 +84,7 @@ CREATE TABLE domain_audio ( application varchar(32) NOT NULL, message varchar(32) NOT NULL, domain varchar(128) NOT NULL, - `language` char(2) default NULL, + `language` char(2) NOT NULL default '', audio mediumblob NOT NULL, PRIMARY KEY (id), UNIQUE KEY application (application,message,domain,`language`) @@ -92,7 +92,8 @@ CREATE TABLE domain_audio ( The first one stores default audio files and the latter domain specific audio files. Application value must be 'conference' and message values -are 'first_participant_msg', 'join_snd', and 'drop_snd'. +are 'first_participant_msg', 'join_snd', and 'drop_snd'. Language value +is a two letter code of a language or '' if language is unknown. When an audio file is fetched from database, it is stored in /tmp directory. diff --git a/doc/Readme.voicemail b/doc/Readme.voicemail index 98846a7f..d01da0cd 100644 --- a/doc/Readme.voicemail +++ b/doc/Readme.voicemail @@ -127,7 +127,7 @@ CREATE TABLE domain_template ( application varchar(32) NOT NULL, message varchar(32) NOT NULL, domain varchar(128) NOT NULL, - `language` char(2) default NULL, + `language` char(2) NOT NULL default '', template text NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -136,12 +136,14 @@ CREATE TABLE default_template ( id int(10) unsigned NOT NULL auto_increment, application varchar(32) NOT NULL, message varchar(32) NOT NULL, - `language` char(2) default NULL, + `language` char(2) NOT NULL default '', template text NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Application value is 'voicemail' and message value is 'email_tmpl'. +Language value is a two letter code of a language or '' if language is +unknown. When an audio file is fetched from database, it is stored in /tmp directory.