<!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][16931] </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=16931">16931</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2010-03-07 15:26:36 -0600 (Sun, 07 Mar 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>move common say 'spell' function into shared code</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkMakefileam">freeswitch/trunk/Makefile.am</a></li>
<li><a href="#freeswitchtrunksrcincludeswitch_ivrh">freeswitch/trunk/src/include/switch_ivr.h</a></li>
<li><a href="#freeswitchtrunksrcmodsaymod_say_enmod_say_enc">freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c</a></li>
<li><a href="#freeswitchtrunksrcswitch_ivr_play_sayc">freeswitch/trunk/src/switch_ivr_play_say.c</a></li>
<li><a href="#freeswitchtrunkw32LibraryFreeSwitchCore2008vcproj">freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj</a></li>
<li><a href="#freeswitchtrunkw32LibraryFreeSwitchCorevcproj">freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunksrcswitch_ivr_sayc">freeswitch/trunk/src/switch_ivr_say.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkMakefileam"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/Makefile.am (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/Makefile.am        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/Makefile.am        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -215,6 +215,7 @@
</span><span class="cx">         src/switch_ivr_originate.c \
</span><span class="cx">         src/switch_ivr_async.c \
</span><span class="cx">         src/switch_ivr_play_say.c \
</span><ins>+        src/switch_ivr_say.c \
</ins><span class="cx">         src/switch_ivr_menu.c \
</span><span class="cx">         src/switch_ivr.c \
</span><span class="cx">         src/switch_stun.c \
</span></span></pre></div>
<a id="freeswitchtrunksrcincludeswitch_ivrh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/include/switch_ivr.h (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/include/switch_ivr.h        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/src/include/switch_ivr.h        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -821,6 +821,8 @@
</span><span class="cx"> SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
</span><span class="cx"> SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name);
</span><span class="cx"> SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
</span><ins>+SWITCH_DECLARE(switch_status_t) switch_ivr_say_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args);
+
</ins><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
</span><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
</span><span class="cx"> SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
</span></span></pre></div>
<a id="freeswitchtrunksrcmodsaymod_say_enmod_say_enc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -81,26 +81,6 @@
</span><span class="cx">                 }}                                                                                                                                \
</span><span class="cx">
</span><span class="cx">
</span><del>-static switch_status_t en_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
-{
-        char *p;
-
-        for (p = tosay; p && *p; p++) {
-                int a = tolower((int) *p);
-                if (a >= 48 && a <= 57) {
-                        say_file("digits/%d.wav", a - 48);
-                } else {
-                        if (say_args->type == SST_NAME_SPELLED) {
-                                say_file("ascii/%d.wav", a);
-                        } else if (say_args->type == SST_NAME_PHONETIC) {
-                                say_file("phonetic-ascii/%d.wav", a);
-                        }
-                }
-        }
-
-        return SWITCH_STATUS_SUCCESS;
-}
-
</del><span class="cx"> static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
</span><span class="cx"> {
</span><span class="cx">
</span><span class="lines">@@ -573,7 +553,7 @@
</span><span class="cx">                 break;
</span><span class="cx">         case SST_NAME_SPELLED:
</span><span class="cx">         case SST_NAME_PHONETIC:
</span><del>-                say_cb = en_spell;
</del><ins>+                return switch_ivr_say_spell(session, tosay, say_args, args);
</ins><span class="cx">                 break;
</span><span class="cx">         case SST_CURRENCY:
</span><span class="cx">                 say_cb = en_say_money;
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_ivr_play_sayc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/src/switch_ivr_play_say.c (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_ivr_play_say.c        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/src/switch_ivr_play_say.c        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -35,89 +35,6 @@
</span><span class="cx">
</span><span class="cx"> #include <switch.h>
</span><span class="cx">
</span><del>-static char *SAY_METHOD_NAMES[] = {
-        "N/A",
-        "PRONOUNCED",
-        "ITERATED",
-        "COUNTED",
-        NULL
-};
-
-static char *SAY_TYPE_NAMES[] = {
-        "NUMBER",
-        "ITEMS",
-        "PERSONS",
-        "MESSAGES",
-        "CURRENCY",
-        "TIME_MEASUREMENT",
-        "CURRENT_DATE",
-        "CURRENT_TIME",
-        "CURRENT_DATE_TIME",
-        "TELEPHONE_NUMBER",
-        "TELEPHONE_EXTENSION",
-        "URL",
-        "IP_ADDRESS",
-        "EMAIL_ADDRESS",
-        "POSTAL_ADDRESS",
-        "ACCOUNT_NUMBER",
-        "NAME_SPELLED",
-        "NAME_PHONETIC",
-        "SHORT_DATE_TIME",
-        NULL
-};
-
-static char *SAY_GENDER_NAMES[] = {
-        "MASCULINE",
-        "FEMININE",
-        "NEUTER",
-        NULL
-};
-
-SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name)
-{
-        int x = 0;
-
-        if (!name) return (switch_say_gender_t)0;
-
-        for (x = 0; SAY_GENDER_NAMES[x]; x++) {
-                if (!strcasecmp(SAY_GENDER_NAMES[x], name)) {
-                        break;
-                }
-        }
-
-        return (switch_say_gender_t) x;
-}
-
-SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name)
-{
-        int x = 0;
-
-        if (!name) return (switch_say_method_t)0;
-
-        for (x = 0; SAY_METHOD_NAMES[x]; x++) {
-                if (!strcasecmp(SAY_METHOD_NAMES[x], name)) {
-                        break;
-                }
-        }
-
-        return (switch_say_method_t) x;
-}
-
-SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name)
-{
-        int x = 0;
-
-        if (!name) return (switch_say_type_t)0;
-
-        for (x = 0; SAY_TYPE_NAMES[x]; x++) {
-                if (!strcasecmp(SAY_TYPE_NAMES[x], name)) {
-                        break;
-                }
-        }
-
-        return (switch_say_type_t) x;
-}
-
</del><span class="cx"> SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_session_t *session, const char *macro_name, const char *data, switch_event_t *event, const char *lang,
</span><span class="cx">                                                                                                                 switch_input_args_t *args)
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunksrcswitch_ivr_sayc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/src/switch_ivr_say.c (0 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/switch_ivr_say.c         (rev 0)
+++ freeswitch/trunk/src/switch_ivr_say.c        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Michael Jerris <mike@jerris.com>
+ *
+ * switch_ivr_say.c -- IVR Library (functions to say audio in languages)
+ *
+ */
+
+#include <switch.h>
+
+static char *SAY_METHOD_NAMES[] = {
+        "N/A",
+        "PRONOUNCED",
+        "ITERATED",
+        "COUNTED",
+        NULL
+};
+
+static char *SAY_TYPE_NAMES[] = {
+        "NUMBER",
+        "ITEMS",
+        "PERSONS",
+        "MESSAGES",
+        "CURRENCY",
+        "TIME_MEASUREMENT",
+        "CURRENT_DATE",
+        "CURRENT_TIME",
+        "CURRENT_DATE_TIME",
+        "TELEPHONE_NUMBER",
+        "TELEPHONE_EXTENSION",
+        "URL",
+        "IP_ADDRESS",
+        "EMAIL_ADDRESS",
+        "POSTAL_ADDRESS",
+        "ACCOUNT_NUMBER",
+        "NAME_SPELLED",
+        "NAME_PHONETIC",
+        "SHORT_DATE_TIME",
+        NULL
+};
+
+static char *SAY_GENDER_NAMES[] = {
+        "MASCULINE",
+        "FEMININE",
+        "NEUTER",
+        NULL
+};
+
+SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name)
+{
+        int x = 0;
+
+        if (!name) return (switch_say_gender_t)0;
+
+        for (x = 0; SAY_GENDER_NAMES[x]; x++) {
+                if (!strcasecmp(SAY_GENDER_NAMES[x], name)) {
+                        break;
+                }
+        }
+
+        return (switch_say_gender_t) x;
+}
+
+SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name)
+{
+        int x = 0;
+
+        if (!name) return (switch_say_method_t)0;
+
+        for (x = 0; SAY_METHOD_NAMES[x]; x++) {
+                if (!strcasecmp(SAY_METHOD_NAMES[x], name)) {
+                        break;
+                }
+        }
+
+        return (switch_say_method_t) x;
+}
+
+SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name)
+{
+        int x = 0;
+
+        if (!name) return (switch_say_type_t)0;
+
+        for (x = 0; SAY_TYPE_NAMES[x]; x++) {
+                if (!strcasecmp(SAY_TYPE_NAMES[x], name)) {
+                        break;
+                }
+        }
+
+        return (switch_say_type_t) x;
+}
+
+#define say_file(...) {                                                                                                        \
+                char tmp[80];                                                                                                        \
+                switch_status_t tstatus;                                                                                \
+                switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);                                        \
+                if ((tstatus =                                                                                                        \
+                         switch_ivr_play_file(session, NULL, tmp, args))                        \
+                        != SWITCH_STATUS_SUCCESS){                                                                        \
+                        return tstatus;                                                                                                \
+                }                                                                                                                                \
+                if (!switch_channel_ready(switch_core_session_get_channel(session))) { \
+                        return SWITCH_STATUS_FALSE;                                                                        \
+                }}                                                                                                                                \
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_say_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
+{
+        char *p;
+
+        for (p = tosay; p && *p; p++) {
+                int a = tolower((int) *p);
+                if (a >= '0' && a <= '9') {
+                        say_file("digits/%d.wav", a - '0');
+                } else {
+                        if (say_args->type == SST_NAME_SPELLED) {
+                                say_file("ascii/%d.wav", a);
+                        } else if (say_args->type == SST_NAME_PHONETIC) {
+                                say_file("phonetic-ascii/%d.wav", a);
+                        }
+                }
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */
</ins></span></pre></div>
<a id="freeswitchtrunkw32LibraryFreeSwitchCore2008vcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -739,6 +739,10 @@
</span><span class="cx">                                 >
</span><span class="cx">                         </File>
</span><span class="cx">                         <File
</span><ins>+                                RelativePath="..\..\src\switch_ivr_say.c"
+                                >
+                        </File>
+                        <File
</ins><span class="cx">                                 RelativePath="..\..\src\switch_loadable_module.c"
</span><span class="cx">                                 >
</span><span class="cx">                         </File>
</span></span></pre></div>
<a id="freeswitchtrunkw32LibraryFreeSwitchCorevcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj (16930 => 16931)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj        2010-03-07 19:36:20 UTC (rev 16930)
+++ freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj        2010-03-07 21:26:36 UTC (rev 16931)
</span><span class="lines">@@ -439,6 +439,10 @@
</span><span class="cx">                                 >
</span><span class="cx">                         </File>
</span><span class="cx">                         <File
</span><ins>+                                RelativePath="..\..\src\switch_ivr_say.c"
+                                >
+                        </File>
+                        <File
</ins><span class="cx">                                 RelativePath="..\..\src\switch_loadable_module.c"
</span><span class="cx">                                 >
</span><span class="cx">                         </File>
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>