Asterisk
をテンプレートにして作成
[
トップ
] [
タイトル一覧
|
ページ一覧
|
新規
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
** Asterisk [#ae76a5eb]
- Site URL: http://www.asterisk.org/
- Info URL: http://voip-info.jp/
*** Compile [#ve84ec1d]
./configure --disable-xmldoc
make
make install
make samples
make config
*** Configration [#q2c8f0fd]
vi /etc/asterisk/asterisk.conf [directories](!) ; ...
*** Zaptel [#a1c6fc38]
- 1.4.20 以前
*** [[DAHDI]] [#u8071e0c]
- 1.4.20以降
*** /var/run/asterisk [#hd1fdb00]
mkdir /var/run/asterisk
chown -R asterisk.asterisk /var/run/asterisk
chown -R asterisk.asterisk /var/log/asterisk
chown -R asterisk.asterisk /var/spool/asterisk
chown -R asterisk.asterisk /var/lib/asterisk
vi /etc/init.d/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk" 有効にする
vi /usr/sbin/safe_asterisk
ASTPIDFILE=/var/run/asterisk/asterisk.pid 変更
/etc/init.d/asterisk start
asterisk -r
*** Card [#m33a2c07]
**** PCI [#i18caa90]
- TDM400P (AX-400P)
- TDM410
**** PCI Express [#xf0ec82e]
- AEX410
**** ONE Port [#y9ec6c99]
- X100P (AX-100P)
*** IAX2 & RSA [#q13d5b46]
- astgenkey でキーを作成
- キーファイルを /var/lib/asterisk/keys へコピー
- 公開キーを相手のAsteriskに転送
- 発信側 IXA2/Extension:[キーファイル名]@other.asterisk
-- CLI> keys init
- 着信側
auth=rsa
inkeys=キーファイル名
-- CLI> keys init
*Asterisk10.0 日本語対応 パッチ [#a279c73c]
添付ファイルを見てください.
*** say.c 2011-02-05 01:55:39.000000000 +0900
--- say.c.new 2011-10-04 19:42:28.000000000 +0900
***************
*** 345,350 ****
--- 345,351 ----
static int ast_say_number_full_se(struct ast_channel ...
static int ast_say_number_full_zh(struct ast_channel ...
static int ast_say_number_full_gr(struct ast_channel ...
+ static int ast_say_number_full_ja(struct ast_channel ...
static int ast_say_number_full_ru(struct ast_channel ...
static int ast_say_number_full_ka(struct ast_channel ...
static int ast_say_number_full_hu(struct ast_channel ...
***************
*** 367,372 ****
--- 368,374 ----
static int ast_say_date_nl(struct ast_channel *chan, ...
static int ast_say_date_pt(struct ast_channel *chan, ...
static int ast_say_date_gr(struct ast_channel *chan, ...
+ static int ast_say_date_ja(struct ast_channel *chan, ...
static int ast_say_date_ka(struct ast_channel *chan, ...
static int ast_say_date_hu(struct ast_channel *chan, ...
static int ast_say_date_th(struct ast_channel *chan, ...
***************
*** 384,389 ****
--- 386,392 ----
static int ast_say_date_with_format_pt(struct ast_cha...
static int ast_say_date_with_format_zh(struct ast_cha...
static int ast_say_date_with_format_gr(struct ast_cha...
+ static int ast_say_date_with_format_ja(struct ast_cha...
static int ast_say_date_with_format_th(struct ast_cha...
static int ast_say_date_with_format_vi(struct ast_cha...
***************
*** 395,400 ****
--- 398,404 ----
static int ast_say_time_pt_BR(struct ast_channel *cha...
static int ast_say_time_zh(struct ast_channel *chan, ...
static int ast_say_time_gr(struct ast_channel *chan, ...
+ static int ast_say_time_ja(struct ast_channel *chan, ...
static int ast_say_time_ka(struct ast_channel *chan, ...
static int ast_say_time_hu(struct ast_channel *chan, ...
static int ast_say_time_th(struct ast_channel *chan, ...
***************
*** 408,413 ****
--- 412,418 ----
static int ast_say_datetime_pt_BR(struct ast_channel ...
static int ast_say_datetime_zh(struct ast_channel *ch...
static int ast_say_datetime_gr(struct ast_channel *ch...
+ static int ast_say_datetime_ja(struct ast_channel *ch...
static int ast_say_datetime_ka(struct ast_channel *ch...
static int ast_say_datetime_hu(struct ast_channel *ch...
static int ast_say_datetime_th(struct ast_channel *ch...
***************
*** 461,466 ****
--- 466,473 ----
return ast_say_number_full_ka(chan, num, ...
} else if (!strncasecmp(language, "gr", 2)) { /* ...
return ast_say_number_full_gr(chan, num, ints,...
+ } else if (!strncasecmp(language, "ja", 2)) { /* ...
+ return ast_say_number_full_ja(chan, num, ints,...
} else if (!strncasecmp(language, "he", 2)) { /* ...
return ast_say_number_full_he(chan, num, ints,...
} else if (!strncasecmp(language, "hu", 2)) { /* ...
***************
*** 3302,3307 ****
--- 3309,3316 ----
return ast_say_date_ka(chan, t, ints, lan...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_date_gr(chan, t, ints, lan...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_date_ja(chan, t, ints, lan...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_date_he(chan, t, ints, lan...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 3651,3656 ****
--- 3660,3667 ----
return ast_say_date_with_format_fr(chan, ...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_date_with_format_gr(chan, ...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_date_with_format_ja(chan, ...
} else if (!strncasecmp(lang, "it", 2)) { /* Ital...
return ast_say_date_with_format_it(chan, ...
} else if (!strncasecmp(lang, "mx", 2)) { /* depr...
***************
*** 4524,4530 ****
int ast_say_date_with_format_he(struct ast_channel *c...
{
#define IL_DATE_STR "AdBY"
! #define IL_TIME_STR "HM" /* NOTE: In Hebre...
#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " ...
/* TODO: This whole function is cut&paste from
* ast_say_date_with_format_en . Is that consider...
--- 4535,4542 ----
int ast_say_date_with_format_he(struct ast_channel *c...
{
#define IL_DATE_STR "AdBY"
! #define IL_TIME_STR "HM"
! /* NOTE: In Hebrew we do not support 12 h...
#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " ...
/* TODO: This whole function is cut&paste from
* ast_say_date_with_format_en . Is that consider...
***************
*** 6278,6283 ****
--- 6290,6297 ----
return ast_say_time_ka(chan, t, ints, lan...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_time_gr(chan, t, ints, lan...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return(ast_say_time_ja(chan, t, ints, lan...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_time_he(chan, t, ints, lan...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 6609,6614 ****
--- 6623,6630 ----
return ast_say_datetime_ka(chan, t, ints,...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_datetime_gr(chan, t, ints,...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_datetime_ja(chan, t, ints,...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_datetime_he(chan, t, ints,...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 7351,7356 ****
--- 7367,7437 ----
return res;
}
+ /* Japanese syntax */
+ static int ast_say_number_full_ja(struct ast_channel...
+ {
+ int res = 0;
+ int playh = 0;
+ char fn[256] = "";
+ if (!num)
+ return ast_say_digits_full(chan, 0, ints,...
+
+ while (!res && (num || playh)) {
+ if (num < 0) {
+ ast_copy_string(fn, "digits/minus...
+ if ( num > INT_MIN ) {
+ num = -num;
+ } else {
+ num = 0;
+ }
+ } else if (playh) {
+ ast_copy_string(fn, "digits/hundr...
+ playh = 0;
+ } else if (num < 20) {
+ snprintf(fn, sizeof(fn), "digits/...
+ num = 0;
+ } else if (num < 100) {
+ snprintf(fn, sizeof(fn), "digits/...
+ num %= 10;
+ } else {
+ if (num < 1000){
+ snprintf(fn, sizeof(fn), ...
+ playh++;
+ num %= 100;
+ } else {
+ if (num < 1000000) { /* 1...
+ res = ast_say_num...
+ if (res)
+ return res;
+ num %= 1000;
+ snprintf(fn, size...
+ } else {
+ if (num < 1000000...
+ res = ast...
+ if (res)
+ r...
+ num %= 10...
+ ast_copy_...
+ } else {
+ ast_debug...
+ res = -1;
+ }
+ }
+ }
+ }
+ if (!res) {
+ if (!ast_streamfile(chan, fn, lan...
+ if ((audiofd > -1) && (c...
+ res = ast_waitstr...
+ else
+ res = ast_waitstr...
+ }
+ ast_stopstream(chan);
+ }
+ }
+ return res;
+ }
+
/*! \brief Greek support
*
***************
*** 7395,7401 ****
return res;
}
!
/*! \brief Greek support
*
--- 7476,7515 ----
return res;
}
! /* Japanese syntax */
! int ast_say_date_ja(struct ast_channel *chan, time_t ...
! {
! struct ast_tm tm;
! struct timeval tv = { t, 0 };
! char fn[256];
! int res = 0;
! ast_localtime(&tv, &tm, NULL);
! if (!res)
! res = ast_say_number(chan, tm.tm_year +...
! if (!res)
! res = ast_waitstream(chan, ints);
! if (!res)
! res = ast_streamfile(chan, "digits/nen"...
! if (!res) {
! snprintf(fn, sizeof(fn), "digits/mon-%d...
! res = ast_streamfile(chan, fn, lang);
! if (!res)
! res = ast_waitstream(chan, ints);
! }
! if (!res)
! res = ast_streamfile(chan, "digits/gats...
! if (!res)
! res = ast_say_number(chan, tm.tm_mday, ...
! if (!res)
! res = ast_streamfile(chan, "digits/nich...
! if (!res) {
! snprintf(fn, sizeof(fn), "digits/day-%d...
! res = ast_streamfile(chan, fn, lang);
! if (!res)
! res = ast_waitstream(chan, ints);
! }
! return res;
! }
/*! \brief Greek support
*
***************
*** 7452,7458 ****
--- 7566,7611 ----
return res;
}
+ /* Japanese */
+ static int ast_say_time_ja(struct ast_channel *chan, ...
+ {
+
+ struct timeval tv = { t, 0 };
+ struct ast_tm tm;
+ int res = 0;
+ int hour, pm=0;
+ ast_localtime(&tv, &tm, NULL);
+ hour = tm.tm_hour;
+
+ if (!hour)
+ hour = 12;
+ else if (hour == 12)
+ pm = 1;
+ else if (hour > 12) {
+ hour -= 12;
+ pm = 1;
+ }
+
+ if (pm) {
+ if (!res)
+ res = ast_streamfile(chan, "digit...
+ } else {
+ if (!res)
+ res = ast_streamfile(chan, "digit...
+ }
+ if (!res)
+ res = ast_say_number(chan, hour, ints, la...
+ if (!res)
+ res = ast_streamfile(chan, "digits/ji", l...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_min, int...
+ if (!res)
+ res = ast_streamfile(chan, "digits/fun", ...
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ return res;
+ }
/*! \brief Greek support
*/
***************
*** 7487,7492 ****
--- 7640,7995 ----
res = ast_say_time_gr(chan, t, ints, lang);
return res;
}
+ /* Japanese syntax */
+ int ast_say_datetime_ja(struct ast_channel *chan, ti...
+ {
+ struct timeval tv = { t, 0 };
+ struct ast_tm tm;
+ char fn[256];
+ int res = 0;
+ int hour, pm=0;
+ ast_localtime(&tv, &tm, NULL);
+ if (!res)
+ res = ast_say_number(chan, tm.tm_year ...
+ if (!res)
+ res = ast_streamfile(chan, "digits/nen...
+ if (!res) {
+ snprintf(fn, sizeof(fn), "digits/mon-%...
+ res = ast_streamfile(chan, fn, lang);
+ if (!res)
+ res = ast_waitstream(chan, int...
+ }
+ if (!res)
+ res = ast_streamfile(chan, "digits/gat...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_mday,...
+ if (!res)
+ res = ast_streamfile(chan, "digits/nic...
+ if (!res) {
+ snprintf(fn, sizeof(fn), "digits/day-%...
+ res = ast_streamfile(chan, fn, lang);
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ }
+
+ hour = tm.tm_hour;
+ if (!hour)
+ hour = 12;
+ else if (hour == 12)
+ pm = 1;
+ else if (hour > 12) {
+ hour -= 12;
+ pm = 1;
+ }
+ if (pm) {
+ if (!res)
+ res = ast_streamfile(chan, "di...
+ } else {
+ if (!res)
+ res = ast_streamfile(chan, "di...
+ }
+ if (!res)
+ res = ast_say_number(chan, hour, ints,...
+ if (!res)
+ res = ast_streamfile(chan, "digits/ji"...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_min, ...
+ if (!res)
+ res = ast_streamfile(chan, "digits/fun...
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ return res;
+ }
+
+
+ /* Japanese syntax */
+ int ast_say_date_with_format_ja(struct ast_channel *c...
+ {
+ struct timeval tv = { time, 0 };
+ struct ast_tm tm;
+ int res=0, offset, sndoffset;
+ char sndfile[256], nextmsg[256];
+
+ if (!format)
+ format = "YbdAPIMS";
+
+ ast_localtime(&tv, &tm, timezone);
+
+ for (offset=0 ; format[offset] != '\0' ; offse...
+ ast_log(LOG_DEBUG, "Parsing %c (offset...
+ switch (format[offset]) {
+ /* NOTE: if you add more opti...
+ case '\'':
+ /* Literal name of a s...
+ sndoffset=0;
+ for (sndoffset=0 ; (fo...
+ sndfile[sndoff...
+ sndfile[sndoffset] = '...
+ res = wait_file(chan,i...
+ break;
+ case 'A':
+ case 'a':
+ /* Sunday - Saturday */
+ snprintf(nextmsg,sizeo...
+ res = wait_file(chan,i...
+ break;
+ case 'B':
+ case 'b':
+ case 'h':
+ /* January - December */
+ snprintf(nextmsg,sizeo...
+ res = wait_file(chan,i...
+ break;
+ case 'd':
+ case 'e':
+ /* First - Thirtyfirst...
+ if (tm.tm_mday < 21) {
+ snprintf(nextm...
+ res = wait_fil...
+ } else if (tm.tm_mday ...
+ /* Between 21 ...
+ res = wait_fil...
+ snprin...
+ res = ...
+ }
+ } else if (tm.tm_mday ...
+ /* 30 */
+ res = wait_fil...
+ } else {
+ /* 31 */
+ res = wait_fil...
+ res = wait_fil...
+ res = wait_file(chan,i...
+ break;
+ case 'Y':
+ /* Year */
+ if (tm.tm_year > 99) {
+ res = wait_fil...
+ if (!res) {
+ res = ...
+ }
+ if (tm.tm_year...
+ if (!r...
+ ...
+ ...
+ ...
+ }
+ }
+ } else {
+ if (tm.tm_year...
+ /* I'm...
+ /* We'...
+ } else {
+ res = ...
+ if (!r...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'P':
+ case 'p':
+ /* AM/PM */
+ if (tm.tm_hour > 11)
+ snprintf(nextm...
+ else
+ snprintf(nextm...
+ res = wait_file(chan,i...
+ break;
+ case 'I':
+ case 'l':
+ /* 12-Hour */
+ if (tm.tm_hour == 0)
+ snprintf(nextm...
+ else if (tm.tm_hour > ...
+ snprintf(nextm...
+ else
+ snprintf(nextm...
+ res = wait_file(chan,i...
+ if(!res) res = wait_fi...
+ break;
+ case 'H':
+ case 'k':
+ /* 24-Hour */
+ if (format[offset] == ...
+ /* e.g. oh-eig...
+ if (tm.tm_hour...
+ res = ...
+ }
+ } else {
+ /* e.g. eight */
+ if (tm.tm_hour...
+ res = ...
+ }
+ }
+ if (!res) {
+ if (tm.tm_hour...
+ int re...
+ if (tm...
+ ...
+ ...
+ }
+ if (!r...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'M':
+ /* Minute */
+ if (tm.tm_min < 10) {
+ res = wait_fil...
+ if (!res) {
+ snprin...
+ res = ...
+ }
+ } else if ((tm.tm_min ...
+ snprintf(nextm...
+ res = wait_fil...
+ } else {
+ int ten, one;
+ ten = (tm.tm_m...
+ one = (tm.tm_m...
+ snprintf(nextm...
+ res = wait_fil...
+ if (!res) {
+ /* Fif...
+ if (on...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'Q':
+ /* Shorthand for "Toda...
+ {
+ struct timeval...
+ struct ast_tm ...
+ time_t beg_tod...
+
+ gettimeofday(&...
+ ast_localtime(...
+ /* This might ...
+ /* In any case...
+ beg_today = no...
+ if (beg_today ...
+ /* Tod...
+ res = ...
+ } else if (beg...
+ /* Yes...
+ res = ...
+ } else {
+ res = ...
+ }
+ }
+ break;
+ case 'q':
+ /* Shorthand for "" (t...
+ {
+ struct timeval...
+ struct ast_tm ...
+ time_t beg_tod...
+
+ gettimeofday(&...
+ ast_localtime(...
+ /* This might ...
+ /* In any case...
+ beg_today = no...
+ if (beg_today ...
+ /* Tod...
+ } else if ((be...
+ /* Yes...
+ res = ...
+ } else if (beg...
+ /* Wit...
+ res = ...
+ } else {
+ res = ...
+ }
+ }
+ break;
+ case 'R':
+ res = ast_say_date_wit...
+ break;
+ case 'S':
+ /* Seconds */
+ if (tm.tm_sec == 0) {
+ snprintf(nextm...
+ res = wait_fil...
+ } else if (tm.tm_sec <...
+ res = wait_fil...
+ if (!res) {
+ snprin...
+ res = ...
+ }
+ } else if ((tm.tm_sec ...
+ snprintf(nextm...
+ res = wait_fil...
+ } else {
+ int ten, one;
+ ten = (tm.tm_s...
+ one = (tm.tm_s...
+ snprintf(nextm...
+ res = wait_fil...
+ if (!res) {
+ /* Fif...
+ if (on...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'T':
+ res = ast_say_date_wit...
+ break;
+ case ' ':
+ case ' ':
+ /* Just ignore spaces ...
+ break;
+ default:
+ /* Unknown character */
+ ast_log(LOG_WARNING, "...
+ }
+ /* Jump out on DTMF */
+ if (res) {
+ break;
+ }
+ }
+ return res;
+ }
+
+
/*! \brief Greek support
*/
終了行:
** Asterisk [#ae76a5eb]
- Site URL: http://www.asterisk.org/
- Info URL: http://voip-info.jp/
*** Compile [#ve84ec1d]
./configure --disable-xmldoc
make
make install
make samples
make config
*** Configration [#q2c8f0fd]
vi /etc/asterisk/asterisk.conf [directories](!) ; ...
*** Zaptel [#a1c6fc38]
- 1.4.20 以前
*** [[DAHDI]] [#u8071e0c]
- 1.4.20以降
*** /var/run/asterisk [#hd1fdb00]
mkdir /var/run/asterisk
chown -R asterisk.asterisk /var/run/asterisk
chown -R asterisk.asterisk /var/log/asterisk
chown -R asterisk.asterisk /var/spool/asterisk
chown -R asterisk.asterisk /var/lib/asterisk
vi /etc/init.d/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk" 有効にする
vi /usr/sbin/safe_asterisk
ASTPIDFILE=/var/run/asterisk/asterisk.pid 変更
/etc/init.d/asterisk start
asterisk -r
*** Card [#m33a2c07]
**** PCI [#i18caa90]
- TDM400P (AX-400P)
- TDM410
**** PCI Express [#xf0ec82e]
- AEX410
**** ONE Port [#y9ec6c99]
- X100P (AX-100P)
*** IAX2 & RSA [#q13d5b46]
- astgenkey でキーを作成
- キーファイルを /var/lib/asterisk/keys へコピー
- 公開キーを相手のAsteriskに転送
- 発信側 IXA2/Extension:[キーファイル名]@other.asterisk
-- CLI> keys init
- 着信側
auth=rsa
inkeys=キーファイル名
-- CLI> keys init
*Asterisk10.0 日本語対応 パッチ [#a279c73c]
添付ファイルを見てください.
*** say.c 2011-02-05 01:55:39.000000000 +0900
--- say.c.new 2011-10-04 19:42:28.000000000 +0900
***************
*** 345,350 ****
--- 345,351 ----
static int ast_say_number_full_se(struct ast_channel ...
static int ast_say_number_full_zh(struct ast_channel ...
static int ast_say_number_full_gr(struct ast_channel ...
+ static int ast_say_number_full_ja(struct ast_channel ...
static int ast_say_number_full_ru(struct ast_channel ...
static int ast_say_number_full_ka(struct ast_channel ...
static int ast_say_number_full_hu(struct ast_channel ...
***************
*** 367,372 ****
--- 368,374 ----
static int ast_say_date_nl(struct ast_channel *chan, ...
static int ast_say_date_pt(struct ast_channel *chan, ...
static int ast_say_date_gr(struct ast_channel *chan, ...
+ static int ast_say_date_ja(struct ast_channel *chan, ...
static int ast_say_date_ka(struct ast_channel *chan, ...
static int ast_say_date_hu(struct ast_channel *chan, ...
static int ast_say_date_th(struct ast_channel *chan, ...
***************
*** 384,389 ****
--- 386,392 ----
static int ast_say_date_with_format_pt(struct ast_cha...
static int ast_say_date_with_format_zh(struct ast_cha...
static int ast_say_date_with_format_gr(struct ast_cha...
+ static int ast_say_date_with_format_ja(struct ast_cha...
static int ast_say_date_with_format_th(struct ast_cha...
static int ast_say_date_with_format_vi(struct ast_cha...
***************
*** 395,400 ****
--- 398,404 ----
static int ast_say_time_pt_BR(struct ast_channel *cha...
static int ast_say_time_zh(struct ast_channel *chan, ...
static int ast_say_time_gr(struct ast_channel *chan, ...
+ static int ast_say_time_ja(struct ast_channel *chan, ...
static int ast_say_time_ka(struct ast_channel *chan, ...
static int ast_say_time_hu(struct ast_channel *chan, ...
static int ast_say_time_th(struct ast_channel *chan, ...
***************
*** 408,413 ****
--- 412,418 ----
static int ast_say_datetime_pt_BR(struct ast_channel ...
static int ast_say_datetime_zh(struct ast_channel *ch...
static int ast_say_datetime_gr(struct ast_channel *ch...
+ static int ast_say_datetime_ja(struct ast_channel *ch...
static int ast_say_datetime_ka(struct ast_channel *ch...
static int ast_say_datetime_hu(struct ast_channel *ch...
static int ast_say_datetime_th(struct ast_channel *ch...
***************
*** 461,466 ****
--- 466,473 ----
return ast_say_number_full_ka(chan, num, ...
} else if (!strncasecmp(language, "gr", 2)) { /* ...
return ast_say_number_full_gr(chan, num, ints,...
+ } else if (!strncasecmp(language, "ja", 2)) { /* ...
+ return ast_say_number_full_ja(chan, num, ints,...
} else if (!strncasecmp(language, "he", 2)) { /* ...
return ast_say_number_full_he(chan, num, ints,...
} else if (!strncasecmp(language, "hu", 2)) { /* ...
***************
*** 3302,3307 ****
--- 3309,3316 ----
return ast_say_date_ka(chan, t, ints, lan...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_date_gr(chan, t, ints, lan...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_date_ja(chan, t, ints, lan...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_date_he(chan, t, ints, lan...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 3651,3656 ****
--- 3660,3667 ----
return ast_say_date_with_format_fr(chan, ...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_date_with_format_gr(chan, ...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_date_with_format_ja(chan, ...
} else if (!strncasecmp(lang, "it", 2)) { /* Ital...
return ast_say_date_with_format_it(chan, ...
} else if (!strncasecmp(lang, "mx", 2)) { /* depr...
***************
*** 4524,4530 ****
int ast_say_date_with_format_he(struct ast_channel *c...
{
#define IL_DATE_STR "AdBY"
! #define IL_TIME_STR "HM" /* NOTE: In Hebre...
#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " ...
/* TODO: This whole function is cut&paste from
* ast_say_date_with_format_en . Is that consider...
--- 4535,4542 ----
int ast_say_date_with_format_he(struct ast_channel *c...
{
#define IL_DATE_STR "AdBY"
! #define IL_TIME_STR "HM"
! /* NOTE: In Hebrew we do not support 12 h...
#define IL_DATE_STR_FULL IL_DATE_STR " 'digits/at' " ...
/* TODO: This whole function is cut&paste from
* ast_say_date_with_format_en . Is that consider...
***************
*** 6278,6283 ****
--- 6290,6297 ----
return ast_say_time_ka(chan, t, ints, lan...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_time_gr(chan, t, ints, lan...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return(ast_say_time_ja(chan, t, ints, lan...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_time_he(chan, t, ints, lan...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 6609,6614 ****
--- 6623,6630 ----
return ast_say_datetime_ka(chan, t, ints,...
} else if (!strncasecmp(lang, "gr", 2)) { /* Gree...
return ast_say_datetime_gr(chan, t, ints,...
+ } else if (!strncasecmp(lang, "ja", 2)) { /* Japa...
+ return ast_say_datetime_ja(chan, t, ints,...
} else if (!strncasecmp(lang, "he", 2)) { /* Hebr...
return ast_say_datetime_he(chan, t, ints,...
} else if (!strncasecmp(lang, "hu", 2)) { /* Hung...
***************
*** 7351,7356 ****
--- 7367,7437 ----
return res;
}
+ /* Japanese syntax */
+ static int ast_say_number_full_ja(struct ast_channel...
+ {
+ int res = 0;
+ int playh = 0;
+ char fn[256] = "";
+ if (!num)
+ return ast_say_digits_full(chan, 0, ints,...
+
+ while (!res && (num || playh)) {
+ if (num < 0) {
+ ast_copy_string(fn, "digits/minus...
+ if ( num > INT_MIN ) {
+ num = -num;
+ } else {
+ num = 0;
+ }
+ } else if (playh) {
+ ast_copy_string(fn, "digits/hundr...
+ playh = 0;
+ } else if (num < 20) {
+ snprintf(fn, sizeof(fn), "digits/...
+ num = 0;
+ } else if (num < 100) {
+ snprintf(fn, sizeof(fn), "digits/...
+ num %= 10;
+ } else {
+ if (num < 1000){
+ snprintf(fn, sizeof(fn), ...
+ playh++;
+ num %= 100;
+ } else {
+ if (num < 1000000) { /* 1...
+ res = ast_say_num...
+ if (res)
+ return res;
+ num %= 1000;
+ snprintf(fn, size...
+ } else {
+ if (num < 1000000...
+ res = ast...
+ if (res)
+ r...
+ num %= 10...
+ ast_copy_...
+ } else {
+ ast_debug...
+ res = -1;
+ }
+ }
+ }
+ }
+ if (!res) {
+ if (!ast_streamfile(chan, fn, lan...
+ if ((audiofd > -1) && (c...
+ res = ast_waitstr...
+ else
+ res = ast_waitstr...
+ }
+ ast_stopstream(chan);
+ }
+ }
+ return res;
+ }
+
/*! \brief Greek support
*
***************
*** 7395,7401 ****
return res;
}
!
/*! \brief Greek support
*
--- 7476,7515 ----
return res;
}
! /* Japanese syntax */
! int ast_say_date_ja(struct ast_channel *chan, time_t ...
! {
! struct ast_tm tm;
! struct timeval tv = { t, 0 };
! char fn[256];
! int res = 0;
! ast_localtime(&tv, &tm, NULL);
! if (!res)
! res = ast_say_number(chan, tm.tm_year +...
! if (!res)
! res = ast_waitstream(chan, ints);
! if (!res)
! res = ast_streamfile(chan, "digits/nen"...
! if (!res) {
! snprintf(fn, sizeof(fn), "digits/mon-%d...
! res = ast_streamfile(chan, fn, lang);
! if (!res)
! res = ast_waitstream(chan, ints);
! }
! if (!res)
! res = ast_streamfile(chan, "digits/gats...
! if (!res)
! res = ast_say_number(chan, tm.tm_mday, ...
! if (!res)
! res = ast_streamfile(chan, "digits/nich...
! if (!res) {
! snprintf(fn, sizeof(fn), "digits/day-%d...
! res = ast_streamfile(chan, fn, lang);
! if (!res)
! res = ast_waitstream(chan, ints);
! }
! return res;
! }
/*! \brief Greek support
*
***************
*** 7452,7458 ****
--- 7566,7611 ----
return res;
}
+ /* Japanese */
+ static int ast_say_time_ja(struct ast_channel *chan, ...
+ {
+
+ struct timeval tv = { t, 0 };
+ struct ast_tm tm;
+ int res = 0;
+ int hour, pm=0;
+ ast_localtime(&tv, &tm, NULL);
+ hour = tm.tm_hour;
+
+ if (!hour)
+ hour = 12;
+ else if (hour == 12)
+ pm = 1;
+ else if (hour > 12) {
+ hour -= 12;
+ pm = 1;
+ }
+
+ if (pm) {
+ if (!res)
+ res = ast_streamfile(chan, "digit...
+ } else {
+ if (!res)
+ res = ast_streamfile(chan, "digit...
+ }
+ if (!res)
+ res = ast_say_number(chan, hour, ints, la...
+ if (!res)
+ res = ast_streamfile(chan, "digits/ji", l...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_min, int...
+ if (!res)
+ res = ast_streamfile(chan, "digits/fun", ...
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ return res;
+ }
/*! \brief Greek support
*/
***************
*** 7487,7492 ****
--- 7640,7995 ----
res = ast_say_time_gr(chan, t, ints, lang);
return res;
}
+ /* Japanese syntax */
+ int ast_say_datetime_ja(struct ast_channel *chan, ti...
+ {
+ struct timeval tv = { t, 0 };
+ struct ast_tm tm;
+ char fn[256];
+ int res = 0;
+ int hour, pm=0;
+ ast_localtime(&tv, &tm, NULL);
+ if (!res)
+ res = ast_say_number(chan, tm.tm_year ...
+ if (!res)
+ res = ast_streamfile(chan, "digits/nen...
+ if (!res) {
+ snprintf(fn, sizeof(fn), "digits/mon-%...
+ res = ast_streamfile(chan, fn, lang);
+ if (!res)
+ res = ast_waitstream(chan, int...
+ }
+ if (!res)
+ res = ast_streamfile(chan, "digits/gat...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_mday,...
+ if (!res)
+ res = ast_streamfile(chan, "digits/nic...
+ if (!res) {
+ snprintf(fn, sizeof(fn), "digits/day-%...
+ res = ast_streamfile(chan, fn, lang);
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ }
+
+ hour = tm.tm_hour;
+ if (!hour)
+ hour = 12;
+ else if (hour == 12)
+ pm = 1;
+ else if (hour > 12) {
+ hour -= 12;
+ pm = 1;
+ }
+ if (pm) {
+ if (!res)
+ res = ast_streamfile(chan, "di...
+ } else {
+ if (!res)
+ res = ast_streamfile(chan, "di...
+ }
+ if (!res)
+ res = ast_say_number(chan, hour, ints,...
+ if (!res)
+ res = ast_streamfile(chan, "digits/ji"...
+ if (!res)
+ res = ast_say_number(chan, tm.tm_min, ...
+ if (!res)
+ res = ast_streamfile(chan, "digits/fun...
+ if (!res)
+ res = ast_waitstream(chan, ints);
+ return res;
+ }
+
+
+ /* Japanese syntax */
+ int ast_say_date_with_format_ja(struct ast_channel *c...
+ {
+ struct timeval tv = { time, 0 };
+ struct ast_tm tm;
+ int res=0, offset, sndoffset;
+ char sndfile[256], nextmsg[256];
+
+ if (!format)
+ format = "YbdAPIMS";
+
+ ast_localtime(&tv, &tm, timezone);
+
+ for (offset=0 ; format[offset] != '\0' ; offse...
+ ast_log(LOG_DEBUG, "Parsing %c (offset...
+ switch (format[offset]) {
+ /* NOTE: if you add more opti...
+ case '\'':
+ /* Literal name of a s...
+ sndoffset=0;
+ for (sndoffset=0 ; (fo...
+ sndfile[sndoff...
+ sndfile[sndoffset] = '...
+ res = wait_file(chan,i...
+ break;
+ case 'A':
+ case 'a':
+ /* Sunday - Saturday */
+ snprintf(nextmsg,sizeo...
+ res = wait_file(chan,i...
+ break;
+ case 'B':
+ case 'b':
+ case 'h':
+ /* January - December */
+ snprintf(nextmsg,sizeo...
+ res = wait_file(chan,i...
+ break;
+ case 'd':
+ case 'e':
+ /* First - Thirtyfirst...
+ if (tm.tm_mday < 21) {
+ snprintf(nextm...
+ res = wait_fil...
+ } else if (tm.tm_mday ...
+ /* Between 21 ...
+ res = wait_fil...
+ snprin...
+ res = ...
+ }
+ } else if (tm.tm_mday ...
+ /* 30 */
+ res = wait_fil...
+ } else {
+ /* 31 */
+ res = wait_fil...
+ res = wait_fil...
+ res = wait_file(chan,i...
+ break;
+ case 'Y':
+ /* Year */
+ if (tm.tm_year > 99) {
+ res = wait_fil...
+ if (!res) {
+ res = ...
+ }
+ if (tm.tm_year...
+ if (!r...
+ ...
+ ...
+ ...
+ }
+ }
+ } else {
+ if (tm.tm_year...
+ /* I'm...
+ /* We'...
+ } else {
+ res = ...
+ if (!r...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'P':
+ case 'p':
+ /* AM/PM */
+ if (tm.tm_hour > 11)
+ snprintf(nextm...
+ else
+ snprintf(nextm...
+ res = wait_file(chan,i...
+ break;
+ case 'I':
+ case 'l':
+ /* 12-Hour */
+ if (tm.tm_hour == 0)
+ snprintf(nextm...
+ else if (tm.tm_hour > ...
+ snprintf(nextm...
+ else
+ snprintf(nextm...
+ res = wait_file(chan,i...
+ if(!res) res = wait_fi...
+ break;
+ case 'H':
+ case 'k':
+ /* 24-Hour */
+ if (format[offset] == ...
+ /* e.g. oh-eig...
+ if (tm.tm_hour...
+ res = ...
+ }
+ } else {
+ /* e.g. eight */
+ if (tm.tm_hour...
+ res = ...
+ }
+ }
+ if (!res) {
+ if (tm.tm_hour...
+ int re...
+ if (tm...
+ ...
+ ...
+ }
+ if (!r...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'M':
+ /* Minute */
+ if (tm.tm_min < 10) {
+ res = wait_fil...
+ if (!res) {
+ snprin...
+ res = ...
+ }
+ } else if ((tm.tm_min ...
+ snprintf(nextm...
+ res = wait_fil...
+ } else {
+ int ten, one;
+ ten = (tm.tm_m...
+ one = (tm.tm_m...
+ snprintf(nextm...
+ res = wait_fil...
+ if (!res) {
+ /* Fif...
+ if (on...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'Q':
+ /* Shorthand for "Toda...
+ {
+ struct timeval...
+ struct ast_tm ...
+ time_t beg_tod...
+
+ gettimeofday(&...
+ ast_localtime(...
+ /* This might ...
+ /* In any case...
+ beg_today = no...
+ if (beg_today ...
+ /* Tod...
+ res = ...
+ } else if (beg...
+ /* Yes...
+ res = ...
+ } else {
+ res = ...
+ }
+ }
+ break;
+ case 'q':
+ /* Shorthand for "" (t...
+ {
+ struct timeval...
+ struct ast_tm ...
+ time_t beg_tod...
+
+ gettimeofday(&...
+ ast_localtime(...
+ /* This might ...
+ /* In any case...
+ beg_today = no...
+ if (beg_today ...
+ /* Tod...
+ } else if ((be...
+ /* Yes...
+ res = ...
+ } else if (beg...
+ /* Wit...
+ res = ...
+ } else {
+ res = ...
+ }
+ }
+ break;
+ case 'R':
+ res = ast_say_date_wit...
+ break;
+ case 'S':
+ /* Seconds */
+ if (tm.tm_sec == 0) {
+ snprintf(nextm...
+ res = wait_fil...
+ } else if (tm.tm_sec <...
+ res = wait_fil...
+ if (!res) {
+ snprin...
+ res = ...
+ }
+ } else if ((tm.tm_sec ...
+ snprintf(nextm...
+ res = wait_fil...
+ } else {
+ int ten, one;
+ ten = (tm.tm_s...
+ one = (tm.tm_s...
+ snprintf(nextm...
+ res = wait_fil...
+ if (!res) {
+ /* Fif...
+ if (on...
+ ...
+ ...
+ }
+ }
+ }
+ res = wait_file(chan,i...
+ break;
+ case 'T':
+ res = ast_say_date_wit...
+ break;
+ case ' ':
+ case ' ':
+ /* Just ignore spaces ...
+ break;
+ default:
+ /* Unknown character */
+ ast_log(LOG_WARNING, "...
+ }
+ /* Jump out on DTMF */
+ if (res) {
+ break;
+ }
+ }
+ return res;
+ }
+
+
/*! \brief Greek support
*/
ページ名: