Add support for Digium Phones.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8-digiumphones@357459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jason Parker
2012-02-28 21:52:48 +00:00
parent f11923e651
commit f9834fd128
41 changed files with 6074 additions and 153 deletions

View File

@@ -273,18 +273,21 @@ static int (*ast_inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsg
static int (*ast_inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) = NULL;
static int (*ast_sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context) = NULL;
static int (*ast_messagecount_func)(const char *context, const char *mailbox, const char *folder) = NULL;
static int (*ast_copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data) = NULL;
void ast_install_vm_functions(int (*has_voicemail_func)(const char *mailbox, const char *folder),
int (*inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs),
int (*inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs),
int (*messagecount_func)(const char *context, const char *mailbox, const char *folder),
int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context))
int (*sayname_func)(struct ast_channel *chan, const char *mailbox, const char *context),
int (*copy_recording_to_vm_func)(struct ast_vm_recording_data *vm_rec_data))
{
ast_has_voicemail_func = has_voicemail_func;
ast_inboxcount_func = inboxcount_func;
ast_inboxcount2_func = inboxcount2_func;
ast_messagecount_func = messagecount_func;
ast_sayname_func = sayname_func;
ast_copy_recording_to_vm_func = copy_recording_to_vm_func;
}
void ast_uninstall_vm_functions(void)
@@ -294,6 +297,7 @@ void ast_uninstall_vm_functions(void)
ast_inboxcount2_func = NULL;
ast_messagecount_func = NULL;
ast_sayname_func = NULL;
ast_copy_recording_to_vm_func = NULL;
}
int ast_app_has_voicemail(const char *mailbox, const char *folder)
@@ -309,6 +313,28 @@ int ast_app_has_voicemail(const char *mailbox, const char *folder)
return 0;
}
/*!
* \internal
* \brief Function used as a callback for ast_copy_recording_to_vm when a real one isn't installed.
* \param vm_rec_data Stores crucial information about the voicemail that will basically just be used
* to figure out what the name of the recipient was supposed to be
*/
int ast_app_copy_recording_to_vm(struct ast_vm_recording_data *vm_rec_data)
{
static int warned = 0;
if (ast_copy_recording_to_vm_func) {
return ast_copy_recording_to_vm_func(vm_rec_data);
}
if (warned++ % 10 == 0) {
ast_verb(3, "copy recording to voicemail called to copy %s.%s to %s@%s, but voicemail not loaded.\n",
vm_rec_data->recording_file, vm_rec_data->recording_ext,
vm_rec_data->mailbox, vm_rec_data->context);
}
return -1;
}
int ast_app_inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
{
@@ -558,10 +584,16 @@ int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, in
return res;
}
int ast_control_streamfile(struct ast_channel *chan, const char *file,
const char *fwd, const char *rev,
const char *stop, const char *suspend,
const char *restart, int skipms, long *offsetms)
static int control_streamfile(struct ast_channel *chan,
const char *file,
const char *fwd,
const char *rev,
const char *stop,
const char *suspend,
const char *restart,
int skipms,
long *offsetms,
ast_waitstream_fr_cb cb)
{
char *breaks = NULL;
char *end = NULL;
@@ -632,7 +664,11 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
ast_seekstream(chan->stream, offset, SEEK_SET);
offset = 0;
}
res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
if (cb) {
res = ast_waitstream_fr_w_cb(chan, breaks, fwd, rev, skipms, cb);
} else {
res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
}
}
if (res < 1) {
@@ -696,6 +732,28 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
return res;
}
int ast_control_streamfile_w_cb(struct ast_channel *chan,
const char *file,
const char *fwd,
const char *rev,
const char *stop,
const char *suspend,
const char *restart,
int skipms,
long *offsetms,
ast_waitstream_fr_cb cb)
{
return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, cb);
}
int ast_control_streamfile(struct ast_channel *chan, const char *file,
const char *fwd, const char *rev,
const char *stop, const char *suspend,
const char *restart, int skipms, long *offsetms)
{
return control_streamfile(chan, file, fwd, rev, stop, suspend, restart, skipms, offsetms, NULL);
}
int ast_play_and_wait(struct ast_channel *chan, const char *fn)
{
int d = 0;