[Freeswitch-svn] [commit] r13278 - freeswitch/trunk/src/mod/say/mod_say_ru

FreeSWITCH SVN buklov at freeswitch.org
Mon May 11 12:06:08 PDT 2009


Author: buklov
Date: Mon May 11 14:06:08 2009
New Revision: 13278

Log:
rewrite the module

Added:
   freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h
Modified:
   freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c

Modified: freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c	(original)
+++ freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c	Mon May 11 14:06:08 2009
@@ -39,7 +39,6 @@
  * 
  * Anthony Minessale II <anthmct at yahoo.com>
  * Michael B. Murdock <mike at mmurdock.org>
- * Oleg Dolya <oleg.dolya at gmail.com>
  * Boris Buklov <buklov at mail.ru>
  *
  * mod_say_ru.c -- Say for Russian
@@ -49,40 +48,24 @@
 #include <switch.h>
 #include <math.h>
 #include <ctype.h>
+#include "mod_say_ru.h"
+
+//инициализируем массив вариантов произношения цифр описано в define mod_say_ru.h
+struct say_t matrix[7][8]= {{m_00,m_01,m_02,m_03,m_04,m_05,m_06,m_07},
+			    {m_10,m_11,m_12,m_13,m_14,m_15,m_16,m_17},
+			    {m_20,m_21,m_22,m_23,m_24,m_25,m_26,m_27},
+			    {m_30,m_31,m_32,m_33,m_34,m_35,m_36,m_37},
+			    {m_40,m_41,m_42,m_43,m_44,m_45,m_46,m_47},
+			    {m_50,m_51,m_52,m_53,m_54,m_55,m_56,m_57},
+			    {m_60,m_61,m_62,m_63,m_64,m_65,m_66,m_67}};
+
+
 
-typedef enum {
-    male,       //мужского пола
-    female,     //женского
-    it          //оно
-} sex_t;
-            
-            
-            
-typedef enum {
-    how_much,   //сколько  с полом
-    when,       //какого - когда   -- без пола
-    what_       //какая/какой/какое с полом
-} question_t;   //вопрос
-
-typedef enum {
-    million,
-    thousand,
-    zero,
-    empty       
-} unit_t;
 
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load);
 SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_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 = ru_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
-		return tstatus;\
-	}}\
-
 #define say_file(...) {\
 		char tmp[80];\
 		switch_status_t tstatus;\
@@ -95,1010 +78,175 @@
 		}}\
 
 
-static switch_status_t ru_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 >= 48 && a <= 57) {
-			say_file("digits/%d.wav", a - 48);
-		} 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);
-			}
-		}
+static char *strip_commas(char *in, char *out, switch_size_t len)
+{
+        char *p = in, *q = out;
+        char *ret = out;
+        switch_size_t x = 0;
+                
+        for (; p && *p; p++) {
+            if ((*p > 47 && *p < 58)) {
+                *q++ = *p;
+            } else if (*p != ',') {
+        	ret = NULL;
+        	break;
+            }
+    	    if (++x > len) {
+                ret = NULL;
+                break;
+            }
 	}
-
-	return SWITCH_STATUS_SUCCESS;
+        return ret;
 }
 
-//воспроизводить по 3 цифры
-static switch_status_t play_group( sex_t sex,question_t question, int a, int b, int c,
-                                            unit_t what,int last, switch_core_session_t *session, switch_input_args_t *args)
+
+static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
 {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d   sex=%d  q=%d  last=%d\n", a,b,c,sex,question,last);
-    if (a)    {
-        if ((b==0)||(c==0)) { // если b и с равны 0 то сказать шестьсот, сестисотый, шестисотая
-            switch (question)    {
-//------------------------------------------------------            
-        	    case how_much:  //сколько  когда дальше нету цифр например 100 200...
-        		switch (sex) { //пол 		
-        		    case male: //мужчина
-    				say_file("digits/%d00.wav", a); //сто
-				if (what==thousand)   {
-        			    say_file("digits/thousands.wav");//тысяч
-        	    		}
-				else if (what==million)   {
-        			    say_file("digits/millions.wav");//миллионов
-        	    		}
-				//-------------    	        	        	    
-			        break;
-			          
-        		    case   female:   //женщина
-    				say_file("digits/%d00.wav", a);//сто
-				if (what==thousand)   {
-        			    say_file("digits/thousands.wav");//тысяч
-        	    		}
-				else if (what==million)   {
-        			    say_file("digits/millions.wav");//миллионов
-        	    		}
-        		    	break;
-        		    	//-------------
-        		    case     it:   //оно
-        			say_file("digits/%d00.wav", a);//сто
-				if (what==thousand)   {
-        			    say_file("digits/thousands.wav"); //тысяч
-        	    		}
-				else if (what==million)   {
-        			    say_file("digits/millions.wav");//миллионов
-        	    		}
-        		        break;
-        		        //-------------
-        		}
-        	        break;	
-//------------------------------------------------------
-	            case what_:	//какой/я/ое
-        		switch (sex) { //пол 		
-        		    case   male:   //мужчина
-				if (what==thousand)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionx.wav");//тысячный
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/thousands.wav");//тысяч
-				    }
-				}
-				else if (what==million)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionm.wav");//Миллионный
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/millions.wav");//миллионов
-				    }
-        	    		}
-        	    		else {
-        	    		    say_file("digits/h-%d00m.wav", a);//сотый двухсотый
-        	    		}
-        			break;
-        			   
-        		    case female: //женщина
-				if (what==thousand)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionf.wav");//тысячная
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/thousands.wav");//тысяч
-				    }
-				}
-				else if (what==million)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionf.wav");//Миллионная
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/millions.wav");//миллионов
-				    }
-        	    		}
-        	    		else {
-        	    		    say_file("digits/h-%d00f.wav", a);//сотая двухсотая
-        	    		}
-        		    	break;
-        		    case     it:   //оно
-				if (what==thousand)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionn.wav");//тысячное
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/thousands.wav");//тысяч
-				    }
-				}
-				else if (what==million)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionn.wav");//Миллионное
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/millions.wav");//миллионов
-				    }
-        	    		}
-        	    		else {
-        	    		    say_file("digits/h-%d00n.wav", a);//сотого
-        	    		}
-        		    	break;
-    		    }
-    		    break;
-//-------------------------------------------------------
-        	    case     when:	//какого - когда  без пола
-				if (what==thousand)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionx.wav");//тысячного
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/thousands.wav");//тысяч
-				    }
-				}
-				else if (what==million)   {
-				    if (last==0) {
-					say_file("digits/h-%d00xx.wav", a);//двухсот
-        				say_file("digits/h-millionx.wav");//Миллионного
-				    }
-				    else {
-					say_file("digits/%d00.wav", a);//двести
-        				say_file("digits/millions.wav");//миллионов
-				    }
-        	    		}
-        	    		else {
-        	    		    say_file("digits/h-%d00x.wav", a);//сотого
-        	    		}
-        	           break;
-    	    } //end switch (question)
-    	}//end if ((b==0)||(c==0))
-    	else // если есть ещё цифры
-    	{
-    	    switch (question) {
-    		case how_much:
-    		    say_file("digits/%d00.wav", a); //просто сто и тд
-    		    break;
-    		case what_:
-    		    if (last==0)  {
-    			say_file("digits/h-%d00xx.wav", a);
-    		    }
-    		    else   {
-    			say_file("digits/%d00.wav", a); //сто
-    		    }
-    		    break;
-    		case when:
-    		    if (last==0)  {
-    			say_file("digits/h-%d00xx.wav", a);
-    		    }
-    		    else   {
-    			say_file("digits/%d00.wav", a); //сто
-    		    }
-    		    break;
-    	    }
-    	}
-    }//end if (a)
-    if (b) // если b больше 0
-    {
-        if (b > 1)  {   //если цифры больше 19
-    	    if (c==0)  {  // если c == нолю 20-30-40-50
-    		switch (question)    {
-//------------------------------------------------------            
-        	    case how_much:  //сколько  когда дальше нету цифр например 10 20...
-        		switch (sex) { //пол 		
-        		    case male: //мужчина
-    				say_file("digits/%d0.wav", b); //двадцать
-        			if (what==thousand)  {
-        	    	    	    say_file("digits/thousands.wav", b); //тысяч
-        	    	        }
-        			else if (what==million)  {
-        	    	    	    say_file("digits/millions.wav", b); //миллионов
-        	    	        }
-				//-------------    	        	        	    
-			        break;
-			          
-        		    case   female:   //женщина
-    				say_file("digits/%d0.wav", b);//двадцать
-        			if (what==thousand)  {
-        	    	    	    say_file("digits/thousands.wav", b); //тысяч
-        	    	        }
-        			else if (what==million)  {
-        	    	    	    say_file("digits/millions.wav", b); //миллионов
-        	    	        }
-        		    	break;
-        		    	//-------------
-        		    case     it:   //оно
-        			say_file("digits/%d0.wav", b);// двадцать
-        			if (what==thousand)  {
-        	    	    	    say_file("digits/thousands.wav", b); //тысяч
-        	    	        }
-        			else if (what==million)  {
-        	    	    	    say_file("digits/millions.wav", b); //миллионов
-        	    	        }
-        		        break;
-        		        //-------------
-        		}
-        	        break;	
-//------------------------------------------------------
-	            case what_:	//какой/я/ое >19 и c==0 20-30-40
-        		switch (sex) { //пол 		
-        		    case   male:   //мужчина
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-thousandm.wav", b); //тысячный
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-millionm.wav", b); //миллионный
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d0m.wav", b);//двадцатый
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d0.wav", b);//двадцать
-        	    	    	    }
-        	    	        }
-				break;
-        		    case female: //женщина
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-thousandf.wav", b); //тысячная
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-millionf.wav", b); //миллионная
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d0f.wav", b);//двадцатая
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d0.wav", b);//двадцать
-        	    	    	    }
-        	    	        }
-        		    	break;
-        		    case     it:   //оно
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-thousandn.wav", b); //тысячное
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-millionn.wav", b); //миллионное
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d0n.wav", b);//двадцатое
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d0.wav", b);//двадцать
-        	    	    	    }
-        	    	        }
-        		    	break;
-        		}
-        		break;
-//-------------------------------------------------------
-        	    case     when:	//какого - когда  без пола
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-thousandx.wav", b); //тысячного
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d0xx.wav", b);//двадцати
-        			        say_file("digits/h-millionx.wav", b); //миллионного
-        			    }
-        			    else {
-        				say_file("digits/%d0.wav", b);//двадцать
-        			        say_file("digits/h-thousand.wav", b); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d0x.wav", b);//двадцатого
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d0.wav", b);//двадцать
-        	    	    	    }
-        	    	        }
-        	        	break;
-        	}
-    	    }//конец если c == нолю
-    	    else 
-    	    {
-    		say_file("digits/%d0.wav", b); // иначе просто двадцать .. и тд
+    char *p = in, *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 > 47 && *p < 58) || *p == '.' || *p == '-' || *p == '+') {
+            *q++ = *p;
+        }
+        if (++x > len) {
+            ret = NULL;
+            break;
+        }
+    }
+    return ret;
+}
+                        
+                        
+static switch_status_t ru_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 >= 48 && a <= 57) {
+            say_file("digits/%d.wav", a - 48);
+        } 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);
     	    }
-	}//конец если больше 19
-	else { //если цифры меньше 20
-	    switch (question)    {
-//------------------------------------------------------            
-    		case how_much:  //сколько  когда от 10 до 19
-    		    switch (sex) { //пол 		
-    			case male: //мужчина
-			    say_file("digits/%d%d.wav",b ,c); //девятнадцать
-        		    if (what==thousand)  {
-        	    	        say_file("digits/thousands.wav"); //тысяч
-        	    	    }
-        		    else if (what==million)  {
-        	    	        say_file("digits/millions.wav"); //миллионов
-        	    	    }
-			    //-------------    	        	        	    
-		    	    break;
-    			case   female:   //женщина
-			    say_file("digits/%d%d.wav",b ,c);//девятнадцать
-        		    if (what==thousand)  {
-        	    	        say_file("digits/thousands.wav"); //тысяч
-        	    	    }
-        		    else if (what==million)  {
-        	    	        say_file("digits/millions.wav"); //миллионов
-        	    	    }
-    		    	    break;
-    		    	    //-------------
-    			case     it:   //оно
-    			    say_file("digits/%d%d.wav",b ,c);// девятнадцать
-        		    if (what==thousand)  {
-        	    	        say_file("digits/thousands.wav"); //тысяч
-        	    	    }
-        		    else if (what==million)  {
-        	    	        say_file("digits/millions.wav"); //миллионов
-        	    	    }
-    		    	    break;
-    		    	    //-------------
-    		    }
-    		    break;
-//------------------------------------------------------
-        	case what_:	//какой/я/ое
-    		    switch (sex) { //пол 		
-    			case male: //женщина
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-thousandm.wav"); //тысячный
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнацать
-        			        say_file("digits/h-thousand.wav"); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-millionm.wav"); //миллионный
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнадцать
-        			        say_file("digits/h-thousand.wav"); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d%dm.wav", b,c);//девятнадцатый
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d%d.wav");//девятнадцать
-        	    	    	    }
-        	    	        }
-    			case female: //женщина
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-thousandf.wav"); //тысячная
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнацать
-        			        say_file("digits/h-thousand.wav"); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-millionf.wav"); //миллионная
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнадцать
-        			        say_file("digits/h-thousand.wav"); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d%df.wav", b,c);//девятнадцатая
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d%d.wav");//девятнадцать
-        	    	    	    }
-        	    	        }
-    		    	    break;
-    			case     it:   //оно
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-thousandn.wav"); //тысячное
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнацать
-        			        say_file("digits/h-thousand.wav"); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-millionn.wav"); //миллионное
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнадцать
-        			        say_file("digits/h-thousand.wav"); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d%dn.wav", b,c);//девятнадцатое
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d%d.wav");//девятнадцать
-        	    	    	    }
-        	    	        }
-    		    	    break;
-    		    }
-    		    break;
-//-------------------------------------------------------
-        	case    when:	//какого - когда  без пола
-        			if (what==thousand)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-thousandx.wav"); //тысячного
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнацать
-        			        say_file("digits/h-thousand.wav"); //тысяч
-        			    }
-        	    	        }
-        			else if (what==million)  {
-        			    if (last==0) {
-        				say_file("digits/h-%d%dxx.wav", b,c);//десяти, пятнадцати ..
-        			        say_file("digits/h-millionx.wav"); //миллионного
-        			    }
-        			    else {
-        				say_file("digits/%d%d.wav", b,c);//девятнадцать
-        			        say_file("digits/h-thousand.wav"); //миллионов
-        			    }
-        	    	        }
-        	    	        else { //без миллионов и тысяч
-        	    	    	    if (last==0)  {
-        	    	    		 say_file("digits/h-%d%dx.wav", b,c);//девятнадцатого
-        	    	    	    }
-        	    	    	    else {
-        	    	    		 say_file("digits/%d%d.wav");//девятнадцать
-        	    	    	    }
-        	    	        }
-
-        	    		break;
-    	    }//конец если c == нолю
-    	    c=0; //что бы не проговаривать c
-	}// конец //если цифры меньше 20
-    }//конец if (b)
-    
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group  c \n");
-    
-
-                                                                                                 
-    if ((c)||(what==zero)) {// последняя цифра (самая сложная) или проговорить ноль , для случает когда первые цифры нули
-	if (c>2||c==0) {//0 и 3-9
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group  c 1\n");
-
-    	    switch (question)    
-    	    {
-//------------------------------------------------------            
-    		case how_much:  //сколько  3-9
-    		    switch (sex) 
-    		    { //пол 		
-    			case male: //мужчина
-    			    if (what==thousand)  { //тысяч
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три - четыре
-    				    say_file("digits/thousands-i.wav"); //тысячи
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/thousands.wav"); //тысяч
-    				}
-        	    	    }
-        	    	    else if (what==million) { //миллионов
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три четыре
-    				    say_file("digits/million-a.wav"); //миллиона
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/millions.wav"); //миллионов
-    				}
-    			    }
-    			    else {
-				say_file("digits/%d.wav", c);// три девять ноль
-			    }
-		    	    break;
-		    	    
-    			case   female:   //женщина
-    			    if (what==thousand)  { //тысяч
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три - четыре
-    				    say_file("digits/thousands-i.wav"); //тысячи
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/thousands.wav"); //тысяч
-    				}
-        	    	    }
-        	    	    else if (what==million) { //миллионов
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три четыре
-    				    say_file("digits/million-a.wav"); //миллиона
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/millions.wav"); //миллионов
-    				}
-    			    }
-    			    else {
-				say_file("digits/%d.wav", c);// три девять ноль
-			    }
-    		    	    break;
-
-    		    	    //-------------
-    			case     it:   //оно
-    			    if (what==thousand)  { //тысяч
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три - четыре
-    				    say_file("digits/thousands-i.wav"); //тысячи
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/thousands.wav"); //тысяч
-    				}
-        	    	    }
-        	    	    else if (what==million) { //миллионов
-    				if ((c>2)&&(c<5)) {
-    				    say_file("digits/%d.wav", c);// три четыре
-    				    say_file("digits/million-a.wav"); //миллиона
-    				} 
-    				else{
-    				    say_file("digits/%d.wav", c);// пять .. девять
-    				    say_file("digits/millions.wav"); //миллионов
-    				}
-    			    }
-    			    else {
-				say_file("digits/%d.wav", c);// три девять ноль
-			    }
-    		    	    break;
-		    }		
-		    break;
-//------------------------------------------------------
-    		case what_:	//какой/я/ое
-    		    switch (sex) 
-    		    { //пол 		
-    			case   male:   //мужчина
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-thousandm.wav"); //тысячный
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-millionm.wav"); //миллионный
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dm.wav", c);//третий нулевой ..
-        	    	    }
-    			    break;
-    			case female: //женщина
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-thousandf.wav"); //тысячная
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-millionf.wav"); //миллионная
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%df.wav", c);//третья нулевая ..
-        	    	    }
-    		    	    break;
-    			case it: //оно
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-thousandn.wav"); //тысячное
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-millionn.wav"); //миллионное
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dn.wav", c);//третье нулевое ..
-        	    	    }
-    		    	    break;
-    		    }
-    		    break;
-//-------------------------------------------------------
-        	case     when:	//какого - когда  без пола
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-thousandx.wav"); //тысячного
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-        	    	    	    say_file("digits/h-millionx.wav"); //миллионого
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dx.wav", c);//третьего нулевого ..
-        	    	    }
-    		    	    break;
-    	    }//конец switch (question)	
-    	} //конец //0 и 3-9
-	else if ((c==2)||(c==1)) {  //1 2	
-    	    switch (question)    {
-//------------------------------------------------------            
-    		case how_much:  //
-    		    switch (sex) 
-    		    { //пол 		
-    			case male: //мужчина
-    			    if (what==thousand)  {
-    				    if (c==1)  {    				    
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousand.wav"); //тысяча
-    				    }
-    				    else{
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousands-i.wav"); //тысячи
-    				    }
-        	    	    }
-    			    else if (what==million)  {
-			    	    say_file("digits/%d.wav", c); // один два
-    				    if (c==1) {
-    					say_file("digits/million.wav", c); //миллион
-    				    }
-    				    else   { //один два
-    					say_file("digits/million-a.wav"); // миллиона
-    				    }
-    			    } 
-			    else   { //просто один два 
-    				say_file("digits/%d.wav", c); // один два
-    			    }
-		    	    break;
-			    //-------------    	        	        	    
-    			case   female:   //женщина
-    			    if (what==thousand)  {
-    				    if (c==1)  {    				    
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousand.wav"); //тысяча
-    				    }
-    				    else{
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousands-i.wav"); //тысячи
-    				    }
-        	    	    }
-    			    else if (what==million)  {
-			    	    say_file("digits/%d.wav", c); // один два
-    				    if (c==1) {
-    					say_file("digits/million.wav"); //миллион
-    				    }
-    				    else   { //один два
-    					say_file("digits/million-a.wav"); // миллиона
-    				    }
-    			    } 
-			    else   { //просто одна две
-    				say_file("digits/%df.wav", c); // одна две
-    			    }
-    			    break;
-    		    	    //-------------
-    			case     it:   //оно
-    			    if (what==thousand)  {
-    				    if (c==1)  {    				    
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousand.wav"); //тысяча
-    				    }
-    				    else{
-    					say_file("digits/%df.wav", c); // одна две
-    					say_file("digits/thousands-i.wav"); //тысячи
-    				    }
-        	    	    }
-    			    else if (what==million)  {
-			    	    say_file("digits/%d.wav", c); // один два
-    				    if (c==1) {
-    					say_file("digits/million.wav"); //миллион
-    				    }
-    				    else   { //один два
-    					say_file("digits/million-a.wav"); // миллиона
-    				    }
-    			    } 
-			    else   { //просто одно две
-    				say_file("digits/%dn.wav", c); // одна две
-    			    }
-    		    	    break;
-		    }
-		    break;		
-//------------------------------------------------------
-    		case what_:	//какой/я/ое
-    		    switch (sex) 
-    		    { //пол 		
-    			case male: //мужчина
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух,одна 2-х, ...
-    				    if (c!=1) { //не произность одна тысячный
-    					say_file("digits/h-%dxx.wav", c);//одна, двух
-    				    }
-        	    	    	    say_file("digits/h-thousandm.wav"); //тысячный
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%df.wav", c);//одна две
-        	    	    	    say_file("digits/thousands-i.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    if (c!=1)  {
-    					say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-    				    }
-        	    	    	    say_file("digits/h-millionm.wav"); //миллионный
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand-a.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dm.wav", c);//третий нулевой ..
-        	    	    }
-    		    	    break;
-    			case female: //женщина
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 1-х, 2-х ...
-    				    if (c!=1) { //не произность одна тысячная
-    					say_file("digits/h-%dxx.wav", c);//одна, двух
-    				    }
-        	    	    	    say_file("digits/h-thousandf.wav"); //тысячная
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%df.wav", c);//две четыре ..
-        	    	    	    say_file("digits/thousands-i.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    if (c!=1)  {
-    					say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-    				    }
-        	    	    	    say_file("digits/h-millionf.wav"); //миллионная
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand-a.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%df.wav", c);//третья нулевая ..
-        	    	    }
-    		    	    break;
-    			case     it:   //оно
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 1-х, 2-х ...
-    				    if (c!=1) { //не произность одна тысячное
-    					say_file("digits/h-%dxx.wav", c);//одна, двух
-    				    }
-        	    	    	    say_file("digits/h-thousandn.wav"); //тысячное
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%df.wav", c);//две ..
-        	    	    	    say_file("digits/thousands-i.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    if (c!=1)  {
-    					say_file("digits/h-%dxx.wav", c);//одна, двух
-    				    }
-        	    	    	    say_file("digits/h-millionn.wav"); //миллионное
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand-a.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dn.wav", c);//третье нулевое ..
-        	    	    }
-    		    	    break;
-    		}
-    		break;
-//-------------------------------------------------------
-        	case     when:	//какого - когда  без пола
-    			    if (what==thousand)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    if (c!=1) { //не произность одна тысячного
-    					say_file("digits/h-%dxx.wav", c);//одна, двух
-    				    }
-        	    	    	    say_file("digits/h-thousandx.wav"); //тысячного
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%df.wav", c);//две четыре ..
-        	    	    	    say_file("digits/thousands-i.wav"); //тысячи
-        	    	    	}
-        	    	    }
-    			    else if (what==million)  {
-    				if (last==0) {// если дальше нету цифр значит говорить двух, 3-х, 4-х ...
-    				    if (c!=1)  {
-    					say_file("digits/h-%dxx.wav", c);//одна, двух, трёх
-    				    }
-        	    	    	    say_file("digits/h-millionx.wav"); //миллионного
-        	    	    	}
-        	    	    	else { //если есть дальше цифры меньше 1000
-    				    say_file("digits/%d.wav", c);//три четыре ..
-        	    	    	    say_file("digits/thousand-a.wav"); //миллиона
-        	    	    	}
-        	    	    }//просто цифры без тысяч
-        	    	    else{
-    				    say_file("digits/h-%dx.wav", c);//третьего нулевого ..
-        	    	    }
-    		    	    break;
-    	    }	
-    	}//else if ((c==2)||(c==1)) {  //1 2
-	
-    }//конец if ((c)||(what=="zero"))
+	}
+    }
     return SWITCH_STATUS_SUCCESS;
-}                             
-               
+}
+                                                                                                                                                                                                                                                                                        
+                                                                                                                                                                                                
 
+static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int b, int c,
+                            unit_t what, switch_core_session_t *session, switch_input_args_t *args)
+{
+//    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "a= %d b=%d c=%d  what=%d!\n", a, b, c,what);
 
+    if (a)    {
+	if (((b==0)&&(c==0))||(matrix[casus][say_type].all==1))       { //если b и с равны 0 то сказать шестьсот, сестисотый, шестисотая
+	    if (what==million)	{              //префикс		      число          окончание
+		say_file("digits/%s%d00%s.wav",matrix[casus][say_type].million[12], a, matrix[casus][say_type].million[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+	    }
+	    else if (what==thousand){
+		say_file("digits/%s%d00%s.wav",matrix[casus][say_type].thousand[12], a, matrix[casus][say_type].thousand[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+	    }
+	    else {
+		say_file("digits/%s%d00%s.wav",matrix[casus][say_type].num[6], a, matrix[casus][say_type].num[7]);
+	    }
+	}
+	else { //если дальше есть цифры то тысячи и миллионы не прозносить пока
+	    say_file("digits/%d00.wav",a);
+//	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d - круглые цифры\n",a);
+	}
+//	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "выходим из a");
+    }
 
-static char *strip_commas(char *in, char *out, switch_size_t len)
-{
-	char *p = in, *q = out;
-	char *ret = out;
-	switch_size_t x = 0;
-
-	for (; p && *p; p++) {
-		if ((*p > 47 && *p < 58)) {
-			*q++ = *p;
-		} else if (*p != ',') {
-			ret = NULL;
-			break;
+//    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play b\n");
+    
+    if (b)    {
+	if (b>1)  { //если 20 и больше
+	    if ((c==0)||(matrix[casus][say_type].all==1))  { //если с равны 0 то сказать 20, двадцати, двадцатая
+		if (what==million)	{              //префикс		      число          окончание
+		    say_file("digits/%s%d0%s.wav",matrix[casus][say_type].million[12], b, matrix[casus][say_type].million[13]);
+		    say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+		}
+		else if (what==thousand){
+		    say_file("digits/%s%d0%s.wav",matrix[casus][say_type].thousand[12], b, matrix[casus][say_type].thousand[13]);
+		    say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
 		}
-
-		if (++x > len) {
-			ret = NULL;
-			break;
+		else {
+		    say_file("digits/%s%d0%s.wav",matrix[casus][say_type].num[6], b, matrix[casus][say_type].num[7]);
 		}
+	    }
+	    else { //если есть дальше цифры
+		say_file("digits/%d0.wav",b);
+	    }
 	}
-
-	return ret;
-}
-
-static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
-{
-	char *p = in, *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 > 47 && *p < 58) || *p == '.' || *p == '-' || *p == '+') {
-			*q++ = *p;
+	else  { //от 10 до 19
+	    if (what==million)      {
+		say_file("digits/%s%d%d%s.wav",matrix[casus][say_type].million[12], b, c, matrix[casus][say_type].million[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+	    }
+	    else if (what==thousand)      {
+		say_file("digits/%s%d%d%s.wav",matrix[casus][say_type].thousand[12], b, c, matrix[casus][say_type].thousand[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+	    }
+	    else { //просто произнести цифры с префиксом и окончанием
+		say_file("digits/%s%d%d%s.wav",matrix[casus][say_type].num[6], b, c, matrix[casus][say_type].num[7]);
+	    }
+	    c=0;
+	}
+    }
+//    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play c\n");
+    if (c||what==zero)    {
+//	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play c= %d   in matrix=%s  what=%d  say_type=%d casus=%d\n", c,matrix[casus][say_type].num[c],what,say_type,casus);	
+	if (c<=5)	{
+//	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "c=%d c<=5\n",c);
+	    if (what==million) {
+		if ((strlen(matrix[casus][say_type].million[c*2])) > 0) {  // не произносить если не заданно например 1 миллион а просто миллион
+		    say_file("digits/%s.wav", matrix[casus][say_type].million[c*2])
 		}
-
-		if (++x > len) {
-			ret = NULL;
-			break;
+		say_file("digits/%s.wav", matrix[casus][say_type].million[c*2+1]);
+	    }
+	    else if (what==thousand)      {
+		if ((strlen(matrix[casus][say_type].thousand[c*2])) > 0)  {// // не произносить если не заданно например одна тысячас  а просто тысяча
+		    say_file("digits/%s.wav",matrix[casus][say_type].thousand[c*2])
 		}
+		say_file("digits/%s.wav", matrix[casus][say_type].thousand[c*2+1]);
+	    }
+	    else { //просто произнести цифры с префиксом и окончанием
+//		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play c= %d   in matrix=%s!\n", c,matrix[casus][say_type].num[c]);
+		say_file("digits/%s.wav",matrix[casus][say_type].num[c]);
+	    }
 	}
-
-	return ret;
-}
+	else //больше 5
+	{
+//	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "c=%d c>5\n",c);
+	    if (what==million)      {
+		say_file("digits/%s%d%s.wav",matrix[casus][say_type].million[12],  c, matrix[casus][say_type].million[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
+	    }
+	    else if (what==thousand)      {
+		say_file("digits/%s%d%s.wav",matrix[casus][say_type].thousand[12], c, matrix[casus][say_type].thousand[13]);
+		say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
+	    }
+	    else { //просто произнести цифры с префиксом и окончанием
+		say_file("digits/%s%d%s.wav",matrix[casus][say_type].num[6], c, matrix[casus][say_type].num[7]);
+	    }
+	}
+    }
+    return SWITCH_STATUS_SUCCESS;
+}                                                                                                                                                                                                                                                                                                    
 
 
 static switch_status_t ru_say_count(switch_core_session_t *session,
-    char *tosay, sex_t sex, question_t question, switch_input_args_t *args)
+    char *tosay, say_type_t say_type, casus_t casus, switch_input_args_t *args)
 {
     	int in;
 	int x = 0;
@@ -1107,7 +255,7 @@
 	
 	switch_status_t status;
 
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %d %d %d other!\n", places[2], places[1], places[0]);
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %s!\n", tosay);
 	
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -1116,7 +264,7 @@
 	
 	in = atoi(tosay);
 	int in_ = in;
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "int in=%d!\n", in);
+//        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "int in=%d!\n", in);
 	if (in != 0) {
 		for (x = 8; x >= 0; x--) {
 			int num = (int) pow(10, x);
@@ -1124,23 +272,45 @@
 				in -= places[(uint32_t) x] * num;
 			}
 		}
-    		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "int in=%d \n", in);
-
-			if ((status = play_group(sex,question, places[8], places[7], places[6], million,in%1000000, session, args)) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million!\n", places[8], places[7], places[6]);
-				return status;
+//			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "a=%d b=%d c=%d\n", places[8],places[7],places[6]);
+//миллионы		
+			if (places[8]||places[7]||places[6])	{
+			    if ((in_%1000000>0)&&(matrix[casus][say_type].all!=1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+				if ((status = play_group(male_c,nominativus, places[8], places[7], places[6],million,  session, args)) != SWITCH_STATUS_SUCCESS) {
+            			    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+				    return status;
+				}
+			    } 
+			    else        {// иначе произнести в нужном падеже
+				if ((status = play_group(say_type,casus, places[8], places[7], places[6],million, session, args)) != SWITCH_STATUS_SUCCESS) {
+            			    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+				    return status;
+				}
+			    }
 			}
-			if ((status = play_group(sex,question, places[5], places[4], places[3], thousand,in_%1000,session, args)) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand!\n", places[5], places[4], places[3]);
-				return status;
+//тысячи		
+			if (places[5]||places[4]||places[3])	{
+			    if ((in_%1000>0)&&(matrix[casus][say_type].all!=1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+				if ((status = play_group(male_c,nominativus, places[5], places[4], places[3],thousand,  session, args)) != SWITCH_STATUS_SUCCESS) {
+            			    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+				    return status;
+				}
+			    } 
+			    else        {// иначе произнести в нужном падеже
+				if ((status = play_group(say_type,casus, places[5], places[4], places[3], thousand,session, args)) != SWITCH_STATUS_SUCCESS) {
+            			    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+				    return status;
+				}
+			    }
 			}
-			if ((status = play_group(sex,question, places[2], places[1], places[0], empty, 0,session, args)) != SWITCH_STATUS_SUCCESS) 
-			{
-	                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]);
+// сотни
+			if ((status = play_group(say_type,casus, places[2], places[1], places[0], empty, session, args)) != SWITCH_STATUS_SUCCESS) {
+            		    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
 			    return status;
 			}
-	} else { //если ноль что бы и его проговаривать в правильных падежах
-	    if ((status = play_group(sex,question, places[2], places[1], places[0], zero,0, session, args)) != SWITCH_STATUS_SUCCESS) 
+	} 
+	else { 
+	    if ((status = play_group(say_type, casus, places[2], places[1], places[0], zero, session, args)) != SWITCH_STATUS_SUCCESS) 
 	    {
 	        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]);
 	        return status;
@@ -1150,296 +320,291 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
+//дописать
 static switch_status_t ru_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)
 {
 	switch_status_t status;
-	sex_t sex;
-	question_t question;
-
-        if (type== SST_MESSAGES)
-        {
-	    sex=it;
-	    question=how_much;
-        }
-        else if (type== SST_NUMBER||type==SST_PERSONS)
-        {
-            sex=male;
-            question=how_much;
-        }
-        else if (type== SST_ITEMS)
-        {
-            sex=male;
-            question=what_;
-        }
-        else 
-        {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
-    	    return SWITCH_STATUS_FALSE;
-        }    
-	status=ru_say_count(session,tosay,sex,question,args);	
-	return SWITCH_STATUS_SUCCESS;
+	casus_t casus; //падеж
+	say_type_t say_type;//тип произношения
+	
+	switch (type) {
+	    case SST_MESSAGES:
+                say_type=it_c;
+                casus=nominativus;
+		break;
+	    default:
+                say_type=male_c;
+                casus=nominativus;
+		break;                                                	    
+	};
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " type=%d   casus=%d\n", say_type,casus);
+	status=ru_say_count(session,tosay,say_type,casus,args);
+	return status;
+//	return SWITCH_STATUS_SUCCESS;
 }
-
+               
 
 
 static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type,
-                switch_say_method_t method,switch_input_args_t *args)
+        switch_say_method_t method,switch_input_args_t *args)
 {
-        char sbuf[16] = "";                    
-        char *rubles = NULL;
-        char *kopecks = NULL;
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n",tosay );
-        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;
-        }
-        rubles = sbuf;
-
-        if ((kopecks = strchr(sbuf, '.'))) {
-                *kopecks++ = '\0';
-                if (strlen(kopecks) > 2) {
-                        kopecks[2] = '\0';
-                }
-        }
-        if (sbuf[0] == '+') {
-                rubles++;
-        }
+    char sbuf[16] = "";
+    char *rubles = NULL;
+    char *kopecks = NULL;
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n",tosay );
+    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;
+    }
+    rubles = sbuf;
+    if ((kopecks = strchr(sbuf, '.'))) {
+            *kopecks++ = '\0';
+            if (strlen(kopecks) > 2) {
+        	kopecks[2] = '\0';
+	    }
+    }
+    if (sbuf[0] == '+') {
+        rubles++;
+    }
+    if (sbuf[0] == '-') {
+        say_file("currency/minus.wav");
+        rubles++;
+    }
+    
+    ru_say_count(session,rubles ,male_c,nominativus ,args);
+    int irubles = atoi(rubles)%100;
+    int iruble = atoi(rubles)%10;
+    if (irubles == 1 || (irubles > 20 && iruble == 1)) {/* рубль */
+        say_file("currency/ruble.wav");
+    }
+    else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5))  {  /*рубля */
+        say_file("currency/ruble-a.wav");
+    }
+    else  {    /*рублей */
+        say_file("currency/rubles.wav");
+    }
 
-        if (sbuf[0] == '-') {
-                say_file("currency/minus.wav");
-                rubles++;
-        }
-	    ru_say_count(session,rubles ,male,how_much,args);
-    	    int irubles = atoi(rubles)%100;
-    	    int iruble = atoi(rubles)%10;
-    	    if (irubles == 1 || (irubles > 20 && iruble == 1)) {/* рубль */
-		say_file("currency/ruble.wav");
-    	    } 
-    	    else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5))  {  /*рубля */
-        	say_file("currency/ruble-a.wav");
-    	    } 
-    	    else  {    /*рублей */
-    		say_file("currency/rubles.wav");
-    	    }
-        /* Say kopecks */
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n",kopecks );
-	    ru_say_count(session,kopecks ,female,how_much,args);
-            int ikopecks = atoi(kopecks)%100;
-            int ikopeck = atoi(kopecks)%10;
-            if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) 
-            {
-                /* копейка */
-                say_file("currency/kopeck.wav");
-            } 
-            else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) 
-            {
-        	/* копейки */
-                say_file("currency/kopeck-i.wav");
-            }
-            else 
-            {
-        	/* копеек */
-                say_file("currency/kopecks.wav");
-            }
+    /* Say kopecks */
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n",kopecks );
+    ru_say_count(session,kopecks ,female_c,nominativus ,args);
+
+    int ikopecks = atoi(kopecks)%100;
+    int ikopeck = atoi(kopecks)%10;
+    if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1))
+    {
+        /* копейка */
+        say_file("currency/kopeck.wav");
+    }
+    else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5))
+    {
+        /* копейки */
+        say_file("currency/kopeck-i.wav");
+    }
+    else
+    {
+        /* копеек */
+        say_file("currency/kopecks.wav");
+    }
     return SWITCH_STATUS_SUCCESS;
 }
