Moved some data from Client to ClientLogic where it belongs.
git-svn-id: http://voip.null.ro/svn/yate@2220 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
154b331ea5
commit
404d28f0e1
|
@ -140,11 +140,9 @@ Configuration Client::s_contacts; // Contacts
|
||||||
Configuration Client::s_providers; // Provider settings
|
Configuration Client::s_providers; // Provider settings
|
||||||
Configuration Client::s_history; // Call log
|
Configuration Client::s_history; // Call log
|
||||||
Configuration Client::s_calltoHistory; // Dialed destinations history
|
Configuration Client::s_calltoHistory; // Dialed destinations history
|
||||||
ObjList Client::s_accOptions;
|
|
||||||
int Client::s_changing = 0;
|
int Client::s_changing = 0;
|
||||||
Regexp Client::s_notSelected = "^-\\(.*\\)-$"; // Holds a not selected/set value match
|
Regexp Client::s_notSelected = "^-\\(.*\\)-$"; // Holds a not selected/set value match
|
||||||
ObjList Client::s_logics;
|
ObjList Client::s_logics;
|
||||||
String Client::s_protocols[Client::OtherProtocol] = {"sip","jabber","h323","iax"};
|
|
||||||
String Client::s_skinPath; // Skin path
|
String Client::s_skinPath; // Skin path
|
||||||
String Client::s_soundPath; // Sounds path
|
String Client::s_soundPath; // Sounds path
|
||||||
String Client::s_ringInName = "defaultringin"; // Ring name for incoming channels
|
String Client::s_ringInName = "defaultringin"; // Ring name for incoming channels
|
||||||
|
@ -167,15 +165,6 @@ ObjList ClientSound::s_sounds; // ClientSound's list
|
||||||
Mutex ClientSound::s_soundsMutex(true); // ClientSound's list lock mutex
|
Mutex ClientSound::s_soundsMutex(true); // ClientSound's list lock mutex
|
||||||
static ClientLogic s_defaultLogic; // The default logic
|
static ClientLogic s_defaultLogic; // The default logic
|
||||||
|
|
||||||
// Parameters that are applied from provider template
|
|
||||||
const char* Client::s_provParams[] = {
|
|
||||||
"server",
|
|
||||||
"domain",
|
|
||||||
"outbound",
|
|
||||||
"port",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
// Client relays
|
// Client relays
|
||||||
static MsgRelay s_relays[] = {
|
static MsgRelay s_relays[] = {
|
||||||
{"call.cdr", Client::CallCdr, 90},
|
{"call.cdr", Client::CallCdr, 90},
|
||||||
|
@ -729,14 +718,6 @@ Client::Client(const char *name)
|
||||||
for (int i = 0; s_relays[i].name; i++)
|
for (int i = 0; s_relays[i].name; i++)
|
||||||
installRelay(s_relays[i].name,s_relays[i].id,s_relays[i].prio);
|
installRelay(s_relays[i].name,s_relays[i].id,s_relays[i].prio);
|
||||||
|
|
||||||
// Build account options list
|
|
||||||
if (!s_accOptions.skipNull()) {
|
|
||||||
s_accOptions.append(new String("allowplainauth"));
|
|
||||||
s_accOptions.append(new String("noautorestart"));
|
|
||||||
s_accOptions.append(new String("oldstyleauth"));
|
|
||||||
s_accOptions.append(new String("tlsrequired"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set paths
|
// Set paths
|
||||||
s_skinPath = Engine::config().getValue("client","skinbase");
|
s_skinPath = Engine::config().getValue("client","skinbase");
|
||||||
if (!s_skinPath)
|
if (!s_skinPath)
|
||||||
|
|
|
@ -49,6 +49,17 @@ static String s_notSelected = "-none-";
|
||||||
// Maximum number of call log entries
|
// Maximum number of call log entries
|
||||||
static unsigned int s_maxCallHistory = 20;
|
static unsigned int s_maxCallHistory = 20;
|
||||||
|
|
||||||
|
ObjList ClientLogic::s_accOptions;
|
||||||
|
String ClientLogic::s_protocols[ClientLogic::OtherProtocol] = {"sip","jabber","h323","iax"};
|
||||||
|
// Parameters that are applied from provider template
|
||||||
|
const char* ClientLogic::s_provParams[] = {
|
||||||
|
"server",
|
||||||
|
"domain",
|
||||||
|
"outbound",
|
||||||
|
"port",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
// strings used for completing account parameters
|
// strings used for completing account parameters
|
||||||
static String s_accParams[] = {
|
static String s_accParams[] = {
|
||||||
"username", "password", "server", "domain",
|
"username", "password", "server", "domain",
|
||||||
|
@ -103,7 +114,7 @@ static void updateProtocolSpec(NamedList& p, const String& proto, const String&
|
||||||
setAccParam(p,prefix,"address","");
|
setAccParam(p,prefix,"address","");
|
||||||
// Options
|
// Options
|
||||||
prefix << "_opt_";
|
prefix << "_opt_";
|
||||||
for (ObjList* o = Client::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
for (ObjList* o = ClientLogic::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||||
String* opt = static_cast<String*>(o->get());
|
String* opt = static_cast<String*>(o->get());
|
||||||
bool checked = (0 != obj->find(*opt));
|
bool checked = (0 != obj->find(*opt));
|
||||||
p.setParam("check:" + prefix + *opt,String::boolText(checked));
|
p.setParam("check:" + prefix + *opt,String::boolText(checked));
|
||||||
|
@ -647,7 +658,7 @@ bool ClientLogic::select(Window* wnd, const String& name, const String& item,
|
||||||
if (!sect)
|
if (!sect)
|
||||||
return false;
|
return false;
|
||||||
NamedList p("");
|
NamedList p("");
|
||||||
for (const char** par = Client::s_provParams; *par; par++)
|
for (const char** par = s_provParams; *par; par++)
|
||||||
p.addParam(String("acc_") + *par,sect->getValue(*par));
|
p.addParam(String("acc_") + *par,sect->getValue(*par));
|
||||||
NamedString* proto = sect->getParam("protocol");
|
NamedString* proto = sect->getParam("protocol");
|
||||||
if (proto) {
|
if (proto) {
|
||||||
|
@ -868,8 +879,8 @@ bool ClientLogic::editAccount(bool newAcc, NamedList* params, Window* wnd)
|
||||||
// Protocol combo and specific widget (page) data
|
// Protocol combo and specific widget (page) data
|
||||||
selectProtocolSpec(*params,proto,m_accShowAdvanced);
|
selectProtocolSpec(*params,proto,m_accShowAdvanced);
|
||||||
NamedString* tmp = params->getParam("acc_options");
|
NamedString* tmp = params->getParam("acc_options");
|
||||||
for (int i = 0; i < Client::OtherProtocol; i++)
|
for (int i = 0; i < OtherProtocol; i++)
|
||||||
updateProtocolSpec(*params,Client::s_protocols[i],tmp ? *tmp : String::empty());
|
updateProtocolSpec(*params,s_protocols[i],tmp ? *tmp : String::empty());
|
||||||
params->setParam("context",acc);
|
params->setParam("context",acc);
|
||||||
params->setParam("acc_account",acc);
|
params->setParam("acc_account",acc);
|
||||||
params->setParam("modal",String::boolText(true));
|
params->setParam("modal",String::boolText(true));
|
||||||
|
@ -946,7 +957,7 @@ bool ClientLogic::acceptAccount(NamedList* params, Window* wnd)
|
||||||
// Options
|
// Options
|
||||||
prefix << "opt_";
|
prefix << "opt_";
|
||||||
String options;
|
String options;
|
||||||
for (ObjList* o = Client::s_accOptions.skipNull(); o; o = o->skipNext()) {
|
for (ObjList* o = s_accOptions.skipNull(); o; o = o->skipNext()) {
|
||||||
String* opt = static_cast<String*>(o->get());
|
String* opt = static_cast<String*>(o->get());
|
||||||
bool checked = false;
|
bool checked = false;
|
||||||
Client::self()->getCheck(prefix + *opt,checked,wnd);
|
Client::self()->getCheck(prefix + *opt,checked,wnd);
|
||||||
|
@ -2002,6 +2013,14 @@ bool ClientLogic::defaultMsgHandler(Message& msg, int id, bool& stopLogic)
|
||||||
// Client created and initialized all windows
|
// Client created and initialized all windows
|
||||||
void ClientLogic::initializedWindows()
|
void ClientLogic::initializedWindows()
|
||||||
{
|
{
|
||||||
|
// Build account options list
|
||||||
|
if (!s_accOptions.skipNull()) {
|
||||||
|
s_accOptions.append(new String("allowplainauth"));
|
||||||
|
s_accOptions.append(new String("noautorestart"));
|
||||||
|
s_accOptions.append(new String("oldstyleauth"));
|
||||||
|
s_accOptions.append(new String("tlsrequired"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!Client::self())
|
if (!Client::self())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2010,11 +2029,11 @@ void ClientLogic::initializedWindows()
|
||||||
String acc_proto = "acc_protocol";
|
String acc_proto = "acc_protocol";
|
||||||
if (!Client::self()->hasOption(proto,s_notSelected))
|
if (!Client::self()->hasOption(proto,s_notSelected))
|
||||||
Client::self()->addOption(proto,s_notSelected,true);
|
Client::self()->addOption(proto,s_notSelected,true);
|
||||||
for (int i = 0; i < Client::OtherProtocol; i++) {
|
for (int i = 0; i < OtherProtocol; i++) {
|
||||||
if (!Client::self()->hasOption(proto,Client::s_protocols[i]))
|
if (!Client::self()->hasOption(proto,s_protocols[i]))
|
||||||
Client::self()->addOption(proto,Client::s_protocols[i],false);
|
Client::self()->addOption(proto,s_protocols[i],false);
|
||||||
if (!Client::self()->hasOption(acc_proto,Client::s_protocols[i]))
|
if (!Client::self()->hasOption(acc_proto,s_protocols[i]))
|
||||||
Client::self()->addOption(acc_proto,Client::s_protocols[i],false);
|
Client::self()->addOption(acc_proto,s_protocols[i],false);
|
||||||
}
|
}
|
||||||
// Add account/providers 'not selected' item
|
// Add account/providers 'not selected' item
|
||||||
String tmp = "account";
|
String tmp = "account";
|
||||||
|
|
51
yatecbase.h
51
yatecbase.h
|
@ -660,17 +660,6 @@ public:
|
||||||
OptCount = 8
|
OptCount = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Known voip protocols
|
|
||||||
*/
|
|
||||||
enum Protocol {
|
|
||||||
SIP = 0,
|
|
||||||
JABBER = 1,
|
|
||||||
H323 = 2,
|
|
||||||
IAX = 3,
|
|
||||||
OtherProtocol = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param name The client's name
|
* @param name The client's name
|
||||||
|
@ -1242,22 +1231,6 @@ public:
|
||||||
static inline void setLogicsTick()
|
static inline void setLogicsTick()
|
||||||
{ s_idleLogicsTick = true; }
|
{ s_idleLogicsTick = true; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the protocol from a string
|
|
||||||
*/
|
|
||||||
static inline Protocol getProtocol(const String& proto) {
|
|
||||||
for (int i = 0; i < OtherProtocol; i++)
|
|
||||||
if (proto == s_protocols[i])
|
|
||||||
return (Protocol)i;
|
|
||||||
return OtherProtocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the protocol name from an integer value
|
|
||||||
*/
|
|
||||||
static inline const String& getProtocol(int proto)
|
|
||||||
{ return proto < OtherProtocol ? s_protocols[proto] : String::empty(); }
|
|
||||||
|
|
||||||
static Configuration s_settings; // Client settings
|
static Configuration s_settings; // Client settings
|
||||||
static Configuration s_actions; // Logic preferrences
|
static Configuration s_actions; // Logic preferrences
|
||||||
static Configuration s_accounts; // Accounts
|
static Configuration s_accounts; // Accounts
|
||||||
|
@ -1267,12 +1240,6 @@ public:
|
||||||
static Configuration s_calltoHistory; // Dialed destinations history
|
static Configuration s_calltoHistory; // Dialed destinations history
|
||||||
// Holds a not selected/set value match
|
// Holds a not selected/set value match
|
||||||
static Regexp s_notSelected;
|
static Regexp s_notSelected;
|
||||||
// Parameters that are applied from provider template
|
|
||||||
static const char* s_provParams[];
|
|
||||||
// Account options string list
|
|
||||||
static ObjList s_accOptions;
|
|
||||||
// The list of protocols supported by the client
|
|
||||||
static String s_protocols[OtherProtocol];
|
|
||||||
// Paths
|
// Paths
|
||||||
static String s_skinPath;
|
static String s_skinPath;
|
||||||
static String s_soundPath;
|
static String s_soundPath;
|
||||||
|
@ -1669,6 +1636,17 @@ class YATE_API ClientLogic : public GenObject
|
||||||
{
|
{
|
||||||
friend class Client;
|
friend class Client;
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Known voip protocols
|
||||||
|
*/
|
||||||
|
enum Protocol {
|
||||||
|
SIP = 0,
|
||||||
|
JABBER = 1,
|
||||||
|
H323 = 2,
|
||||||
|
IAX = 3,
|
||||||
|
OtherProtocol = 4
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Append itself to the client's list
|
* Constructor. Append itself to the client's list
|
||||||
*/
|
*/
|
||||||
|
@ -2119,6 +2097,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void clearDurationUpdate();
|
void clearDurationUpdate();
|
||||||
|
|
||||||
|
// Account options string list
|
||||||
|
static ObjList s_accOptions;
|
||||||
|
// Parameters that are applied from provider template
|
||||||
|
static const char* s_provParams[];
|
||||||
|
// The list of protocols supported by the client
|
||||||
|
static String s_protocols[OtherProtocol];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Method called by the client when idle.
|
* Method called by the client when idle.
|
||||||
|
|
Loading…
Reference in New Issue