diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp index 4508e7d4..463fa738 100644 --- a/apps/conference/Conference.cpp +++ b/apps/conference/Conference.cpp @@ -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(); } diff --git a/apps/conference/Conference.h b/apps/conference/Conference.h index 5c33fadf..d5249a42 100644 --- a/apps/conference/Conference.h +++ b/apps/conference/Conference.h @@ -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 transfer_req; diff --git a/apps/conference/etc/conference.conf b/apps/conference/etc/conference.conf index a410675d..406a1328 100644 --- a/apps/conference/etc/conference.conf +++ b/apps/conference/etc/conference.conf @@ -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 diff --git a/doc/Readme.conference b/doc/Readme.conference index 73a68fe3..cf625bc0 100644 --- a/doc/Readme.conference +++ b/doc/Readme.conference @@ -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_.wav, + or audio_path/lonely_user_msg/default_.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