mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-07 13:49:18 +00:00
Code cleanup
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2919 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
7
app.c
7
app.c
@@ -260,7 +260,8 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between) {
|
int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between)
|
||||||
|
{
|
||||||
char *ptr=NULL;
|
char *ptr=NULL;
|
||||||
int res=0;
|
int res=0;
|
||||||
struct ast_frame f;
|
struct ast_frame f;
|
||||||
@@ -286,8 +287,7 @@ int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digi
|
|||||||
f.src = "ast_dtmf_stream";
|
f.src = "ast_dtmf_stream";
|
||||||
if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
|
if (strchr("0123456789*#abcdABCD",*ptr)==NULL) {
|
||||||
ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
|
ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
res = ast_write(chan, &f);
|
res = ast_write(chan, &f);
|
||||||
if (res)
|
if (res)
|
||||||
break;
|
break;
|
||||||
@@ -301,6 +301,5 @@ int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digi
|
|||||||
if (peer)
|
if (peer)
|
||||||
res = ast_autoservice_stop(peer);
|
res = ast_autoservice_stop(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include <asterisk/musiconhold.h>
|
#include <asterisk/musiconhold.h>
|
||||||
#include <asterisk/callerid.h>
|
#include <asterisk/callerid.h>
|
||||||
#include <asterisk/utils.h>
|
#include <asterisk/utils.h>
|
||||||
|
#include <asterisk/app.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -477,10 +478,9 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
sdtmfptr = strchr(sdtmfdata, ')');
|
sdtmfptr = strchr(sdtmfdata, ')');
|
||||||
if (sdtmfptr)
|
if (sdtmfptr)
|
||||||
*sdtmfptr = '\0';
|
*sdtmfptr = '\0';
|
||||||
else {
|
else
|
||||||
ast_log(LOG_WARNING, "D( Data lacking trailing ')'\n");
|
ast_log(LOG_WARNING, "D( Data lacking trailing ')'\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX LIMIT SUPPORT */
|
/* XXX LIMIT SUPPORT */
|
||||||
if ((limitptr = strstr(transfer, "L("))) {
|
if ((limitptr = strstr(transfer, "L("))) {
|
||||||
@@ -494,9 +494,8 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
limitptr = strchr(limitdata, ')');
|
limitptr = strchr(limitdata, ')');
|
||||||
if (limitptr)
|
if (limitptr)
|
||||||
*limitptr = '\0';
|
*limitptr = '\0';
|
||||||
else {
|
else
|
||||||
ast_log(LOG_WARNING, "Limit Data lacking trailing ')'\n");
|
ast_log(LOG_WARNING, "Limit Data lacking trailing ')'\n");
|
||||||
}
|
|
||||||
|
|
||||||
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
var = pbx_builtin_getvar_helper(chan,"LIMIT_PLAYAUDIO_CALLER");
|
||||||
play_to_caller = var ? ast_true(var) : 1;
|
play_to_caller = var ? ast_true(var) : 1;
|
||||||
@@ -544,8 +543,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
if (!play_warning && !start_sound && !end_sound && timelimit) {
|
if (!play_warning && !start_sound && !end_sound && timelimit) {
|
||||||
calldurationlimit=timelimit/1000;
|
calldurationlimit=timelimit/1000;
|
||||||
timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
|
timelimit=play_to_caller=play_to_callee=play_warning=warning_freq=0;
|
||||||
}
|
} else if (option_verbose > 2) {
|
||||||
else if (option_verbose > 2) {
|
|
||||||
ast_verbose(VERBOSE_PREFIX_3"Limit Data:\n");
|
ast_verbose(VERBOSE_PREFIX_3"Limit Data:\n");
|
||||||
ast_verbose(VERBOSE_PREFIX_3"timelimit=%ld\n",timelimit);
|
ast_verbose(VERBOSE_PREFIX_3"timelimit=%ld\n",timelimit);
|
||||||
ast_verbose(VERBOSE_PREFIX_3"play_warning=%ld\n",play_warning);
|
ast_verbose(VERBOSE_PREFIX_3"play_warning=%ld\n",play_warning);
|
||||||
@@ -556,7 +554,6 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_verbose(VERBOSE_PREFIX_3"warning_sound=%s\n",warning_sound ? warning_sound : "UNDEF");
|
ast_verbose(VERBOSE_PREFIX_3"warning_sound=%s\n",warning_sound ? warning_sound : "UNDEF");
|
||||||
ast_verbose(VERBOSE_PREFIX_3"end_sound=%s\n",end_sound ? end_sound : "UNDEF");
|
ast_verbose(VERBOSE_PREFIX_3"end_sound=%s\n",end_sound ? end_sound : "UNDEF");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX ANNOUNCE SUPPORT */
|
/* XXX ANNOUNCE SUPPORT */
|
||||||
@@ -845,8 +842,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
// Ok, done. stop autoservice
|
// Ok, done. stop autoservice
|
||||||
res = ast_autoservice_stop(chan);
|
res = ast_autoservice_stop(chan);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
@@ -854,8 +850,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
time(&now);
|
time(&now);
|
||||||
chan->whentohangup = now + calldurationlimit;
|
chan->whentohangup = now + calldurationlimit;
|
||||||
}
|
}
|
||||||
|
if (!ast_strlen_zero(sdtmfdata))
|
||||||
if(strlen(sdtmfdata))
|
|
||||||
res = ast_dtmf_stream(peer,chan,sdtmfdata,0);
|
res = ast_dtmf_stream(peer,chan,sdtmfdata,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,8 +868,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
config.end_sound = end_sound;
|
config.end_sound = end_sound;
|
||||||
config.start_sound = start_sound;
|
config.start_sound = start_sound;
|
||||||
res = ast_bridge_call(chan,peer,&config);
|
res = ast_bridge_call(chan,peer,&config);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
if (res != AST_PBX_NO_HANGUP_PEER)
|
if (res != AST_PBX_NO_HANGUP_PEER)
|
||||||
|
@@ -48,7 +48,7 @@ extern int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
|||||||
//! Safely spawn an external program while closingn file descriptors
|
//! Safely spawn an external program while closingn file descriptors
|
||||||
extern int ast_safe_system(const char *s);
|
extern int ast_safe_system(const char *s);
|
||||||
|
|
||||||
// send DTMF to chan (optionally entertain peer)
|
//! Send DTMF to chan (optionally entertain peer)
|
||||||
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, char *digits, int between);
|
int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, char *digits, int between);
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
Reference in New Issue
Block a user