00001 /* 00002 * $Id: AmConfig.h 927 2008-04-30 17:25:42Z sayer $ 00003 * 00004 * Copyright (C) 2002-2003 Fhg Fokus 00005 * 00006 * This file is part of sems, a free SIP media server. 00007 * 00008 * sems is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version 00012 * 00013 * For a license to use the ser software under conditions 00014 * other than those described here, or to purchase support for this 00015 * software, please contact iptel.org by e-mail at the following addresses: 00016 * info@iptel.org 00017 * 00018 * sems is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program; if not, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 */ 00028 #ifndef _AmConfig_h_ 00029 #define _AmConfig_h_ 00030 00031 #include "AmSdp.h" 00032 #include "AmDtmfDetector.h" 00033 00034 #include <string> 00035 using std::string; 00036 #include <utility> 00037 00038 #include <sys/types.h> 00039 #include <regex.h> 00040 00041 class AmSessionTimerConfig; 00042 00048 struct AmConfig 00049 { 00051 static string ConfigurationFile; 00053 static string ModConfigPath; 00055 static string PlugInPath; 00057 static string LoadPlugins; 00059 static string ExcludePlugins; 00061 static string ExcludePayloads; 00062 //static unsigned int MaxRecordTime; 00064 static int DaemonMode; 00065 00067 static string LocalIP; 00068 00071 static string PublicIP; 00072 00074 static string PrefixSep; 00076 static int RtpLowPort; 00078 static int RtpHighPort; 00079 /* Session Timer: */ 00080 static AmSessionTimerConfig defaultSessionTimerConfig; 00082 static int MediaProcessorThreads; 00084 static string LocalSIPIP; 00086 static int LocalSIPPort; 00088 static string OutboundProxy; 00090 static string Signature; 00092 static bool SingleCodecInOK; 00093 static vector <string> CodecOrder; 00094 00095 enum ApplicationSelector { 00096 App_RURIUSER, 00097 App_RURIPARAM, 00098 App_APPHDR, 00099 App_MAPPING, 00100 App_SPECIFIED 00101 }; 00102 00104 static string Application; 00106 static ApplicationSelector AppSelect; 00107 00108 /* this is regex->application mapping is used if App_MAPPING */ 00109 typedef vector<std::pair<regex_t, string> > AppMappingVector; 00110 static AppMappingVector AppMapping; 00111 00112 static unsigned int SessionLimit; 00113 static unsigned int SessionLimitErrCode; 00114 static string SessionLimitErrReason; 00115 00117 static unsigned int DeadRtpTime; 00118 00120 static bool IgnoreRTPXHdrs; 00121 00122 static Dtmf::InbandDetectorType DefaultDTMFDetector; 00123 00124 static bool IgnoreSIGCHLD; 00125 00126 static bool LogSessions; 00127 00129 static int init(); 00130 00133 static int readConfiguration(); 00134 00135 /* following setters are used to fill config from config file */ 00136 00138 static int setSIPPort(const string& port); 00140 static int setSmtpPort(const string& port); 00142 static int setRtpLowPort(const string& port); 00144 static int setRtpHighPort(const string& port); 00146 static int setLoglevel(const string& level); 00148 static int setFork(const string& fork); 00150 static int setStderr(const string& s); 00152 static int setMediaProcessorThreads(const string& th); 00154 static int setDeadRtpTime(const string& drt); 00155 }; 00156 00157 class AmConfigReader; 00159 class AmSessionTimerConfig { 00161 int EnableSessionTimer; 00163 unsigned int SessionExpires; 00165 unsigned int MinimumTimer; 00166 00167 public: 00168 AmSessionTimerConfig(); 00169 ~AmSessionTimerConfig(); 00170 00171 00174 int setEnableSessionTimer(const string& enable); 00177 int setSessionExpires(const string& se); 00180 int setMinimumTimer(const string& minse); 00181 00182 bool getEnableSessionTimer() { return EnableSessionTimer; } 00183 unsigned int getSessionExpires() { return SessionExpires; } 00184 unsigned int getMinimumTimer() { return MinimumTimer; } 00185 00186 int readFromConfig(AmConfigReader& cfg); 00187 }; 00188 00189 #endif 00190 00191 // Local Variables: 00192 // mode:C++ 00193 // End:
1.5.1