<!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][15592] </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=15592">15592</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2009-11-20 23:45:42 -0600 (Fri, 20 Nov 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>add mod_say_th (<a href="http://jira.freeswitch.org/browse/MODLANG-144">MODLANG-144</a>)</pre>
<h3>Added Paths</h3>
<ul>
<li>freeswitch/trunk/src/mod/say/mod_say_th/</li>
<li><a href="#freeswitchtrunksrcmodsaymod_say_thmod_say_thc">freeswitch/trunk/src/mod/say/mod_say_th/mod_say_th.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunksrcmodsaymod_say_thmod_say_thc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/src/mod/say/mod_say_th/mod_say_th.c (0 => 15592)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/src/mod/say/mod_say_th/mod_say_th.c         (rev 0)
+++ freeswitch/trunk/src/mod/say/mod_say_th/mod_say_th.c        2009-11-21 05:45:42 UTC (rev 15592)
</span><span class="lines">@@ -0,0 +1,657 @@
</span><ins>+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * 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>
+ * PeteDao <petekay@gmail.com>
+ * Steve Underwood 0.0.1 <steveu@coppice.org>
+ * Dome Charoenyost <dome@tel.co.th>
+ *
+ *
+ * mod_say_th.c -- Say for Thai
+ *
+ */
+
+#include <switch.h>
+#include <math.h>
+#include <ctype.h>
+
+/* SSM_COUNTED means ordinal number
+        SSM_PRONOUNCED
+ SSM_ITERATED */
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_say_th_load);
+SWITCH_MODULE_DEFINITION(mod_say_th, mod_say_th_load, NULL, NULL);
+
+#define say_num(num, t) {                                                        \
+                char tmp[80];\
+                switch_status_t tstatus;\
+                switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num);                                \
+        if ((tstatus = th_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
+                return tstatus;\
+        }\
+}\
+
+#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;\
+                }\
+}\
+
+
+static switch_status_t th_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, 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 (type == SST_NAME_SPELLED) {
+                                say_file("ascii/%d.wav", a);
+                        } else if (type == SST_NAME_PHONETIC) {
+                                say_file("phonetic-ascii/%d.wav", a);
+                        }
+                }
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static char *strip_commas(char *in, char *out, switch_size_t len)
+{
+        char *p = in;
+ char *q = out;
+        char *ret = out;
+        switch_size_t x = 0;
+
+        for ( ; p && *p; p++) {
+                if ((*p >= '0' && *p <= '9')) {
+                        *q++ = *p;
+                } else if (*p != ',') {
+                        ret = NULL;
+                        break;
+                }
+
+                if (++x > len) {
+                        ret = NULL;
+                        break;
+                }
+        }
+
+        return ret;
+}
+
+static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
+{
+        char *p = in;
+ char *q = out;
+        char *ret = out;
+        switch_size_t x = 0;
+
+        /* valid are 0 - 9, period (.), minus (-), and plus (+) - remove all others */
+        for (; p && *p; p++) {
+                if ((*p >= '0' && *p <= '9') || *p == '.' || *p == '-' || *p == '+') {
+                        *q++ = *p;
+                }
+
+                if (++x > len) {
+                        ret = NULL;
+                        break;
+                }
+        }
+
+        return ret;
+}
+
+static switch_status_t th_say_general_count(switch_core_session_t *session,
+                                                                                        char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+        int in;
+        char sbuf[13] = "";
+ char digits[11];
+ int i;
+
+        if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
+                return SWITCH_STATUS_GENERR;
+        }
+
+        in = atoi(tosay);
+
+        if (in != 0) {
+                snprintf(digits, sizeof(digits), "%10.10d", in);
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Say: %s \n",digits);
+                switch (method) {
+                case SSM_COUNTED:
+                        say_file("digits/ordinal.wav");
+                        /* Fall through */
+                case SSM_PRONOUNCED:
+ for (i = 0; i <= 9; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ /* Billions column */
+ if (digits[i] != '0')
+ {
+ if (digits[i] != '1')
+                 say_file("digits/%c.wav", digits[i]);
+                 say_file("digits/10.wav");
+ }
+ break;
+ case 1:
+ /* Hundred millions columns */
+ if (digits[i] != '0')
+                 say_file("digits/%c.wav", digits[i]);
+ if (memcmp (digits, "00", 2) != 0)
+                 say_file("digits/100000000.wav");
+ break;
+ case 2:
+ /* ten Millions column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+                 say_file("digits/10000000.wav");
+ }
+ break;
+ case 3:
+ /* Millions column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+                 say_file("digits/1000000.wav");
+ }
+ break;
+ case 4:
+ /* Hundred thousands column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+ if (memcmp (digits + 2, "00000", 4) != 0)
+                 say_file("digits/100000.wav");
+ }
+
+ break;
+
+ case 5:
+ /* Ten thousands column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+ if (memcmp (digits + 2, "0000", 4) != 0)
+                 say_file("digits/10000.wav");
+ }
+ break;
+ case 6:
+ /* Ten millions or thousands column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+                 say_file("digits/1000.wav");
+ }
+ break;
+ case 7:
+ /* hundreds column */
+ if (digits[i] != '0')
+ {
+                 say_file("digits/%c.wav", digits[i]);
+                 say_file("digits/100.wav");
+ }
+ break;
+ case 8:
+ /* Tens column */
+ if (digits[i] != '0')
+ {
+ if (digits[i] == '2')
+ {
+                 say_file("digits/20.wav");
+                                break;
+ }
+ if (digits[i] == '1')
+ {
+                 say_file("digits/10.wav");
+                                break;
+ }
+ if (digits[i] != '1'
+ ||
+ memcmp (digits, "00000000", 8) != 0)
+ {
+                 say_file("digits/%c.wav", digits[i]);
+ }
+ }
+ if (digits[8] != '0')
+                 say_file("digits/10.wav");
+ break;
+ case 9:
+ /* Units column */
+ if (digits[9] == '1'){
+          if (digits[8] != '0'){
+                 say_file("digits/ed.wav", digits[i]);
+                         }else{        
+                 say_file("digits/%c.wav", digits[i]);
+                         }        
+          break;
+                 }
+ if (digits[9] != '0')
+                 say_file("digits/%c.wav", digits[i]);
+ break;
+ }
+ }
+                        break;
+                case SSM_ITERATED:
+                        {
+                                char *p;
+
+                                for (p = tosay; p && *p; p++) {
+                                        say_file("digits/%c.wav", *p);
+                                }
+                        }
+                        break;
+                default:
+                        break;
+                }
+        } else {
+                say_file("digits/0.wav");
+        }
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t th_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+        char *a, *b, *c, *d;
+        if (!(a = switch_core_session_strdup(session, tosay))) {
+                return SWITCH_STATUS_FALSE;
+        }
+
+        if (!(b = strchr(a, '.'))) {
+                return SWITCH_STATUS_FALSE;
+        }
+
+        *b++ = '\0';
+
+        if (!(c = strchr(b, '.'))) {
+                return SWITCH_STATUS_FALSE;
+        }
+
+        *c++ = '\0';
+
+        if (!(d = strchr(c, '.'))) {
+                return SWITCH_STATUS_FALSE;
+        }
+
+        *d++ = '\0';
+
+        say_num(atoi(a), method);
+        say_file("digits/dot.wav");
+        say_num(atoi(b), method);
+        say_file("digits/dot.wav");
+        say_num(atoi(c), method);
+        say_file("digits/dot.wav");
+        say_num(atoi(d), method);
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t th_say_time(switch_core_session_t *session,
+                                                                 char *tosay,
+                                                                 switch_say_type_t type,
+                                                                 switch_say_method_t method,
+                                                                 switch_input_args_t *args)
+{
+        int32_t t;
+        switch_time_t target = 0;
+        switch_time_exp_t tm;
+#if 0
+        switch_time_t this_morning;
+        switch_time_exp_t tm2;
+#endif
+        uint8_t say_date = 0;
+ uint8_t say_time = 0;
+
+        if (type == SST_TIME_MEASUREMENT) {
+                int64_t hours = 0;
+                int64_t minutes = 0;
+                int64_t seconds = 0;
+                int64_t r = 0;
+
+                if (strchr(tosay, ':')) {
+                        char *tme = switch_core_session_strdup(session, tosay);
+                        char *p;
+
+                        if ((p = strrchr(tme, ':'))) {
+                                *p++ = '\0';
+                                seconds = atoi(p);
+                                if ((p = strchr(tme, ':'))) {
+                                        *p++ = '\0';
+                                        minutes = atoi(p);
+                                        if (tme) {
+                                                hours = atoi(tme);
+                                        }
+                                } else {
+                                        minutes = atoi(tme);
+                                }
+                        }
+                } else {
+                        if ((seconds = atoi(tosay)) <= 0) {
+                                seconds = (int64_t) switch_epoch_time_now(NULL);
+                        }
+
+                        if (seconds >= 60) {
+                                minutes = seconds / 60;
+                                r = seconds % 60;
+                                seconds = r;
+                        }
+
+                        if (minutes >= 60) {
+                                hours = minutes / 60;
+                                r = minutes % 60;
+                                minutes = r;
+                        }
+                }
+
+                if (hours) {
+                        if (hours == 2) {
+                                say_file("time/2s.wav");
+                         } else {
+                         say_num(hours, SSM_PRONOUNCED);
+                        }
+                        say_file("time/hours.wav");
+                }
+                if (minutes) {
+                        if (minutes == 2) {
+                                say_file("time/2s.wav");
+                         } else {
+                         say_num(minutes, SSM_PRONOUNCED);
+                        }
+                        say_file("time/minute.wav");
+                } else {
+                        if (hours) {
+                                say_file("digits/0.wav");
+                                say_file("time/minute.wav");
+                        }
+                }
+
+                if (seconds) {
+                        if (seconds == 2) {
+                                say_file("time/2s.wav");
+                         } else {
+                         say_num(hours, SSM_PRONOUNCED);
+                        }
+                        say_file("time/seconds.wav");
+                } else {
+                        if (hours || minutes) {
+                                say_file("digits/0.wav");
+                                say_file("time/second.wav");
+                        }
+                }
+
+                return SWITCH_STATUS_SUCCESS;
+        }
+
+        if ((t = atoi(tosay)) > 0)
+                target = switch_time_make(t, 0);
+        else
+                target = switch_micro_time_now();
+        switch_time_exp_lt(&tm, target);
+
+        switch (type) {
+        case SST_CURRENT_DATE_TIME:
+                say_date =
+                say_time = 1;
+                break;
+        case SST_CURRENT_DATE:
+                say_date = 1;
+                break;
+        case SST_CURRENT_TIME:
+                say_time = 1;
+                break;
+        default:
+                break;
+        }
+
+        if (say_date) {
+ say_num(tm.tm_year + 1900, SSM_ITERATED);
+                say_file("time/year.wav");
+                say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
+                say_file("time/month.wav");
+                say_num(tm.tm_mday, SSM_PRONOUNCED);
+                say_file("time/day.wav");
+                say_file("time/day-%d.wav", tm.tm_wday);
+
+#if 0
+ tm = *localtime(&then);
+
+ this_morning = switch_micro_time_now();
+         switch_time_exp_lt(&tm2, this_morning);
+ tm2->tm_hour = 0;
+ tm2->tm_min = 0;
+ tm2->tm_sec = 0;
+ this_morning = mktime(tm2);
+
+ if (this_morning <= then && then < (this_morning + 86400L))
+ {
+                        say_file("time/today.wav");
+ }
+ else if ((this_morning - 86400L) <= then && then < this_morning)
+ {
+                        say_file("time/yesterday.wav");
+ }
+ else if ((this_morning + 86400L) <= then && then < (this_morning + 2*86400L))
+ {
+                        say_file("time/tomorrow.wav");
+ }
+ else if ((this_morning - 7*86400L) <= then && then < this_morning)
+ {
+                 say_file("time/day-%d.wav", tm.tm_wday);
+ }
+ else
+ {
+ if (tm2->tm_year != tm.tm_year)
+ {
+ say_num(tm.tm_year + 1900, SSM_ITERATED);
+                 say_file("time/year.wav");
+ }
+ /*endif*/
+ if (tm2->tm_year != tm.tm_year
+ ||
+ tm2->tm_mon != tm.tm_mon)
+ {
+                 say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
+                 say_file("time/month.wav");
+ }
+ /*endif*/
+ /* Always say the day and the day of the week */
+                 say_num(tm.tm_mday, SSM_PRONOUNCED);
+                 say_file("time/day.wav");
+                 say_file("time/day-%d.wav", tm.tm_wday);
+ }
+#endif
+        }
+
+        if (say_time) {
+                int32_t hour = tm.tm_hour;
+
+                if (hour < 6) {
+ say_file("time/morning.wav");
+                } else if (hour < 12) {
+ say_file("time/am.wav");
+                } else if (tm.tm_hour < 18) {
+ say_file("time/pm.wav");
+                } else {
+ say_file("time/evening.wav");
+                }
+                if (hour > 12)
+                        hour -= 12;
+                if (hour == 0)
+                        hour = 12;
+
+                if (hour == 2) {
+                        say_file("time/2s.wav");
+                } else {
+                        say_num(hour, SSM_PRONOUNCED);
+                }
+                say_file("time/hour.wav");
+                if (tm.tm_min == 2) {
+                        say_file("time/2s.wav");
+                } else {
+                        say_num(tm.tm_min, SSM_PRONOUNCED);
+                }
+                say_file("time/minute.wav");
+        }
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t th_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
+                                                                        switch_input_args_t *args)
+{
+        char sbuf[16] = "";                        /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
+        char *dollars = NULL;
+        char *cents = NULL;
+
+        if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
+                return SWITCH_STATUS_GENERR;
+        }
+
+        dollars = sbuf;
+
+        if ((cents = strchr(sbuf, '.'))) {
+                *cents++ = '\0';
+                if (strlen(cents) > 2) {
+                        cents[2] = '\0';
+                }
+        }
+
+        /* If positive sign - skip over" */
+        if (sbuf[0] == '+') {
+                dollars++;
+        }
+
+        /* If negative say "negative" */
+        if (sbuf[0] == '-') {
+                say_file("currency/negative.wav");
+                dollars++;
+        }
+
+        /* Say dollar amount */
+        th_say_general_count(session, dollars, type, method, args);
+        say_file("currency/dollar.wav");
+
+        /* Say cents */
+        if (cents) {
+                th_say_general_count(session, cents, type, method, args);
+        } else {
+                say_file("digits/0.wav");
+        }
+        say_file("currency/cent.wav");
+
+        return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t th_say(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
+{
+        switch_say_callback_t say_cb = NULL;
+
+        switch (type) {
+        case SST_NUMBER:
+        case SST_ITEMS:
+        case SST_PERSONS:
+        case SST_MESSAGES:
+                say_cb = th_say_general_count;
+                break;
+        case SST_TIME_MEASUREMENT:
+        case SST_CURRENT_DATE:
+        case SST_CURRENT_TIME:
+        case SST_CURRENT_DATE_TIME:
+                say_cb = th_say_time;
+                break;
+        case SST_IP_ADDRESS:
+                say_cb = th_ip;
+                break;
+        case SST_NAME_SPELLED:
+        case SST_NAME_PHONETIC:
+                say_cb = th_spell;
+                break;
+        case SST_CURRENCY:
+                say_cb = th_say_money;
+                break;
+        default:
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+                break;
+        }
+
+        if (say_cb) {
+                return say_cb(session, tosay, type, method, args);
+        }
+
+        return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_say_th_load)
+{
+        switch_say_interface_t *say_interface;
+        /* connect my internal structure to the blank pointer passed to me */
+        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+        say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE);
+        say_interface->interface_name = "th";
+        say_interface->say_function = th_say;
+
+        /* indicate that the module should continue to be loaded */
+        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 expandtab:
+ */
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>