+   
 
 
 static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
-								   switch_input_args_t *args)
+                                                                   switch_input_args_t *args)
 {
-	int32_t t;
-	char tmp[80];
-	switch_time_t target = 0, target_now = 0;
-	switch_time_exp_t tm, tm_now;
-	uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	const char *tz = switch_channel_get_variable(channel, "timezone");
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n",tosay, type,method );
-	
-	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 = atol(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;
-			}
-		}
+        int32_t t;
+        char tmp[80];
+        switch_time_t target = 0, target_now = 0;
+        switch_time_exp_t tm, tm_now;
+        uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        const char *tz = switch_channel_get_variable(channel, "timezone");
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n",tosay, type,method );
+
+        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 = atol(tosay)) <= 0) {
+                                seconds = (int64_t) switch_epoch_time_now(NULL);
+                        }
+
+                        if (seconds >= 60) {
+                                minutes = seconds / 60;
+                                r = seconds % 60;
+                        }
+
+                        if (minutes >= 60) {
+                                hours = minutes / 60;
+                                r = minutes % 60;
+                                minutes = r;
+                        }
+                }
 
-		switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)hours);
-		ru_say_count(session,tmp ,male,how_much,args);
-        	if (((hours%10) == 1) && (hours!=11)) {
+                switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)hours);
+                ru_say_count(session,tmp ,male_c,nominativus,args);
+                if (((hours%10) == 1) && (hours!=11)) {
                 /* час */
-		    say_file("time/hour.wav");
-		} 
-		else if (((hours%10>1)&&(hours%10<5)) &&((hours<12)||(hours>14))) {
-		    say_file("time/hours-a.wav");  /* часа */
-        	} 
-        	else {
-		    say_file("time/hours.wav"); /* часов*/
-		}
+                    say_file("time/hour.wav");
+                }
+                else if (((hours%10>1)&&(hours%10<5)) &&((hours<12)||(hours>14))) {
+                    say_file("time/hours-a.wav");  /* часа */
+                }
+                else {
+                    say_file("time/hours.wav"); /* часов*/
+                }
 
                 switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)minutes); //перевести минуты в *char
