mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Change SendImage() to output a more consistent status variable.
(closes issue #13134) Reported by: eliel Patches: app_image.c.patch uploaded by eliel (license 64) UPGRADE.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@134088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -102,6 +102,10 @@ Application Changes
|
|||||||
* The Dial() application no longer copies the language used by the caller to the callee's
|
* The Dial() application no longer copies the language used by the caller to the callee's
|
||||||
channel. If you desire for the caller's channel's language to be used for file playback
|
channel. If you desire for the caller's channel's language to be used for file playback
|
||||||
to the callee, then the file specified may be prepended with "${CHANNEL(language)}/" .
|
to the callee, then the file specified may be prepended with "${CHANNEL(language)}/" .
|
||||||
|
* SendImage() no longer hangs up the channel on error; instead, it sets the
|
||||||
|
status variable SENDIMAGESTATUS to one of 'SUCCESS', 'FAILURE', or
|
||||||
|
'UNSUPPORTED'. This change makes SendImage() more consistent with other
|
||||||
|
applications.
|
||||||
|
|
||||||
SIP Changes
|
SIP Changes
|
||||||
-----------
|
-----------
|
||||||
|
@@ -97,6 +97,13 @@ Voicemail:
|
|||||||
|
|
||||||
Applications:
|
Applications:
|
||||||
|
|
||||||
|
* SendImage() no longer hangs up the channel on transmission error or on
|
||||||
|
another type of error; in those cases, a FAILURE status is stored in
|
||||||
|
SENDIMAGESTATUS and dialplan execution continues. The possible return values
|
||||||
|
stored in SENDIMAGESTATUS are: SUCCESS, FAILURE, and UNSUPPORTED. ('OK' has
|
||||||
|
been replaced with 'SUCCESS', and 'NOSUPPORT' has been replaced with
|
||||||
|
'UNSUPPORTED'). This change makes the SendImage application more consistent
|
||||||
|
with other applications.
|
||||||
* ChanIsAvail() now has a 't' option, which allows the specified device
|
* ChanIsAvail() now has a 't' option, which allows the specified device
|
||||||
to be queried for state without consulting the channel drivers. This
|
to be queried for state without consulting the channel drivers. This
|
||||||
performs mostly a 'ChanExists' sort of function.
|
performs mostly a 'ChanExists' sort of function.
|
||||||
|
@@ -39,16 +39,15 @@ static char *synopsis = "Send an image file";
|
|||||||
|
|
||||||
static char *descrip =
|
static char *descrip =
|
||||||
" SendImage(filename): Sends an image on a channel.\n"
|
" SendImage(filename): Sends an image on a channel.\n"
|
||||||
"If the channel supports image transport but the image send fails, the channel\n"
|
"Result of transmission will be stored in SENDIMAGESTATUS\n"
|
||||||
"will be hung up. Otherwise, the dialplan continues execution. This\n"
|
"channel variable:\n"
|
||||||
"application sets the following channel variable upon completion:\n"
|
" SUCCESS Transmission succeeded\n"
|
||||||
" SENDIMAGESTATUS The status is the result of the attempt, one of:\n"
|
" FAILURE Transmission failed\n"
|
||||||
" OK | NOSUPPORT \n";
|
" UNSUPPORTED Image transmission not supported by channel\n";
|
||||||
|
|
||||||
|
|
||||||
static int sendimage_exec(struct ast_channel *chan, void *data)
|
static int sendimage_exec(struct ast_channel *chan, void *data)
|
||||||
{
|
{
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
if (ast_strlen_zero(data)) {
|
if (ast_strlen_zero(data)) {
|
||||||
ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
|
ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
|
||||||
@@ -57,14 +56,17 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
if (!ast_supports_images(chan)) {
|
if (!ast_supports_images(chan)) {
|
||||||
/* Does not support transport */
|
/* Does not support transport */
|
||||||
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(res = ast_send_image(chan, data)))
|
if (!ast_send_image(chan, data)) {
|
||||||
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
|
||||||
|
} else {
|
||||||
return res;
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
|
Reference in New Issue
Block a user