提交 4672474a authored 作者: João Mesquita's avatar João Mesquita

Change the directories to the home user directory and copy templates if not there.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@16123 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 8b9cd950
<include> <include>
<gateway name="voicetechnology.com.ar"> <!--<gateway name="default">-->
<!--/// account username *required* ///--> <!--/// account username *required* ///-->
<param name="username" value="1001"/> <!--<param name="username" value="cluecon"/>-->
<!--/// auth realm: *optional* same as gateway name, if blank ///--> <!--/// auth realm: *optional* same as gateway name, if blank ///-->
<!--<param name="realm" value="asterlink.com"/>--> <!--<param name="realm" value="asterlink.com"/>-->
<!--/// username to use in from: *optional* same as username, if blank ///--> <!--/// username to use in from: *optional* same as username, if blank ///-->
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<!--/// domain to use in from: *optional* same as realm, if blank ///--> <!--/// domain to use in from: *optional* same as realm, if blank ///-->
<!--<param name="from-domain" value="asterlink.com"/>--> <!--<param name="from-domain" value="asterlink.com"/>-->
<!--/// account password *required* ///--> <!--/// account password *required* ///-->
<param name="password" value="cerrito2p"/> <!--<param name="password" value="cluecon"/>-->
<!--/// extension for inbound calls: *optional* same as username, if blank ///--> <!--/// extension for inbound calls: *optional* same as username, if blank ///-->
<!--<param name="extension" value="cluecon"/>--> <!--<param name="extension" value="cluecon"/>-->
<!--/// proxy host: *optional* same as realm, if blank ///--> <!--/// proxy host: *optional* same as realm, if blank ///-->
...@@ -30,5 +30,5 @@ ...@@ -30,5 +30,5 @@
<!--<param name="contact-params" value="tport=tcp"/>--> <!--<param name="contact-params" value="tport=tcp"/>-->
<!--send an options ping every x seconds, failure will unregister and/or mark it down--> <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
<!--<param name="ping" value="25"/>--> <!--<param name="ping" value="25"/>-->
</gateway> <!--</gateway>-->
</include> </include>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<X-PRE-PROCESS cmd="set" data="outbound_caller_name=FreeSWITCH"/> <X-PRE-PROCESS cmd="set" data="outbound_caller_name=FreeSWITCH"/>
<X-PRE-PROCESS cmd="set" data="outbound_caller_id=0000000000"/> <X-PRE-PROCESS cmd="set" data="outbound_caller_id=0000000000"/>
<X-PRE-PROCESS cmd="set" data="console_loglevel=info"/> <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>
<X-PRE-PROCESS cmd="set" data="default_gateway=voicetechnology.com.ar"/> <X-PRE-PROCESS cmd="set" data="default_gateway=default"/>
<X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/> <X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
......
...@@ -20,20 +20,61 @@ FSHost::FSHost(QObject *parent) : ...@@ -20,20 +20,61 @@ FSHost::FSHost(QObject *parent) :
void FSHost::run(void) void FSHost::run(void)
{ {
switch_core_flag_t flags = SCF_USE_SQL; //| SCF_USE_AUTO_NAT; switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
const char *err = NULL; const char *err = NULL;
switch_bool_t console = SWITCH_FALSE; switch_bool_t console = SWITCH_FALSE;
switch_status_t destroy_status; switch_status_t destroy_status;
QDir conf_dir = QDir(QCoreApplication::applicationDirPath()); /* Create directory structure for softphone with default configs */
if (conf_dir.cd("conf")) QDir conf_dir = QDir(QDir::home());
if (!conf_dir.exists(".fsphone"))
{ {
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(conf_dir.absolutePath().toAscii().constData()) + 1); conf_dir.mkpath(".fsphone/conf/accounts");
QFile rootXML(":/confs/freeswitch.xml");
QString dest = QString("%1/.fsphone/conf/freeswitch.xml").arg(conf_dir.absolutePath());
rootXML.copy(dest);
QFile defaultAccount(":/confs/example.xml");
dest = QString("%1/.fsphone/conf/accounts/example.xml").arg(conf_dir.absolutePath());
defaultAccount.copy(dest);
}
if (conf_dir.cd(".fsphone"))
{
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.conf_dir) { if (!SWITCH_GLOBAL_dirs.conf_dir) {
fprintf(stderr, "Allocation error\n"); emit coreLoadingError("Cannot allocate memory for conf_dir.");
emit coreLoadingError(err); }
strcpy(SWITCH_GLOBAL_dirs.conf_dir, QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData());
SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.log_dir) {
emit coreLoadingError("Cannot allocate memory for log_dir.");
}
strcpy(SWITCH_GLOBAL_dirs.log_dir, QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData());
SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.run_dir) {
emit coreLoadingError("Cannot allocate memory for run_dir.");
}
strcpy(SWITCH_GLOBAL_dirs.run_dir, QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData());
SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.db_dir) {
emit coreLoadingError("Cannot allocate memory for db_dir.");
}
strcpy(SWITCH_GLOBAL_dirs.db_dir, QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData());
SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.script_dir) {
emit coreLoadingError("Cannot allocate memory for script_dir.");
}
strcpy(SWITCH_GLOBAL_dirs.script_dir, QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData());
SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
emit coreLoadingError("Cannot allocate memory for htdocs_dir.");
} }
strcpy(SWITCH_GLOBAL_dirs.conf_dir, conf_dir.absolutePath().toAscii().constData()); strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData());
} }
/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */ /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
......
...@@ -2,4 +2,8 @@ ...@@ -2,4 +2,8 @@
<qresource prefix="/images"> <qresource prefix="/images">
<file alias="splash.png">resources/splash.png</file> <file alias="splash.png">resources/splash.png</file>
</qresource> </qresource>
<qresource prefix="/confs">
<file alias="freeswitch.xml">conf/freeswitch.xml</file>
<file alias="example.xml">conf/accounts/example.xml</file>
</qresource>
</RCC> </RCC>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论