-                ru_say_count(session,tmp ,female,how_much,args);
-		if (((minutes%10) == 1) && (minutes!=11)) {
-		    say_file("time/minute.wav"); //минута
-		}
-		else if (((minutes%10>1)&&(minutes%10<5))&&((minutes<12)||(minutes>14))){
-		    say_file("time/minutes-i.wav"); // минуты
-		}
-		else {
-		    say_file("time/minutes.wav"); //минут
-		}
-		
-		if (seconds!=0) {
-            	    switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)seconds);
-            	    ru_say_count(session,tmp ,female,how_much,args);
-		    if (((seconds%10) == 1) && (seconds!=11)) {
-			say_file("time/second.wav"); // секунда
-		    } 
-		    else if (((seconds%10>1)&&(seconds%10<5))&&((seconds<12)||(seconds>14))) {
-			say_file("time/seconds-i.wav"); // секуны
-		    }
-		    else {
-			say_file("time/seconds.wav"); //секунд
-		    }
-		}
+                ru_say_count(session,tmp ,female_c,nominativus,args);
+                if (((minutes%10) == 1) && (minutes!=11)) {
+                    say_file("time/minute.wav"); //минута
+                }																							
+                else if (((minutes%10>1)&&(minutes%10<5))&&((minutes<12)||(minutes>14))){
+                    say_file("time/minutes-i.wav"); // минуты
+                }
+                else {
+                    say_file("time/minutes.wav"); //минут
+                }
 
-		return SWITCH_STATUS_SUCCESS;
-	}
+                if (seconds!=0) {
+                    switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)seconds);
+                    ru_say_count(session,tmp ,female_c,nominativus,args);
+                    if (((seconds%10) == 1) && (seconds!=11)) {
+                        say_file("time/second.wav"); // секунда
+                    }
+                    else if (((seconds%10>1)&&(seconds%10<5))&&((seconds<12)||(seconds>14))) {
+                        say_file("time/seconds-i.wav"); // секуны
+                    }
+                    else {
+                        say_file("time/seconds.wav"); //секунд
+                    }
+                }
 
-	if ((t = atol(tosay)) > 0) {
-		target = switch_time_make(t, 0);
-		target_now = switch_micro_time_now();
-	} else {
-		target = switch_micro_time_now();
-		target_now = switch_micro_time_now();
-	}
-	
-	if (tz) {
-		int check = atoi(tz);
-		if (check) {
-			switch_time_exp_tz(&tm, target, check);
-			switch_time_exp_tz(&tm_now, target_now, check);
-		} else {
-			switch_time_exp_tz_name(tz, &tm, target);
-			switch_time_exp_tz_name(tz, &tm_now, target_now);
-		}
-	} else {
-		switch_time_exp_lt(&tm, target);
-		switch_time_exp_lt(&tm_now, target_now);
-	}
-	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;
-	case SST_SHORT_DATE_TIME:
-		say_time = 1;
-		if (tm.tm_year != tm_now.tm_year) {
-			say_date = 1;
-			break;
-		}
-		if (tm.tm_yday == tm_now.tm_yday) {
-			say_today = 1;
-			break;
-		}
-		if (tm.tm_yday == tm_now.tm_yday - 1) {
-			say_yesterday = 1;
-			break;
-		}
-		if (tm.tm_yday >= tm_now.tm_yday - 5) {
-			say_dow = 1;
-			break;
-		}
-		if (tm.tm_mon != tm_now.tm_mon) {
-			say_month = say_day = say_dow = 1;
-			break;
-		}
+                return SWITCH_STATUS_SUCCESS;
+        }
 
-		say_month = say_day = say_dow = 1;
-		
-		break;
-	default:
-		break;
-	}
+        if ((t = atol(tosay)) > 0) {
+                target = switch_time_make(t, 0);
+                target_now = switch_micro_time_now();
+        } else {
+                target = switch_micro_time_now();
+                target_now = switch_micro_time_now();
+        }
 
-	if (say_today) {
-		say_file("time/today.wav");
-	}
-	if (say_yesterday) {
-		say_file("time/yesterday.wav");
-	}
-	if (say_dow) {
-		say_file("time/day-%d.wav", tm.tm_wday);
-	}
-	if (say_date) {
-		say_year = say_month = say_day = say_dow = 1;
-		say_today = say_yesterday = 0;
-	}
-	if (say_day) {
-		switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)tm.tm_mday);
-		ru_say_count(session,tmp ,male,when,args);
-	}
-	if (say_month) {
-		say_file("time/mon-%d.wav", tm.tm_mon);
-	}
-	if (say_year) {
-		switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)(tm.tm_year + 1900));
-		ru_say_count(session,tmp ,male,when,args);
-		say_file("time/h-year.wav");
-	}
-	if (say_month||say_year||say_date||say_dow)
-	{
-	    say_file("time/at.wav");
-	}
-	if (say_time) {
-		switch_snprintf(tmp, sizeof(tmp), "%d:%d:%d",tm.tm_hour+1,tm.tm_min,tm.tm_sec);
-		ru_say_time(session, tmp, SST_TIME_MEASUREMENT, method, args);
-	}
-	return SWITCH_STATUS_SUCCESS;
+        if (tz) {
+                int check = atoi(tz);
+                if (check) {
+                        switch_time_exp_tz(&tm, target, check);
+                        switch_time_exp_tz(&tm_now, target_now, check);
+                } else {
+                        switch_time_exp_tz_name(tz, &tm, target);
+                        switch_time_exp_tz_name(tz, &tm_now, target_now);
+                }
+        } else {
+                switch_time_exp_lt(&tm, target);
+                switch_time_exp_lt(&tm_now, target_now);
+        }
+        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;
+        case SST_SHORT_DATE_TIME:
+                say_time = 1;
+                if (tm.tm_year != tm_now.tm_year) {
+                        say_date = 1;
+                        break;
+                }
+                if (tm.tm_yday == tm_now.tm_yday) {
+                        say_today = 1;
+                        break;
+                }
+                if (tm.tm_yday == tm_now.tm_yday - 1) {
+                        say_yesterday = 1;
+                        break;
+                }
+                if (tm.tm_yday >= tm_now.tm_yday - 5) {
+                        say_dow = 1;
+                        break;
+                }
+                if (tm.tm_mon != tm_now.tm_mon) {
+                        say_month = say_day = say_dow = 1;
+                        break;
+                }
+
+                say_month = say_day = say_dow = 1;
+
+                break;
+        default:
+                break;
+        }
+
+        if (say_today) {
+                say_file("time/today.wav");
+        }
+        if (say_yesterday) {
+                say_file("time/yesterday.wav");
+        }
+        if (say_dow) {
+                say_file("time/day-%d.wav", tm.tm_wday);
+        }
+        if (say_date) {
+                say_year = say_month = say_day = say_dow = 1;
+                say_today = say_yesterday = 0;
+        }
+        if (say_day) {
+                switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)tm.tm_mday);
+                ru_say_count(session,tmp ,male_h,genitivus,args);
+        }
+        if (say_month) {
+                say_file("time/mon-%d.wav", tm.tm_mon);
+        }
+        if (say_year) {
+                switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)(tm.tm_year + 1900));
+                ru_say_count(session,tmp ,male_h,genitivus,args);
+                say_file("time/h-year.wav");
+        }
+        if (say_month||say_year||say_date||say_dow)
+        {
+            say_file("time/at.wav");
+        }
+        if (say_time) {
+                switch_snprintf(tmp, sizeof(tmp), "%d:%d:%d",tm.tm_hour+1,tm.tm_min,tm.tm_sec);
+                ru_say_time(session, tmp, SST_TIME_MEASUREMENT, method, args);
+        }
+        return SWITCH_STATUS_SUCCESS;
 }
 
 
