More work on qsettings. Still get problem when expanding a template with no variables.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16146 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita 2010-01-05 04:57:25 +00:00
parent 58298f9903
commit c95d8882c4
7 changed files with 50 additions and 32 deletions

View File

@ -1,3 +1,5 @@
<document type="freeswitch/xml">
<section name="configuration">
<configuration name="event_socket.conf" description="Socket Client"> <configuration name="event_socket.conf" description="Socket Client">
<settings> <settings>
<param name="nat-map" value="false"/> <param name="nat-map" value="false"/>
@ -5,4 +7,6 @@
<param name="listen-port" value="8021"/> <param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/> <param name="password" value="ClueCon"/>
</settings> </settings>
</configuration> </configuration>
</section>
</document>

View File

@ -49,7 +49,7 @@
</configuration> </configuration>
<configuration name="qsettings.conf" description="configures our mod_qsettings"> <configuration name="qsettings.conf" description="configures our mod_qsettings">
<bindings value="dialplan" /> <bindings value="configuration" />
</configuration> </configuration>
<configuration name="local_stream.conf" description="stream files from local dir"> <configuration name="local_stream.conf" description="stream files from local dir">
@ -83,7 +83,6 @@
<load module="mod_logfile"/> <load module="mod_logfile"/>
<load module="mod_enum"/> <load module="mod_enum"/>
<load module="mod_cdr_csv"/> <load module="mod_cdr_csv"/>
<load module="mod_portaudio"/>
<load module="mod_sofia"/> <load module="mod_sofia"/>
<load module="mod_loopback"/> <load module="mod_loopback"/>
<load module="mod_commands"/> <load module="mod_commands"/>

View File

@ -1,4 +1,6 @@
<configuration name="portaudio.conf" description="Soundcard Endpoint"> <document type="freeswitch/xml">
<section name="configuration">
<configuration name="portaudio.conf" description="Soundcard Endpoint">
<settings> <settings>
<param name="indev" value="${indev}"/> <param name="indev" value="${indev}"/>
<!-- device to use for output --> <!-- device to use for output -->
@ -14,4 +16,7 @@
<param name="sample-rate" value="48000"/> <param name="sample-rate" value="48000"/>
<param name="codec-ms" value="10"/> <param name="codec-ms" value="10"/>
</settings> </settings>
</configuration> </configuration>
</section>
</document>

View File

@ -130,6 +130,7 @@ void FSHost::run(void)
} }
QString res; QString res;
sendCmd("load", "mod_event_socket", &res); sendCmd("load", "mod_event_socket", &res);
sendCmd("load", "mod_portaudio", &res);
emit ready(); emit ready();
/* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
* If its false, it initializes the libedit for the console, then does the same thing * If its false, it initializes the libedit for the console, then does the same thing

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>580</width> <width>670</width>
<height>563</height> <height>541</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -310,8 +310,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>580</width> <width>670</width>
<height>22</height> <height>24</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">

View File

@ -45,19 +45,25 @@ switch_xml_t XMLBinding::getConfigXML(QString tmpl)
switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS); switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(e); switch_assert(e);
QFile tmplFile(QString("%1/templates/%2.xml").arg(QApplication::applicationDirPath(),tmpl)); if (QFile::exists(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl))) {
if (!tmplFile.exists()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
"Template %s.xml, doesn't exist on directory, falling back to embedded template.\n", "Using template %s.xml on .fscomm/.\n",
tmpl.toAscii().constData()); tmpl.toAscii().constData());
tmplFile.setFileName(QString(":/confs/%1.xml").arg(tmpl)); }
return NULL; else if(QFile::exists(QString(":/confs/%1.xml").arg(tmpl)))
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
"Template %s.xml, doesn't exist on directory, copying embedded template.\n",
tmpl.toAscii().constData());
QString dest = QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl);
QString orig = QString(":/confs/%1.xml").arg(tmpl);
QFile::copy(orig, dest);
} }
if (tmplFile.open(QIODevice::ReadOnly | QIODevice::Text)) QFile tmplFile(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl));
if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template %s could not be read.!\n", tmpl.toAscii().constData()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template %s could not be read!\n", tmpl.toAscii().constData());
return NULL; return NULL;
} }
@ -72,6 +78,7 @@ switch_xml_t XMLBinding::getConfigXML(QString tmpl)
} }
char *res = switch_event_expand_headers(e, tmplContents.toAscii().constData()); char *res = switch_event_expand_headers(e, tmplContents.toAscii().constData());
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res);
switch_safe_free(e); switch_safe_free(e);
return switch_xml_parse_str(res, strlen(res)); return switch_xml_parse_str(res, strlen(res));
} }
@ -81,6 +88,8 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
{ {
XMLBinding *binding = (XMLBinding *) user_data; XMLBinding *binding = (XMLBinding *) user_data;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "We are being requested -> section: %s | tag_name: %s | key_name: %s | key_value: %s!\n",
section, tag_name, key_name, key_value);
if (!binding) { if (!binding) {
return NULL; return NULL;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB