<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][15330] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=15330">15330</a></dd>
<dt>Author</dt> <dd>crienzo</dd>
<dt>Date</dt> <dd>2009-11-03 10:52:22 -0600 (Tue, 03 Nov 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>hopefully fixed pizza demo bug, other misc ungoodness</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcmodasr_ttsmod_unimrcpmod_unimrcpc">freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodasr_ttsmod_unimrcpmod_unimrcpc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c (15329 => 15330)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c        2009-11-03 16:50:16 UTC (rev 15329)
+++ freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c        2009-11-03 16:52:22 UTC (rev 15330)
</span><span class="lines">@@ -1277,15 +1277,18 @@
</span><span class="cx">         switch_mutex_lock(schannel->mutex);
</span><span class="cx">         if (!zstr(param) && val != NULL) {
</span><span class="cx">                 /* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */
</span><del>-                char *mrcp_param = (char *)switch_core_hash_find(schannel->application->fs_param_map, param);
-                char *lcparam = NULL;
-                if (zstr(mrcp_param)) {
-                        lcparam = switch_lc_strdup(param);
-                        mrcp_param = lcparam;
</del><ins>+                const char *v;
+                const char *p = switch_core_hash_find(schannel->application->fs_param_map, param);
+                if (!p) {
+                        p = switch_core_strdup(schannel->memory_pool, param);
</ins><span class="cx">                 }
</span><del>-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) param = %s, val = %s\n", schannel->name, mrcp_param, val);
-                switch_core_hash_insert(schannel->params, mrcp_param, val);
-                switch_safe_free(lcparam);
</del><ins>+                if (val) {
+                        v = switch_core_strdup(schannel->memory_pool, val);
+                } else {
+                        v = val;
+                }
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) param = %s, val = %s\n", schannel->name, p, v);
+                switch_core_hash_insert(schannel->params, p, v);
</ins><span class="cx">         }
</span><span class="cx">         switch_mutex_unlock(schannel->mutex);
</span><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="lines">@@ -1777,11 +1780,11 @@
</span><span class="cx">         mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth");
</span><span class="cx">
</span><span class="cx">         /* map FreeSWITCH params to MRCP param */
</span><del>-        switch_core_hash_init_case(&globals.synth.fs_param_map, pool, SWITCH_FALSE /* case_sensitive */);
</del><ins>+        switch_core_hash_init_nocase(&globals.synth.fs_param_map, pool);
</ins><span class="cx">         switch_core_hash_insert(globals.synth.fs_param_map, "voice", "voice-name");
</span><span class="cx">
</span><span class="cx">         /* map MRCP params to UniMRCP ID */
</span><del>-        switch_core_hash_init_case(&globals.synth.param_id_map, pool, SWITCH_FALSE /* case_sensitive */);
</del><ins>+        switch_core_hash_init_nocase(&globals.synth.param_id_map, pool);
</ins><span class="cx">         switch_core_hash_insert(globals.synth.param_id_map, "jump-size", unimrcp_param_id_create(SYNTHESIZER_HEADER_JUMP_SIZE, pool));
</span><span class="cx">         switch_core_hash_insert(globals.synth.param_id_map, "kill-on-barge-in", unimrcp_param_id_create(SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, pool));
</span><span class="cx">         switch_core_hash_insert(globals.synth.param_id_map, "speaker-profile", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAKER_PROFILE, pool));
</span><span class="lines">@@ -2057,6 +2060,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 /* set up name, type for future RECOGNIZE requests. We'll reference this cached grammar by name */
</span><ins>+                /* TODO rethink this */
</ins><span class="cx">                 ldata = switch_mprintf("session:%s", name);
</span><span class="cx">                 data = ldata;
</span><span class="cx">                 type = GRAMMAR_TYPE_URI;
</span><span class="lines">@@ -2065,7 +2069,7 @@
</span><span class="cx">         /* Create the grammar and save it */
</span><span class="cx">         if ((status = grammar_create(&g, name, type, data, schannel->memory_pool)) == SWITCH_STATUS_SUCCESS) {
</span><span class="cx">                 recognizer_data_t *r = (recognizer_data_t *)schannel->data;
</span><del>-                switch_core_hash_insert(r->grammars, name, g);
</del><ins>+                switch_core_hash_insert(r->grammars, g->name, g);
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> done:
</span><span class="lines">@@ -2575,7 +2579,7 @@
</span><span class="cx">         char *filename = NULL;
</span><span class="cx">         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name);
</span><span class="cx">
</span><del>-        if (zstr(grammar) || zstr(name)) {
</del><ins>+        if (zstr(grammar)) {
</ins><span class="cx">                 status = SWITCH_STATUS_FALSE;
</span><span class="cx">                 goto done;
</span><span class="cx">         }
</span><span class="lines">@@ -2591,8 +2595,20 @@
</span><span class="cx">                 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name);
</span><span class="cx">                 type = GRAMMAR_TYPE_URI;
</span><span class="cx">                 grammar_data = grammar;
</span><ins>+
+                /* if a name was not given, just use the URI that was passed in */
+                if (zstr(name)) {
+                        name = grammar;
+                }
</ins><span class="cx">         } else if (text_starts_with(grammar, INLINE_ID)) {
</span><span class="cx">                 grammar_data = grammar + strlen(INLINE_ID);
</span><ins>+
+                /* name is required for inline grammars */
+                if (zstr(name)) {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) missing grammar name\n", schannel->name);
+                        status = SWITCH_STATUS_FALSE;
+                        goto done;
+                }
</ins><span class="cx">         } else {
</span><span class="cx">                 /* grammar points to file containing the grammar text. We assume the MRCP server can't get to this file
</span><span class="cx">                  * so read the data from the file and cache it */
</span><span class="lines">@@ -2628,6 +2644,11 @@
</span><span class="cx">                 }
</span><span class="cx">                 grammar_file_data[to_read] = '\0';
</span><span class="cx">                 grammar_data = grammar_file_data;
</span><ins>+
+                /* if a name was not given, just use the filename that was passed in */
+                if (zstr(name)) {
+                        name = grammar;
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /* determine content type of file grammar or inline grammar */
</span><span class="lines">@@ -3022,12 +3043,12 @@
</span><span class="cx">         mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog");
</span><span class="cx">         
</span><span class="cx">         /* map FreeSWITCH params or old params to MRCPv2 param */
</span><del>-        switch_core_hash_init_case(&globals.recog.fs_param_map, pool, SWITCH_FALSE /* case_sensitive */);
</del><ins>+        switch_core_hash_init_nocase(&globals.recog.fs_param_map, pool);
</ins><span class="cx">         /* MRCPv1 param */
</span><span class="cx">         switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers");
</span><span class="cx">         
</span><span class="cx">         /* map MRCP params to UniMRCP ID */
</span><del>-        switch_core_hash_init_case(&globals.recog.param_id_map, pool, SWITCH_FALSE /* case_sensitive */);
</del><ins>+        switch_core_hash_init_nocase(&globals.recog.param_id_map, pool);
</ins><span class="cx">         switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool));
</span><span class="cx">         switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool));
</span><span class="cx">         switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool));
</span><span class="lines">@@ -3467,7 +3488,7 @@
</span><span class="cx">         memset(&globals, 0, sizeof(globals));
</span><span class="cx">         switch_mutex_init(&globals.mutex, SWITCH_MUTEX_UNNESTED, pool);
</span><span class="cx">         globals.speech_channel_number = 0;
</span><del>-        switch_core_hash_init_case(&globals.profiles, pool, SWITCH_FALSE /* case_sensitive */);
</del><ins>+        switch_core_hash_init_nocase(&globals.profiles, pool);
</ins><span class="cx">
</span><span class="cx">         /* get MRCP module configuration */
</span><span class="cx">         mod_unimrcp_do_config();
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>