mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
Version 0.1.3 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -156,17 +156,17 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
|
|||||||
if (v) {
|
if (v) {
|
||||||
/* We have a match -- play a greeting if they have it */
|
/* We have a match -- play a greeting if they have it */
|
||||||
snprintf(fn, sizeof(fn), "%s/vm/%s/greet", AST_SPOOL_DIR, v->name);
|
snprintf(fn, sizeof(fn), "%s/vm/%s/greet", AST_SPOOL_DIR, v->name);
|
||||||
if (ast_fileexists(fn, NULL)) {
|
if (ast_fileexists(fn, NULL, chan->language)) {
|
||||||
res = ast_streamfile(chan, fn);
|
res = ast_streamfile(chan, fn, chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
} else {
|
} else {
|
||||||
res = ast_say_digit_str(chan, v->name);
|
res = ast_say_digit_str(chan, v->name, chan->language);
|
||||||
}
|
}
|
||||||
ahem:
|
ahem:
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_streamfile(chan, "dir-instr");
|
res = ast_streamfile(chan, "dir-instr", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
if (!res)
|
if (!res)
|
||||||
@@ -189,9 +189,9 @@ ahem:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (found)
|
if (found)
|
||||||
res = ast_streamfile(chan, "dir-nomore");
|
res = ast_streamfile(chan, "dir-nomore", chan->language);
|
||||||
else
|
else
|
||||||
res = ast_streamfile(chan, "dir-nomatch");
|
res = ast_streamfile(chan, "dir-nomatch", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = 1;
|
res = 1;
|
||||||
return res;
|
return res;
|
||||||
@@ -219,7 +219,7 @@ static int directory_exec(struct ast_channel *chan, void *data)
|
|||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
top:
|
top:
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_streamfile(chan, "dir-intro");
|
res = ast_streamfile(chan, "dir-intro", chan->language);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
@@ -31,18 +31,22 @@ LOCAL_USER_DECL;
|
|||||||
|
|
||||||
static int playback_exec(struct ast_channel *chan, void *data)
|
static int playback_exec(struct ast_channel *chan, void *data)
|
||||||
{
|
{
|
||||||
int res;
|
int res = 0;
|
||||||
struct localuser *u;
|
struct localuser *u;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
|
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
ast_stopstream(chan);
|
if (chan->state != AST_STATE_UP)
|
||||||
res = ast_streamfile(chan, (char *)data);
|
res = ast_answer(chan);
|
||||||
if (!res)
|
if (!res) {
|
||||||
res = ast_waitstream(chan, "");
|
ast_stopstream(chan);
|
||||||
ast_stopstream(chan);
|
res = ast_streamfile(chan, (char *)data, chan->language);
|
||||||
|
if (!res)
|
||||||
|
res = ast_waitstream(chan, "");
|
||||||
|
ast_stopstream(chan);
|
||||||
|
}
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -81,15 +81,15 @@ static int announce_message(struct ast_channel *chan, char *dir, int msgcnt)
|
|||||||
{
|
{
|
||||||
char *fn;
|
char *fn;
|
||||||
int res;
|
int res;
|
||||||
res = ast_streamfile(chan, "vm-message");
|
res = ast_streamfile(chan, "vm-message", chan->language);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_say_number(chan, msgcnt+1);
|
res = ast_say_number(chan, msgcnt+1, chan->language);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
fn = get_fn(dir, msgcnt);
|
fn = get_fn(dir, msgcnt);
|
||||||
if (fn) {
|
if (fn) {
|
||||||
res = ast_streamfile(chan, fn);
|
res = ast_streamfile(chan, fn, chan->language);
|
||||||
free(fn);
|
free(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
|||||||
if (mkdir(dir, 0700) && (errno != EEXIST))
|
if (mkdir(dir, 0700) && (errno != EEXIST))
|
||||||
ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dir, strerror(errno));
|
ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dir, strerror(errno));
|
||||||
/* Stream an info message */
|
/* Stream an info message */
|
||||||
if (silent || !ast_streamfile(chan, INTRO)) {
|
if (silent || !ast_streamfile(chan, INTRO, chan->language)) {
|
||||||
/* Wait for the message to finish */
|
/* Wait for the message to finish */
|
||||||
if (silent || !ast_waitstream(chan, "")) {
|
if (silent || !ast_waitstream(chan, "")) {
|
||||||
fmt = ast_variable_retrieve(cfg, "general", "format");
|
fmt = ast_variable_retrieve(cfg, "general", "format");
|
||||||
@@ -182,7 +182,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
|||||||
snprintf(comment, sizeof(comment), "Voicemail from %s to %s (%s) on %s\n",
|
snprintf(comment, sizeof(comment), "Voicemail from %s to %s (%s) on %s\n",
|
||||||
(chan->callerid ? chan->callerid : "Unknown"),
|
(chan->callerid ? chan->callerid : "Unknown"),
|
||||||
name, ext, chan->name);
|
name, ext, chan->name);
|
||||||
if (ast_fileexists(fn, NULL) > 0) {
|
if (ast_fileexists(fn, NULL, chan->language) > 0) {
|
||||||
msgnum++;
|
msgnum++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
|||||||
if (outmsg) {
|
if (outmsg) {
|
||||||
if (outmsg > 1) {
|
if (outmsg > 1) {
|
||||||
/* Let them know it worked */
|
/* Let them know it worked */
|
||||||
ast_streamfile(chan, "vm-msgsaved");
|
ast_streamfile(chan, "vm-msgsaved", chan->language);
|
||||||
ast_waitstream(chan, "");
|
ast_waitstream(chan, "");
|
||||||
}
|
}
|
||||||
/* Send e-mail if applicable */
|
/* Send e-mail if applicable */
|
||||||
@@ -323,7 +323,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_WARNING, "No voicemail configuration\n");
|
ast_log(LOG_WARNING, "No voicemail configuration\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (ast_streamfile(chan, "vm-login")) {
|
if (ast_streamfile(chan, "vm-login", chan->language)) {
|
||||||
ast_log(LOG_WARNING, "Couldn't stream login file\n");
|
ast_log(LOG_WARNING, "Couldn't stream login file\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
res = 0;
|
res = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (ast_streamfile(chan, "vm-password")) {
|
if (ast_streamfile(chan, "vm-password", chan->language)) {
|
||||||
ast_log(LOG_WARNING, "Unable to stream password file\n");
|
ast_log(LOG_WARNING, "Unable to stream password file\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
} else if (option_verbose > 2)
|
} else if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "No such user '%s' in config file\n", username);
|
ast_verbose( VERBOSE_PREFIX_3 "No such user '%s' in config file\n", username);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
if (ast_streamfile(chan, "vm-incorrect"))
|
if (ast_streamfile(chan, "vm-incorrect", chan->language))
|
||||||
break;
|
break;
|
||||||
if (ast_waitstream(chan, ""))
|
if (ast_waitstream(chan, ""))
|
||||||
break;
|
break;
|
||||||
@@ -375,13 +375,13 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
not deleted. */
|
not deleted. */
|
||||||
do {
|
do {
|
||||||
fn = get_fn(dir, maxmsg);
|
fn = get_fn(dir, maxmsg);
|
||||||
if ((res = ast_fileexists(fn, NULL))>0) {
|
if ((res = ast_fileexists(fn, NULL, chan->language))>0) {
|
||||||
maxmsg++;
|
maxmsg++;
|
||||||
deleted[maxmsg] = 0;
|
deleted[maxmsg] = 0;
|
||||||
}
|
}
|
||||||
free(fn);
|
free(fn);
|
||||||
} while(res > 0);
|
} while(res > 0);
|
||||||
if (ast_streamfile(chan, "vm-youhave"))
|
if (ast_streamfile(chan, "vm-youhave", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -389,10 +389,10 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
if (!d) {
|
if (!d) {
|
||||||
/* If they haven't interrupted us, play the message count */
|
/* If they haven't interrupted us, play the message count */
|
||||||
if (maxmsg > 0) {
|
if (maxmsg > 0) {
|
||||||
if ((d = ast_say_number(chan, maxmsg)) < 0)
|
if ((d = ast_say_number(chan, maxmsg, chan->language)) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
if (ast_streamfile(chan, "vm-no"))
|
if (ast_streamfile(chan, "vm-no", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -400,7 +400,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
if (!d) {
|
if (!d) {
|
||||||
/* And if they still haven't, give them the last word */
|
/* And if they still haven't, give them the last word */
|
||||||
if (ast_streamfile(chan, ((maxmsg == 1) ? "vm-message" : "vm-messages")))
|
if (ast_streamfile(chan, ((maxmsg == 1) ? "vm-message" : "vm-messages"), chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
if (ast_waitstream(chan, AST_DIGIT_ANY) < 0)
|
if (ast_waitstream(chan, AST_DIGIT_ANY) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -416,7 +416,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_EVENT, "User '%s' logged in on channel '%s' with %d message(s).\n", username, chan->name, maxmsg);
|
ast_log(LOG_EVENT, "User '%s' logged in on channel '%s' with %d message(s).\n", username, chan->name, maxmsg);
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose( VERBOSE_PREFIX_3 "User '%s' logged in on channel %s with %d messages\n", username, chan->name, maxmsg);
|
ast_verbose( VERBOSE_PREFIX_3 "User '%s' logged in on channel %s with %d messages\n", username, chan->name, maxmsg);
|
||||||
if (!ast_streamfile(chan, "vm-instructions")) {
|
if (!ast_streamfile(chan, "vm-instructions", chan->language)) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if (chan->stream || (chan->trans && chan->trans->stream)) {
|
if (chan->stream || (chan->trans && chan->trans->stream)) {
|
||||||
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
@@ -424,7 +424,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
if (!d && (state == STATE_MESSAGE_PLAYING)) {
|
if (!d && (state == STATE_MESSAGE_PLAYING)) {
|
||||||
state = STATE_MESSAGE;
|
state = STATE_MESSAGE;
|
||||||
/* If it runs out playing a message, then give directions */
|
/* If it runs out playing a message, then give directions */
|
||||||
if (!(d = ast_streamfile(chan, "vm-msginstruct")))
|
if (!(d = ast_streamfile(chan, "vm-msginstruct", chan->language)))
|
||||||
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
}
|
}
|
||||||
@@ -440,12 +440,12 @@ restart:
|
|||||||
best based up on where they are. Ditto if they press the '*' key. */
|
best based up on where they are. Ditto if they press the '*' key. */
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case STATE_STARTING:
|
case STATE_STARTING:
|
||||||
if (ast_streamfile(chan, "vm-instructions"))
|
if (ast_streamfile(chan, "vm-instructions", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
case STATE_MESSAGE:
|
case STATE_MESSAGE:
|
||||||
case STATE_MESSAGE_PLAYING:
|
case STATE_MESSAGE_PLAYING:
|
||||||
if (ast_streamfile(chan, "vm-msginstruct"))
|
if (ast_streamfile(chan, "vm-msginstruct", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -460,14 +460,14 @@ restart:
|
|||||||
if (curmsg < maxmsg) {
|
if (curmsg < maxmsg) {
|
||||||
deleted[curmsg] = !deleted[curmsg];
|
deleted[curmsg] = !deleted[curmsg];
|
||||||
if (deleted[curmsg]) {
|
if (deleted[curmsg]) {
|
||||||
if (ast_streamfile(chan, "vm-deleted"))
|
if (ast_streamfile(chan, "vm-deleted", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
if (ast_streamfile(chan, "vm-undeleted"))
|
if (ast_streamfile(chan, "vm-undeleted", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ast_streamfile(chan, "vm-nomore"))
|
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -480,7 +480,7 @@ restart:
|
|||||||
else if (d < 0)
|
else if (d < 0)
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
if (ast_streamfile(chan, "vm-nomore"))
|
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
state = STATE_MESSAGE_PLAYING;
|
state = STATE_MESSAGE_PLAYING;
|
||||||
@@ -510,7 +510,7 @@ restart:
|
|||||||
else if (d < 0)
|
else if (d < 0)
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
if (ast_streamfile(chan, "vm-nomore"))
|
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
state = STATE_MESSAGE_PLAYING;
|
state = STATE_MESSAGE_PLAYING;
|
||||||
@@ -518,7 +518,7 @@ restart:
|
|||||||
/* XXX Message compose? It's easy! Just read their # and, assuming it's in the config,
|
/* XXX Message compose? It's easy! Just read their # and, assuming it's in the config,
|
||||||
call the routine as if it were called from the PBX proper XXX */
|
call the routine as if it were called from the PBX proper XXX */
|
||||||
case '#':
|
case '#':
|
||||||
if (ast_streamfile(chan, "vm-goodbye"))
|
if (ast_streamfile(chan, "vm-goodbye", chan->language))
|
||||||
goto out;
|
goto out;
|
||||||
if (ast_waitstream(chan, ""))
|
if (ast_waitstream(chan, ""))
|
||||||
goto out;
|
goto out;
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include <asterisk/logger.h>
|
#include <asterisk/logger.h>
|
||||||
#include <asterisk/options.h>
|
#include <asterisk/options.h>
|
||||||
#include <asterisk/cli.h>
|
#include <asterisk/cli.h>
|
||||||
|
#include <asterisk/channel.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
@@ -32,6 +33,8 @@ int option_console=0;
|
|||||||
int option_highpriority=0;
|
int option_highpriority=0;
|
||||||
int fully_booted = 0;
|
int fully_booted = 0;
|
||||||
|
|
||||||
|
char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
|
||||||
|
|
||||||
#define HIGH_PRIORITY 1
|
#define HIGH_PRIORITY 1
|
||||||
#define HIGH_PRIORITY_SCHED SCHED_RR
|
#define HIGH_PRIORITY_SCHED SCHED_RR
|
||||||
|
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
#ifndef _ASTERISK_H
|
#ifndef _ASTERISK_H
|
||||||
#define _ASTERISK_H
|
#define _ASTERISK_H
|
||||||
|
|
||||||
|
#define DEFAULT_LANGUAGE "en"
|
||||||
|
|
||||||
#define AST_CONFIG_DIR "/etc/asterisk"
|
#define AST_CONFIG_DIR "/etc/asterisk"
|
||||||
#define AST_MODULE_DIR "/usr/lib/asterisk/modules"
|
#define AST_MODULE_DIR "/usr/lib/asterisk/modules"
|
||||||
#define AST_SPOOL_DIR "/var/spool/asterisk"
|
#define AST_SPOOL_DIR "/var/spool/asterisk"
|
||||||
|
@@ -2,9 +2,13 @@
|
|||||||
; Voice over Frame Relay (Adtran style)
|
; Voice over Frame Relay (Adtran style)
|
||||||
;
|
;
|
||||||
; Configuration file
|
; Configuration file
|
||||||
;
|
|
||||||
[interfaces]
|
[interfaces]
|
||||||
;
|
;
|
||||||
|
; Default language
|
||||||
|
;
|
||||||
|
;language=en
|
||||||
|
;
|
||||||
; Lines for which we are the user termination. They accept incoming
|
; Lines for which we are the user termination. They accept incoming
|
||||||
; and outgoing calls. We use the default context on the first 8 lines
|
; and outgoing calls. We use the default context on the first 8 lines
|
||||||
; used by internal phones.
|
; used by internal phones.
|
||||||
|
@@ -13,6 +13,10 @@ context=remote
|
|||||||
;
|
;
|
||||||
driver=aopen
|
driver=aopen
|
||||||
;
|
;
|
||||||
|
; Default language
|
||||||
|
;
|
||||||
|
;language=en
|
||||||
|
;
|
||||||
; We can optionally override the auto detection. This is necessary
|
; We can optionally override the auto detection. This is necessary
|
||||||
; particularly if asterisk does not know about our kind of modem.
|
; particularly if asterisk does not know about our kind of modem.
|
||||||
;
|
;
|
||||||
|
@@ -16,6 +16,10 @@ autoanswer=yes
|
|||||||
;
|
;
|
||||||
extension=s
|
extension=s
|
||||||
;
|
;
|
||||||
|
; Default language
|
||||||
|
;
|
||||||
|
;language=en
|
||||||
|
;
|
||||||
; Silence supression can be enabled when sound is over a certain threshold.
|
; Silence supression can be enabled when sound is over a certain threshold.
|
||||||
; The value for the threshold should probably be between 500 and 2000 or so,
|
; The value for the threshold should probably be between 500 and 2000 or so,
|
||||||
; but your mileage may vary. Use the echo test to evaluate the best setting.
|
; but your mileage may vary. Use the echo test to evaluate the best setting.
|
||||||
|
@@ -43,14 +43,14 @@ int ast_format_register(char *name, char *exts, int format,
|
|||||||
|
|
||||||
int ast_format_unregister(char *name);
|
int ast_format_unregister(char *name);
|
||||||
|
|
||||||
/* Start streaming a file */
|
/* Start streaming a file, in the preferred language if possible */
|
||||||
int ast_streamfile(struct ast_channel *c, char *filename);
|
int ast_streamfile(struct ast_channel *c, char *filename, char *preflang);
|
||||||
|
|
||||||
/* Stop playback of a stream */
|
/* Stop playback of a stream */
|
||||||
int ast_stopstream(struct ast_channel *c);
|
int ast_stopstream(struct ast_channel *c);
|
||||||
|
|
||||||
/* See if a given file exists in a given format. If fmt is NULL, any format is accepted.*/
|
/* See if a given file exists in a given format. If fmt is NULL, any format is accepted.*/
|
||||||
int ast_fileexists(char *filename, char *fmt);
|
int ast_fileexists(char *filename, char *fmt, char *preflang);
|
||||||
|
|
||||||
/* Rename a given file in a given format, or if fmt is NULL, then do so for all */
|
/* Rename a given file in a given format, or if fmt is NULL, then do so for all */
|
||||||
int ast_filerename(char *oldname, char *newname, char *fmt);
|
int ast_filerename(char *oldname, char *newname, char *fmt);
|
||||||
|
@@ -24,6 +24,7 @@ extern int option_nofork;
|
|||||||
extern int option_quiet;
|
extern int option_quiet;
|
||||||
extern int option_console;
|
extern int option_console;
|
||||||
extern int fully_booted;
|
extern int fully_booted;
|
||||||
|
extern char defaultlanguage[];
|
||||||
|
|
||||||
#define VERBOSE_PREFIX_1 " "
|
#define VERBOSE_PREFIX_1 " "
|
||||||
#define VERBOSE_PREFIX_2 " == "
|
#define VERBOSE_PREFIX_2 " == "
|
||||||
|
@@ -21,9 +21,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ast_say_number(struct ast_channel *chan, int num);
|
int ast_say_number(struct ast_channel *chan, int num, char *lang);
|
||||||
int ast_say_digits(struct ast_channel *chan, int num);
|
int ast_say_digits(struct ast_channel *chan, int num, char *lang);
|
||||||
int ast_say_digit_str(struct ast_channel *chan, char *num);
|
int ast_say_digit_str(struct ast_channel *chan, char *num, char *lang);
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
|
@@ -79,6 +79,7 @@ struct ast_modem_pvt {
|
|||||||
char context[AST_MAX_EXTENSION];
|
char context[AST_MAX_EXTENSION];
|
||||||
char cid[AST_MAX_EXTENSION]; /* Caller ID if available */
|
char cid[AST_MAX_EXTENSION]; /* Caller ID if available */
|
||||||
char initstr[AST_MAX_INIT_STR]; /* Modem initialization String */
|
char initstr[AST_MAX_INIT_STR]; /* Modem initialization String */
|
||||||
|
char language[MAX_LANGUAGE]; /* default language */
|
||||||
char response[256]; /* Static response buffer */
|
char response[256]; /* Static response buffer */
|
||||||
struct ast_modem_driver *mc; /* Modem Capability */
|
struct ast_modem_driver *mc; /* Modem Capability */
|
||||||
struct ast_modem_pvt *next; /* Next channel in list */
|
struct ast_modem_pvt *next; /* Next channel in list */
|
||||||
|
66
say.c
66
say.c
@@ -17,14 +17,14 @@
|
|||||||
#include <asterisk/say.h>
|
#include <asterisk/say.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int ast_say_digit_str(struct ast_channel *chan, char *fn2)
|
int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *lang)
|
||||||
{
|
{
|
||||||
char fn[256] = "";
|
char fn[256] = "";
|
||||||
int num = 0;
|
int num = 0;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
while(fn2[num] && !res) {
|
while(fn2[num] && !res) {
|
||||||
snprintf(fn, sizeof(fn), "digits/%c", fn2[num]);
|
snprintf(fn, sizeof(fn), "digits/%c", fn2[num]);
|
||||||
res = ast_streamfile(chan, fn);
|
res = ast_streamfile(chan, fn, lang);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
@@ -33,45 +33,51 @@ int ast_say_digit_str(struct ast_channel *chan, char *fn2)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_say_digits(struct ast_channel *chan, int num)
|
int ast_say_digits(struct ast_channel *chan, int num, char *lang)
|
||||||
{
|
{
|
||||||
char fn2[256];
|
char fn2[256];
|
||||||
snprintf(fn2, sizeof(fn2), "%d", num);
|
snprintf(fn2, sizeof(fn2), "%d", num);
|
||||||
return ast_say_digit_str(chan, fn2);
|
return ast_say_digit_str(chan, fn2, lang);
|
||||||
}
|
}
|
||||||
int ast_say_number(struct ast_channel *chan, int num)
|
int ast_say_number(struct ast_channel *chan, int num, char *language)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int playh = 0;
|
int playh = 0;
|
||||||
char fn[256] = "";
|
char fn[256] = "";
|
||||||
while(num && !res) {
|
if (0) {
|
||||||
if (playh) {
|
/* XXX Only works for english XXX */
|
||||||
snprintf(fn, sizeof(fn), "digits/hundred");
|
} else {
|
||||||
playh = 0;
|
/* Use english numbers */
|
||||||
} else
|
language = "en";
|
||||||
if (num < 20) {
|
while(num && !res) {
|
||||||
snprintf(fn, sizeof(fn), "digits/%d", num);
|
if (playh) {
|
||||||
num = 0;
|
snprintf(fn, sizeof(fn), "digits/hundred");
|
||||||
} else
|
playh = 0;
|
||||||
if (num < 100) {
|
} else
|
||||||
snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
|
if (num < 20) {
|
||||||
num -= ((num / 10) * 10);
|
snprintf(fn, sizeof(fn), "digits/%d", num);
|
||||||
} else {
|
num = 0;
|
||||||
if (num < 1000){
|
} else
|
||||||
snprintf(fn, sizeof(fn), "digits/%d", (num/100));
|
if (num < 100) {
|
||||||
playh++;
|
snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
|
||||||
|
num -= ((num / 10) * 10);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
|
if (num < 1000){
|
||||||
res = -1;
|
snprintf(fn, sizeof(fn), "digits/%d", (num/100));
|
||||||
|
playh++;
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
|
||||||
|
res = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!res) {
|
||||||
|
res = ast_streamfile(chan, fn, language);
|
||||||
|
if (!res)
|
||||||
|
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||||
|
ast_stopstream(chan);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!res) {
|
|
||||||
res = ast_streamfile(chan, fn);
|
|
||||||
if (!res)
|
|
||||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
|
||||||
ast_stopstream(chan);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user