* Added language awareness to conference application. Should be

backwards compatible in terms of conference.conf.  See
  Readme.conference and conference.conf.


git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@327 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Juha Heinanen 19 years ago
parent 9fe41686d8
commit bb9f5a98ef

@ -46,6 +46,7 @@ ConferenceFactory::ConferenceFactory(const string& _app_name)
{
}
string ConferenceFactory::AudioPath;
string ConferenceFactory::LonelyUserFile;
string ConferenceFactory::JoinSound;
string ConferenceFactory::DropSound;
@ -61,7 +62,16 @@ int ConferenceFactory::onLoad()
// get application specific global parameters
configureModule(cfg);
LonelyUserFile = cfg.getParameter("default_announce",ANNOUNCE_PATH "/" ANNOUNCE_FILE);
AudioPath = cfg.getParameter("audio_path", ANNOUNCE_PATH);
LonelyUserFile = cfg.getParameter("default_announce");
if (LonelyUserFile.empty()) {
LonelyUserFile = AudioPath + "/" ANNOUNCE_FILE;
} else {
if (LonelyUserFile[0] != '/') {
LonelyUserFile = AudioPath + "/" + LonelyUserFile;
}
}
if(!file_exists(LonelyUserFile)){
ERROR("default announce '%s' \n",LonelyUserFile.c_str());
ERROR("for module conference does not exist.\n");
@ -69,7 +79,18 @@ int ConferenceFactory::onLoad()
}
JoinSound = cfg.getParameter("join_sound");
if (!JoinSound.empty()) {
if (JoinSound[0] != '/') {
JoinSound = AudioPath + "/" + JoinSound;
}
}
DropSound = cfg.getParameter("drop_sound");
if (!DropSound.empty()) {
if (DropSound[0] != '/') {
DropSound = AudioPath + "/" + DropSound;
}
}
DialoutSuffix = cfg.getParameter("dialout_suffix");
if(DialoutSuffix.empty()){
@ -136,18 +157,21 @@ void ConferenceDialog::onStart()
void ConferenceDialog::onSessionStart(const AmSipRequest& req)
{
int i, len;
string lonely_user_file;
string app_param_hdr = getHeader(req.hdrs, PARAM_HDR);
if (app_param_hdr.length()) {
from_header = get_header_keyvalue(app_param_hdr, "Dialout-From");
extra_headers = get_header_keyvalue(app_param_hdr, "Dialout-Extra");
dialout_suffix = get_header_keyvalue(app_param_hdr, "Dialout-Suffix");
language = get_header_keyvalue(app_param_hdr, "Language");
} else {
DBG("Warning: P-Dialout- style headers are deprecated."
" Please use P-App-Param header instead.\n");
from_header = getHeader(req.hdrs, "P-Dialout-From");
extra_headers = getHeader(req.hdrs, "P-Dialout-Extra");
dialout_suffix = getHeader(req.hdrs, "P-Dialout-Suffix");
language = getHeader(req.hdrs, "P-Language");
}
len = extra_headers.length();
@ -164,7 +188,23 @@ void ConferenceDialog::onSessionStart(const AmSipRequest& req)
}
allow_dialout = dialout_suffix.length() > 0;
if (!language.empty()) {
lonely_user_file = ConferenceFactory::AudioPath + "/lonely_user_msg/" +
req.domain + "/" + "default_" + language + ".wav";
if(file_exists(lonely_user_file)) {
ConferenceFactory::LonelyUserFile = lonely_user_file;
} else {
lonely_user_file = ConferenceFactory::AudioPath +
"/lonely_user_msg/default_" + language + ".wav";
if(file_exists(lonely_user_file)) {
ConferenceFactory::LonelyUserFile = lonely_user_file;
}
}
}
DBG("Using LonelyUserFile <%s>\n",
ConferenceFactory::LonelyUserFile.c_str());
setupAudio();
}

@ -69,6 +69,7 @@ struct DialoutConfEvent : public AmEvent {
class ConferenceFactory : public AmSessionFactory
{
public:
static string AudioPath;
static string LonelyUserFile;
static string JoinSound;
static string DropSound;
@ -106,6 +107,7 @@ class ConferenceDialog : public AmSession
string from_header;
string extra_headers;
string language;
auto_ptr<AmSipRequest> transfer_req;

@ -1,6 +1,7 @@
default_announce=/usr/local/lib/sems/audio/conference/first_participant.wav
join_sound=/usr/local/lib/sems/audio/conference/beep.wav
drop_sound=/usr/local/lib/sems/audio/conference/beep.wav
audio_path=/usr/local/lib/sems/audio/conference
default_announce=first_participant.wav
join_sound=beep.wav
drop_sound=beep.wav
dialout_suffix=@iptel.org
# playout_type : select playout mechanism

@ -29,15 +29,29 @@ Dialout is only enabled if dialout_suffix is defined (see below).
Configuration:
--------------
default_announce: announcement to be played to the
first participant as he enters the
conference room.
audio_path: directory where conference audio files are kept (optional,
defaults to /usr/local/lib/sems/audio)
default_announce: Announcement to be played to the first participant as
he enters the conference room. If default_announce
does not start with '/' char, default_announce is
appended to audio_path. (optional, defaults to
audio_path/default.wav) If P-Language header or
Language P-App-Param header parameter exists,
announcement file
audio_path/lonely_user_msg/r-uri-host/default_<language>.wav,
or audio_path/lonely_user_msg/default_<language>.wav
(if exists) is used instead of default_announce file.
join_sound: sound to be played to all the participants
when a new one joins the conference. (optional)
when a new one joins the conference. If join_sound does not
start with '/', join_sound is appended to audio_path.
(optional)
drop_sound: sound to be played to all the participants
when a participant leaves the conference. (optional)
when a participant leaves the conference.
If drop_sound does not start with '/', drop_sound is
appended to audio_path. (optional)
dialout_suffix: suffix to be append to the numbered entered by
the user. Example: @iptel.org

Loading…
Cancel
Save