[Freeswitch-svn] [commit] r3900 - in freeswitch/trunk: conf src

Freeswitch SVN anthm at freeswitch.org
Tue Jan 2 19:50:12 EST 2007


Author: anthm
Date: Tue Jan  2 19:50:11 2007
New Revision: 3900

Modified:
   freeswitch/trunk/conf/freeswitch.xml
   freeswitch/trunk/src/switch_utils.c

Log:
add strepoch api call and more say stuff

Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/trunk/conf/freeswitch.xml	Tue Jan  2 19:50:11 2007
@@ -518,6 +518,8 @@
           <action application="phrase" data="timespec,12:45:15"/>
           <action application="phrase" data="saydate,0"/>
           <action application="phrase" data="msgcount,130"/>
+          <action application="phrase" data="ip-addr,66.250.68.194"/>
+          <action application="phrase" data="saydate,$strepoch(2006-03-23 7:23)"/>
           <!--<action application="phrase" data="timeleft,3:30"/>-->
 	</condition>
       </extension>
@@ -694,6 +696,12 @@
 	    <action function="say" data="$1" method="pronounced" type="time_measurement"/>
 	  </input>
 	</macro>
+	<macro name="ip-addr">
+	  <input pattern="(.*)">
+	    <action function="say" data="$1" method="iterated" type="ip_address"/>
+	    <action function="say" data="$1" method="pronounced" type="ip_address"/>
+	  </input>
+	</macro>
 	<macro name="spell">
 	  <input pattern="(.*)">
 	    <action function="say" data="$1" method="pronounced" type="name_spelled"/>

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Tue Jan  2 19:50:11 2007
@@ -131,37 +131,42 @@
     switch_time_t ret = 0;
     char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)";
 
+    switch_time_exp_lt(&tm, switch_time_now());
+    tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
+
     if ((proceed = switch_perform_regex(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-        printf("ASS %d\n", proceed);
-        pcre_copy_substring(in, ovector, proceed, 0, replace, sizeof(replace));
-        tm.tm_year = atoi(replace) - 1900;
-        
+
         if (proceed > 1) {
             pcre_copy_substring(in, ovector, proceed, 1, replace, sizeof(replace));
-            tm.tm_mon = atoi(replace);
+            tm.tm_year = atoi(replace) - 1900;
         }
 
         if (proceed > 2) {
             pcre_copy_substring(in, ovector, proceed, 2, replace, sizeof(replace));
-            tm.tm_mday = atoi(replace);
+            tm.tm_mon = atoi(replace) - 1;
         }
-        
+
         if (proceed > 3) {
             pcre_copy_substring(in, ovector, proceed, 3, replace, sizeof(replace));
-            tm.tm_hour = atoi(replace);
+            tm.tm_mday = atoi(replace)-1;
         }
-
+        
         if (proceed > 4) {
             pcre_copy_substring(in, ovector, proceed, 4, replace, sizeof(replace));
-            tm.tm_min = atoi(replace);
+            tm.tm_hour = atoi(replace);
         }
 
         if (proceed > 5) {
             pcre_copy_substring(in, ovector, proceed, 5, replace, sizeof(replace));
+            tm.tm_min = atoi(replace);
+        }
+
+        if (proceed > 6) {
+            pcre_copy_substring(in, ovector, proceed, 6, replace, sizeof(replace));
             tm.tm_sec = atoi(replace);
         }
 
-        apr_time_exp_get(&ret, &tm);
+        apr_time_exp_gmt_get(&ret, &tm);
         return ret;
     } /* possible else with more patterns later */
     



More information about the Freeswitch-svn mailing list