1 /* 2 * Copyright (C) 2002-2003 Fhg Fokus 3 * 4 * This file is part of SEMS, a free SIP media server. 5 * 6 * SEMS is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * For a license to use the sems software under conditions 12 * other than those described here, or to purchase support for this 13 * software, please contact iptel.org by e-mail at the following addresses: 14 * info@iptel.org 15 * 16 * SEMS is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26 #ifndef _ANNOUNCEMENT_H_ 27 #define _ANNOUNCEMENT_H_ 28 29 #include "AmSession.h" 30 #include "AmAudioFile.h" 31 #include "AmConfigReader.h" 32 33 #include "AmUACAuth.h" 34 35 #include <string> 36 using std::string; 37 38 #include <memory> 39 40 /** \brief Factory for announcement sessions */ 41 class AnnouncementFactory: public AmSessionFactory 42 { 43 inline string getAnnounceFile(const AmSipRequest& req); 44 public: 45 static string AnnouncePath; 46 static string AnnounceFile; 47 static bool Loop; 48 49 AnnouncementFactory(const string& _app_name); 50 51 int onLoad(); 52 AmSession* onInvite(const AmSipRequest& req, const string& app_name, 53 const map<string,string>& app_params); 54 AmSession* onInvite(const AmSipRequest& req, const string& app_name, 55 AmArg& session_params); 56 57 }; 58 59 /**\brief announcement session logic implementation */ 60 class AnnouncementDialog : public AmSession, 61 public CredentialHolder 62 { 63 AmAudioFile wav_file; 64 string filename; 65 66 std::unique_ptr<UACAuthCred> cred; 67 public: 68 AnnouncementDialog(const string& filename, 69 UACAuthCred* credentials = NULL); 70 ~AnnouncementDialog(); 71 72 void onSessionStart(); 73 void onBye(const AmSipRequest& req); onDtmf(int event,int duration_msec)74 void onDtmf(int event, int duration_msec) {} 75 76 void process(AmEvent* event); 77 78 UACAuthCred* getCredentials(); 79 }; 80 81 #endif 82 // Local Variables: 83 // mode:C++ 84 // End: 85 86