+ 
+   
 static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
                                                              switch_input_args_t *args)
 {
@@ -1447,37 +612,40 @@
     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';
-    
-    ru_say_count(session,a ,male,how_much,args);
+
+    ru_say_count(session,a ,male_c,nominativus,args);
     say_file("digits/dot.wav");
-    ru_say_count(session,b ,male,how_much,args);
+
+    ru_say_count(session,b ,male_c,nominativus,args);
     say_file("digits/dot.wav");
-    ru_say_count(session,c ,male,how_much,args);
+
+    ru_say_count(session,c ,male_c,nominativus,args);
     say_file("digits/dot.wav");
-    ru_say_count(session,d ,male,how_much,args);
+
+    ru_say_count(session,d ,male_c,nominativus,args);
     return SWITCH_STATUS_SUCCESS;
 }
-                                                                                                                                                                                                                                
 
-        
+ 
+    
 static switch_status_t ru_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;
@@ -1524,9 +692,8 @@
         }
         return SWITCH_STATUS_FALSE;
 }
+            
                                                                                                                                                 
-
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load)
 {
 	switch_say_interface_t *say_interface;

Added: freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h	Mon May 11 14:06:08 2009
@@ -0,0 +1,581 @@
+//слишком много падежей поэтому пришлось сделать массив значений
+//пример таблицы склонений для 1 ниже по ссылкам
+//http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD
+//http://ru.wiktionary.org/wiki/%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B9
+
+typedef enum {
+    million,
+    thousand,
+    zero,
+    empty       
+} unit_t;
+
+//тип числа порядковое или количественное
+typedef enum{
+    nominativus,        // именительный Кто? Что?
+    genitivus,          // Родительный  Кого? Чего?
+    dativus,            // дательный    Кого? Что?
+    accusativus_a,      // Винительный  Кого? animate - одушевлённый
+    accusativus_i,      // Винительный  Что?  inanimate - неодушевлённый
+    instrumentalis,     // Творительный Кем? Чем?
+    prepositive         // Предложный   О ком? О чём?
+} casus_t;
+                            
+
+typedef enum {
+   //количественный
+    male_c,       //мужского пола
+    it_c,         //среднего
+    female_c,     //женского
+    plural_c,     //множественное число
+    //порядковый
+    male_h,       //порядковое мужского пола
+    it_h,         //порядковое среднего
+    female_h,     //порядковое женского
+    plural_h      //порядковое множественное число
+} say_type_t;
+                    
+
+
+struct say_t{
+    char *num[8];
+    char *thousand[14];
+    char *million[14];
+    int all;
+};
+
+
+//именительный 
+//именительный количественный/числительное
+
+//мужской род родительный падеж
+
+//первая строка описывае как произносить цифры от 0 до 5 потом пристаставка и окончания для остальных
+// тоже самое для тысяч и миллионов, только ещё с произношением тысяч и миллионов в вонце так же окончание для цифр
+// как произносить тысячи и миллионы берёт с цифры 5
+
+#define m_00 {\
+	{"0","1","2","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+//средний род именительный падеж
+#define m_01 {\
+	{"0","1n","2","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+
+//женский
+#define m_02 {\
+	{"0","1f","2f","3","4","5","",""},\
+	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
+	{"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_03 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_04 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_05 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_06 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_07 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Родительный  Кого? Чего?
+//количественный/числительное
+//мужской
+#define m_10 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_11 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_12 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_13 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_14 {\
+	{"h-0x","h-1x","h-2x","h-3x","h-4x","h-4x","h-","x"},\
+	{"","","","h-thousandx","h-2xx","h-thousandx","h-3xx","h-thousandx","h-4xx","h-thousandx","h-5xx","h-thousandx","h-","xx"},\
+	{"","","","h-millionx","h-2xx","h-millionx","h-3xx","h-millionx","h-4xx","h-millionx","h-5xx","h-millionx","h-","xx"},\
+	0,\
+}\
+//средний
+#define m_15 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_16 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_17 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//дательный    Кого? Что? 
+//количественный/числительное
+//мужской
+#define m_20 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_21 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_22 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_23 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_24 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_25 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_26 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_27 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Винительный  Кого? animate - одушевлённый 
+//количественный/числительное
+//мужской
+#define m_30 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_31 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_32 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_33 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_34 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_35 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_36 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_37 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Винительный  Что?  inanimate - неодушевлённый 
+//количественный/числительное
+//мужской
+#define m_40 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_41 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_42 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_43 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_44 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_45 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_46 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_47 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Творительный Кем? Чем? 
+//количественный/числительное
+//мужской
+#define m_50 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_51 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_52 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_53 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_54 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_55 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_56 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_57 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//Предложный   О ком? О чём? 
+//количественный/числительное
+//мужской
+#define m_60 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_61 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_62 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_63 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_64 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_65 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_66 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_67 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+
+//именительный 
+//именительный количественный/числительное
+//мужской
+#define m_60 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_61 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//женский
+#define m_62 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_63 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//порядковый
+//мужской
+#define m_64 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//средний
+#define m_65 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+//женский
+#define m_66 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+//множественное число
+#define m_67 {\
+	{"","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	{"","","","","","","","","","","","","",""},\
+	0,\
+}\
+
+
+



More information about the Freeswitch-svn mailing list