mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
Merge changes dealing with support for Digium phones.
Presence support has been added. This is accomplished by allowing for presence hints in addition to device state hints. A dialplan function called PRESENCE_STATE has been added to allow for setting and reading presence. Presence can be transmitted to Digium phones using custom XML elements in a PIDF presence document. Voicemail has new APIs that allow for moving, removing, forwarding, and playing messages. Messages have had a new unique message ID added to them so that the APIs will work reliably. The state of a voicemail mailbox can be obtained using an API that allows one to get a snapshot of the mailbox. A voicemail Dialplan App called VoiceMailPlayMsg has been added to be able to play back a specific message. Configuration hooks have been added. Configuration hooks allow for a piece of code to be executed when a specific configuration file is loaded by a specific module. This is useful for modules that are dependent on the configuration of other modules. chan_sip now has a public method that allows for a custom SIP INFO request to be sent mid-dialog. Digium phones use this in order to display progress bars when files are played. Messaging support has been expanded a bit. The main visible difference is the addition of an AMI action MessageSend. Finally, a ParkingLots manager action has been added in order to get a list of parking lots. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
44
main/file.c
44
main/file.c
@@ -1237,11 +1237,18 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
|
||||
/*!
|
||||
* \brief the core of all waitstream() functions
|
||||
*/
|
||||
static int waitstream_core(struct ast_channel *c, const char *breakon,
|
||||
const char *forward, const char *reverse, int skip_ms,
|
||||
int audiofd, int cmdfd, const char *context)
|
||||
static int waitstream_core(struct ast_channel *c,
|
||||
const char *breakon,
|
||||
const char *forward,
|
||||
const char *reverse,
|
||||
int skip_ms,
|
||||
int audiofd,
|
||||
int cmdfd,
|
||||
const char *context,
|
||||
ast_waitstream_fr_cb cb)
|
||||
{
|
||||
const char *orig_chan_name = NULL;
|
||||
|
||||
int err = 0;
|
||||
|
||||
if (!breakon)
|
||||
@@ -1257,6 +1264,11 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
|
||||
if (ast_test_flag(ast_channel_flags(c), AST_FLAG_MASQ_NOSTREAM))
|
||||
orig_chan_name = ast_strdupa(ast_channel_name(c));
|
||||
|
||||
if (ast_channel_stream(c) && cb) {
|
||||
long ms_len = ast_tellstream(ast_channel_stream(c)) / (ast_format_rate(&ast_channel_stream(c)->fmt->format) / 1000);
|
||||
cb(c, ms_len, AST_WAITSTREAM_CB_START);
|
||||
}
|
||||
|
||||
while (ast_channel_stream(c)) {
|
||||
int res;
|
||||
int ms;
|
||||
@@ -1318,6 +1330,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
enum ast_waitstream_fr_cb_values cb_val = 0;
|
||||
res = fr->subclass.integer;
|
||||
if (strchr(forward, res)) {
|
||||
int eoftest;
|
||||
@@ -1328,13 +1341,19 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
|
||||
} else {
|
||||
ungetc(eoftest, ast_channel_stream(c)->f);
|
||||
}
|
||||
cb_val = AST_WAITSTREAM_CB_FASTFORWARD;
|
||||
} else if (strchr(reverse, res)) {
|
||||
ast_stream_rewind(ast_channel_stream(c), skip_ms);
|
||||
cb_val = AST_WAITSTREAM_CB_REWIND;
|
||||
} else if (strchr(breakon, res)) {
|
||||
ast_frfree(fr);
|
||||
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
|
||||
return res;
|
||||
}
|
||||
if (cb_val && cb) {
|
||||
long ms_len = ast_tellstream(ast_channel_stream(c)) / (ast_format_rate(&ast_channel_stream(c)->fmt->format) / 1000);
|
||||
cb(c, ms_len, cb_val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AST_FRAME_CONTROL:
|
||||
@@ -1385,21 +1404,32 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
|
||||
return (err || ast_channel_softhangup_internal_flag(c)) ? -1 : 0;
|
||||
}
|
||||
|
||||
int ast_waitstream_fr_w_cb(struct ast_channel *c,
|
||||
const char *breakon,
|
||||
const char *forward,
|
||||
const char *reverse,
|
||||
int ms,
|
||||
ast_waitstream_fr_cb cb)
|
||||
{
|
||||
return waitstream_core(c, breakon, forward, reverse, ms,
|
||||
-1 /* no audiofd */, -1 /* no cmdfd */, NULL /* no context */, cb);
|
||||
}
|
||||
|
||||
int ast_waitstream_fr(struct ast_channel *c, const char *breakon, const char *forward, const char *reverse, int ms)
|
||||
{
|
||||
return waitstream_core(c, breakon, forward, reverse, ms,
|
||||
-1 /* no audiofd */, -1 /* no cmdfd */, NULL /* no context */);
|
||||
-1 /* no audiofd */, -1 /* no cmdfd */, NULL /* no context */, NULL /* no callback */);
|
||||
}
|
||||
|
||||
int ast_waitstream(struct ast_channel *c, const char *breakon)
|
||||
{
|
||||
return waitstream_core(c, breakon, NULL, NULL, 0, -1, -1, NULL);
|
||||
return waitstream_core(c, breakon, NULL, NULL, 0, -1, -1, NULL, NULL /* no callback */);
|
||||
}
|
||||
|
||||
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int cmdfd)
|
||||
{
|
||||
return waitstream_core(c, breakon, NULL, NULL, 0,
|
||||
audiofd, cmdfd, NULL /* no context */);
|
||||
audiofd, cmdfd, NULL /* no context */, NULL /* no callback */);
|
||||
}
|
||||
|
||||
int ast_waitstream_exten(struct ast_channel *c, const char *context)
|
||||
@@ -1410,7 +1440,7 @@ int ast_waitstream_exten(struct ast_channel *c, const char *context)
|
||||
if (!context)
|
||||
context = ast_channel_context(c);
|
||||
return waitstream_core(c, NULL, NULL, NULL, 0,
|
||||
-1, -1, context);
|
||||
-1, -1, context, NULL /* no callback */);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user