After some study, thought, comparing, etc. I've backed out the previous universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2007-07-19 23:24:27 +00:00
parent 7756ba6619
commit 0e969271ae
28 changed files with 250 additions and 135 deletions
+89 -89
View File
@@ -451,7 +451,7 @@ static void senddialendevent(const struct ast_channel *src, const char *dialstat
* the outgoing channel without properly deleting it.
*/
static void do_forward(struct chanlist *o,
struct cause_args *num, struct ast_flags *peerflags, int single)
struct cause_args *num, struct ast_flags64 *peerflags, int single)
{
char tmpchan[256];
struct ast_channel *original = o->chan;
@@ -477,7 +477,7 @@ static void do_forward(struct chanlist *o,
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, c->name);
/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
if (ast_test_flag(peerflags, OPT_IGNORE_FORWARDING)) {
if (ast_test_flag64(peerflags, OPT_IGNORE_FORWARDING)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
c = o->chan = NULL;
@@ -499,14 +499,14 @@ static void do_forward(struct chanlist *o,
c = o->chan = NULL;
}
if (!c) {
ast_clear_flag(o, DIAL_STILLGOING);
ast_clear_flag64(o, DIAL_STILLGOING);
handle_cause(cause, num);
} else {
char *new_cid_num, *new_cid_name;
struct ast_channel *src;
ast_rtp_make_compatible(c, in, single);
if (ast_test_flag(o, OPT_FORCECLID)) {
if (ast_test_flag64(o, OPT_FORCECLID)) {
new_cid_num = ast_strdup(S_OR(in->macroexten, in->exten));
new_cid_name = NULL; /* XXX no name ? */
src = c; /* XXX possible bug in previous code, which used 'winner' ? it may have changed */
@@ -526,14 +526,14 @@ static void do_forward(struct chanlist *o,
S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(in->macroexten, in->exten)));
if (ast_call(c, tmpchan, 0)) {
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
ast_clear_flag(o, DIAL_STILLGOING);
ast_clear_flag64(o, DIAL_STILLGOING);
ast_hangup(original);
c = o->chan = NULL;
num->nochan++;
} else {
senddialevent(in, c);
/* After calling, set callerid to extension */
if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID)) {
if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
char cidname[AST_MAX_EXTENSION] = "";
ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
}
@@ -553,7 +553,7 @@ struct privacy_args {
};
static struct ast_channel *wait_for_answer(struct ast_channel *in,
struct chanlist *outgoing, int *to, struct ast_flags *peerflags,
struct chanlist *outgoing, int *to, struct ast_flags64 *peerflags,
struct privacy_args *pa,
const struct cause_args *num_in, int *result)
{
@@ -562,7 +562,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
int orig = *to;
struct ast_channel *peer = NULL;
/* single is set if only one destination is enabled */
int single = outgoing && !outgoing->next && !ast_test_flag(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
int single = outgoing && !outgoing->next && !ast_test_flag64(outgoing, OPT_MUSICBACK | OPT_RINGBACK);
if (single) {
/* Turn off hold music, etc */
@@ -582,7 +582,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
watchers[pos++] = in;
for (o = outgoing; o; o = o->next) {
/* Keep track of important channels */
if (ast_test_flag(o, DIAL_STILLGOING) && o->chan)
if (ast_test_flag64(o, DIAL_STILLGOING) && o->chan)
watchers[pos++] = o->chan;
numlines++;
}
@@ -610,12 +610,12 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
if (c == NULL)
continue;
if (ast_test_flag(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
if (ast_test_flag64(o, DIAL_STILLGOING) && c->_state == AST_STATE_UP) {
if (!peer) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s answered %s\n", c->name, in->name);
peer = c;
ast_copy_flags(peerflags, o,
ast_copy_flags64(peerflags, o,
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
@@ -638,7 +638,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
in->hangupcause = c->hangupcause;
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag(o, DIAL_STILLGOING);
ast_clear_flag64(o, DIAL_STILLGOING);
handle_cause(in->hangupcause, &num);
continue;
}
@@ -650,7 +650,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "%s answered %s\n", c->name, in->name);
peer = c;
ast_copy_flags(peerflags, o,
ast_copy_flags64(peerflags, o,
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
@@ -671,7 +671,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
in->hangupcause = c->hangupcause;
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag(o, DIAL_STILLGOING);
ast_clear_flag64(o, DIAL_STILLGOING);
handle_cause(AST_CAUSE_BUSY, &num);
break;
case AST_CONTROL_CONGESTION:
@@ -680,7 +680,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
in->hangupcause = c->hangupcause;
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag(o, DIAL_STILLGOING);
ast_clear_flag64(o, DIAL_STILLGOING);
handle_cause(AST_CAUSE_CONGESTION, &num);
break;
case AST_CONTROL_RINGING:
@@ -689,7 +689,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* Setup early media if appropriate */
if (single)
ast_channel_early_bridge(in, c);
if (!(pa->sentringing) && !ast_test_flag(outgoing, OPT_MUSICBACK)) {
if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK)) {
ast_indicate(in, AST_CONTROL_RINGING);
pa->sentringing++;
}
@@ -700,7 +700,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* Setup early media if appropriate */
if (single)
ast_channel_early_bridge(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
if (!ast_test_flag64(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROGRESS);
break;
case AST_CONTROL_VIDUPDATE:
@@ -713,7 +713,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_verbose (VERBOSE_PREFIX_3 "%s is proceeding passing it to %s\n", c->name, in->name);
if (single)
ast_channel_early_bridge(in, c);
if (!ast_test_flag(outgoing, OPT_RINGBACK))
if (!ast_test_flag64(outgoing, OPT_RINGBACK))
ast_indicate(in, AST_CONTROL_PROCEEDING);
break;
case AST_CONTROL_HOLD:
@@ -731,7 +731,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* Ignore going off hook and flash */
break;
case -1:
if (!ast_test_flag(outgoing, OPT_RINGBACK | OPT_MUSICBACK)) {
if (!ast_test_flag64(outgoing, OPT_RINGBACK | OPT_MUSICBACK)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s stopped sounds\n", c->name);
ast_indicate(in, -1);
@@ -743,16 +743,16 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
}
} else if (single) {
/* XXX are we sure the logic is correct ? or we should just switch on f->frametype ? */
if (f->frametype == AST_FRAME_VOICE && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
if (f->frametype == AST_FRAME_VOICE && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
if (ast_write(in, f))
ast_log(LOG_WARNING, "Unable to forward voice frame\n");
} else if (f->frametype == AST_FRAME_IMAGE && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
} else if (f->frametype == AST_FRAME_IMAGE && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
if (ast_write(in, f))
ast_log(LOG_WARNING, "Unable to forward image\n");
} else if (f->frametype == AST_FRAME_TEXT && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
} else if (f->frametype == AST_FRAME_TEXT && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
if (ast_write(in, f))
ast_log(LOG_WARNING, "Unable to send text\n");
} else if (f->frametype == AST_FRAME_HTML && !ast_test_flag(outgoing, DIAL_NOFORWARDHTML)) {
} else if (f->frametype == AST_FRAME_HTML && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML)) {
if (ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1)
ast_log(LOG_WARNING, "Unable to send URL\n");
}
@@ -779,7 +779,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* now f is guaranteed non-NULL */
if (f->frametype == AST_FRAME_DTMF) {
if (ast_test_flag(peerflags, OPT_DTMF_EXIT)) {
if (ast_test_flag64(peerflags, OPT_DTMF_EXIT)) {
const char *context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
if (onedigit_goto(in, context, (char) f->subclass, 1)) {
if (option_verbose > 2)
@@ -793,7 +793,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
}
}
if (ast_test_flag(peerflags, OPT_CALLER_HANGUP) &&
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
(f->subclass == '*')) { /* hmm it it not guaranteed to be '*' anymore. */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
@@ -806,7 +806,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
}
/* Forward HTML stuff */
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag(outgoing, DIAL_NOFORWARDHTML))
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
if(ast_channel_sendhtml(outgoing->chan, f->subclass, f->data, f->datalen) == -1)
ast_log(LOG_WARNING, "Unable to send URL\n");
@@ -845,13 +845,13 @@ static void replace_macro_delimiter(char *s)
/* returns true if there is a valid privacy reply */
static int valid_priv_reply(struct ast_flags *opts, int res)
static int valid_priv_reply(struct ast_flags64 *opts, int res)
{
if (res < '1')
return 0;
if (ast_test_flag(opts, OPT_PRIVACY) && res <= '5')
if (ast_test_flag64(opts, OPT_PRIVACY) && res <= '5')
return 1;
if (ast_test_flag(opts, OPT_SCREENING) && res <= '4')
if (ast_test_flag64(opts, OPT_SCREENING) && res <= '4')
return 1;
return 0;
}
@@ -955,7 +955,7 @@ static int do_timelimit(struct ast_channel *chan, struct ast_bridge_config *conf
}
static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
struct ast_flags *opts, char **opt_args, struct privacy_args *pa)
struct ast_flags64 *opts, char **opt_args, struct privacy_args *pa)
{
int res2;
@@ -969,13 +969,13 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
target extension was picked up. We are going to have to kill some
time and make the caller believe the peer hasn't picked up yet */
if (ast_test_flag(opts, OPT_MUSICBACK) && !ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
if (ast_test_flag64(opts, OPT_MUSICBACK) && !ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
char *original_moh = ast_strdupa(chan->musicclass);
ast_indicate(chan, -1);
ast_string_field_set(chan, musicclass, opt_args[OPT_ARG_MUSICBACK]);
ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
ast_string_field_set(chan, musicclass, original_moh);
} else if (ast_test_flag(opts, OPT_RINGBACK)) {
} else if (ast_test_flag64(opts, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
pa->sentringing++;
}
@@ -1000,9 +1000,9 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
/* now get input from the called party, as to their choice */
if( !res2 ) {
/* XXX can we have both, or they are mutually exclusive ? */
if( ast_test_flag(opts, OPT_PRIVACY) )
if( ast_test_flag64(opts, OPT_PRIVACY) )
res2 = ast_play_and_wait(peer,"priv-callee-options");
if( ast_test_flag(opts, OPT_SCREENING) )
if( ast_test_flag64(opts, OPT_SCREENING) )
res2 = ast_play_and_wait(peer,"screen-callee-options");
}
/*! \page DialPrivacy Dial Privacy scripts
@@ -1027,14 +1027,14 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
res2 = ast_play_and_wait(peer, "vm-sorry");
}
if (ast_test_flag(opts, OPT_MUSICBACK)) {
if (ast_test_flag64(opts, OPT_MUSICBACK)) {
ast_moh_stop(chan);
} else if (ast_test_flag(opts, OPT_RINGBACK)) {
} else if (ast_test_flag64(opts, OPT_RINGBACK)) {
ast_indicate(chan, -1);
pa->sentringing=0;
}
ast_autoservice_stop(chan);
if(ast_test_flag(opts, OPT_PRIVACY) && (res2 >= '1' && res2 <= '5')) {
if(ast_test_flag64(opts, OPT_PRIVACY) && (res2 >= '1' && res2 <= '5')) {
/* map keypresses to various things, the index is res2 - '1' */
static const char *_val[] = { "ALLOW", "DENY", "TORTURE", "KILL", "ALLOW" };
static const int _flag[] = { AST_PRIVACY_ALLOW, AST_PRIVACY_DENY, AST_PRIVACY_TORTURE, AST_PRIVACY_KILL, AST_PRIVACY_ALLOW};
@@ -1058,7 +1058,7 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
break;
case '5':
/* XXX should we set status to DENY ? */
if( ast_test_flag(opts, OPT_PRIVACY) )
if( ast_test_flag64(opts, OPT_PRIVACY) )
break;
/* if not privacy, then 5 is the same as "default" case */
default: /* bad input or -1 if failure to start autoservice */
@@ -1075,7 +1075,7 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
if (res2 == '1') { /* the only case where we actually connect */
/* if the intro is NOCALLERID, then there's no reason to leave it on disk, it'll
just clog things up, and it's not useful information, not being tied to a CID */
if( strncmp(pa->privcid,"NOCALLERID",10) == 0 || ast_test_flag(opts, OPT_SCREEN_NOINTRO) ) {
if( strncmp(pa->privcid,"NOCALLERID",10) == 0 || ast_test_flag64(opts, OPT_SCREEN_NOINTRO) ) {
ast_filedelete(pa->privintro, NULL);
if( ast_fileexists(pa->privintro, NULL, NULL ) > 0 )
ast_log(LOG_NOTICE, "privacy: ast_filedelete didn't do its job on %s\n", pa->privintro);
@@ -1091,7 +1091,7 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
/*! \brief returns 1 if successful, 0 or <0 if the caller should 'goto out' */
static int setup_privacy_args(struct privacy_args *pa,
struct ast_flags *opts, char *opt_args[], struct ast_channel *chan)
struct ast_flags64 *opts, char *opt_args[], struct ast_channel *chan)
{
char callerid[60];
int res;
@@ -1100,7 +1100,7 @@ static int setup_privacy_args(struct privacy_args *pa,
if (!ast_strlen_zero(chan->cid.cid_num)) {
l = ast_strdupa(chan->cid.cid_num);
ast_shrink_phone_number(l);
if (ast_test_flag(opts, OPT_PRIVACY) ) {
if (ast_test_flag64(opts, OPT_PRIVACY) ) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Privacy DB is '%s', clid is '%s'\n",
opt_args[OPT_ARG_PRIVACY], l);
@@ -1129,11 +1129,11 @@ static int setup_privacy_args(struct privacy_args *pa,
ast_copy_string(pa->privcid,l,sizeof(pa->privcid));
if( strncmp(pa->privcid,"NOCALLERID",10) != 0 && ast_test_flag(opts, OPT_SCREEN_NOCLID) ) { /* if callerid is set, and ast_test_flag(&opts, OPT_SCREEN_NOCLID) is set also */
if( strncmp(pa->privcid,"NOCALLERID",10) != 0 && ast_test_flag64(opts, OPT_SCREEN_NOCLID) ) { /* if callerid is set, and ast_test_flag64(&opts, OPT_SCREEN_NOCLID) is set also */
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "CallerID set (%s); N option set; Screening should be off\n", pa->privcid);
pa->privdb_val = AST_PRIVACY_ALLOW;
} else if (ast_test_flag(opts, OPT_SCREEN_NOCLID) && strncmp(pa->privcid,"NOCALLERID",10) == 0 ) {
} else if (ast_test_flag64(opts, OPT_SCREEN_NOCLID) && strncmp(pa->privcid,"NOCALLERID",10) == 0 ) {
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "CallerID blank; N option set; Screening should happen; dbval is %d\n", pa->privdb_val);
}
@@ -1195,7 +1195,7 @@ static int setup_privacy_args(struct privacy_args *pa,
return 1; /* success */
}
static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags, int *continue_exec)
static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags64 *peerflags, int *continue_exec)
{
int res = -1; /* default: error */
char *rest, *cur; /* scan the list of destinations */
@@ -1227,7 +1227,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
AST_APP_ARG(options);
AST_APP_ARG(url);
);
struct ast_flags opts = { 0, };
struct ast_flags64 opts = { 0, };
char *opt_args[OPT_ARG_ARRAY_SIZE];
if (ast_strlen_zero(data)) {
@@ -1243,7 +1243,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
memset(&config,0,sizeof(struct ast_bridge_config));
if (!ast_strlen_zero(args.options) &&
ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
ast_app_parse_options64(dial_exec_options, &opts, opt_args, args.options)) {
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
goto done;
}
@@ -1254,13 +1254,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
goto done;
}
if (ast_test_flag(&opts, OPT_OPERMODE)) {
if (ast_test_flag64(&opts, OPT_OPERMODE)) {
opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting operator services mode to %d.\n", opermode);
}
if (ast_test_flag(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
if (!calldurationlimit) {
ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
@@ -1271,22 +1271,22 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_verbose(VERBOSE_PREFIX_3 "Setting call duration limit to %d seconds.\n", calldurationlimit);
}
if (ast_test_flag(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
dtmfcalling = opt_args[OPT_ARG_SENDDTMF];
dtmfcalled = strsep(&dtmfcalling, ":");
}
if (ast_test_flag(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
if (ast_test_flag64(&opts, OPT_DURATION_LIMIT) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_LIMIT])) {
if (do_timelimit(chan, &config, opt_args[OPT_ARG_DURATION_LIMIT], &calldurationlimit))
goto done;
}
if (ast_test_flag(&opts, OPT_RESETCDR) && chan->cdr)
if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr)
ast_cdr_reset(chan->cdr, NULL);
if (ast_test_flag(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
opt_args[OPT_ARG_PRIVACY] = ast_strdupa(chan->exten);
if (ast_test_flag(&opts, OPT_PRIVACY) || ast_test_flag(&opts, OPT_SCREENING)) {
if (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) {
res = setup_privacy_args(&pa, &opts, opt_args, chan);
if (res <= 0)
goto out;
@@ -1304,7 +1304,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
}
ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
/* loop through the list of dial destinations */
rest = args.peers;
while ((cur = strsep(&rest, "&")) ) {
@@ -1320,14 +1320,14 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (!(tmp = ast_calloc(1, sizeof(*tmp))))
goto out;
if (opts.flags) {
ast_copy_flags(tmp, &opts,
ast_copy_flags64(tmp, &opts,
OPT_CANCEL_ELSEWHERE |
OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER |
OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP |
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
OPT_CALLEE_PARK | OPT_CALLER_PARK |
OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID);
ast_set2_flag(tmp, args.url, DIAL_NOFORWARDHTML);
ast_set2_flag64(tmp, args.url, DIAL_NOFORWARDHTML);
}
ast_copy_string(numsubst, number, sizeof(numsubst));
/* Request the peer */
@@ -1364,7 +1364,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_hangup(tc);
/* If we have been told to ignore forwards, just set this channel to null
* and continue processing extensions normally */
if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
if (ast_test_flag64(&opts, OPT_IGNORE_FORWARDING)) {
tc = NULL;
cause = AST_CAUSE_BUSY;
if (option_verbose > 2)
@@ -1453,13 +1453,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
senddialevent(chan, tc);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
if (!ast_test_flag(peerflags, OPT_ORIGINAL_CLID))
if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID))
ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), get_cid_name(cidname, sizeof(cidname), chan), NULL);
}
/* Put them in the list of outgoing thingies... We're ready now.
XXX If we're forcibly removed, these outgoing calls won't get
hung up XXX */
ast_set_flag(tmp, DIAL_STILLGOING);
ast_set_flag64(tmp, DIAL_STILLGOING);
tmp->chan = tc;
tmp->next = outgoing;
outgoing = tmp;
@@ -1483,7 +1483,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} else {
/* Our status will at least be NOANSWER */
strcpy(pa.status, "NOANSWER");
if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
if (ast_test_flag64(outgoing, OPT_MUSICBACK)) {
moh = 1;
if (!ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
char *original_moh = ast_strdupa(chan->musicclass);
@@ -1494,7 +1494,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_moh_start(chan, NULL, NULL);
}
ast_indicate(chan, AST_CONTROL_PROGRESS);
} else if (ast_test_flag(outgoing, OPT_RINGBACK)) {
} else if (ast_test_flag64(outgoing, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;
}
@@ -1537,13 +1537,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_debug(1, "app_dial: sendurl=%s.\n", args.url);
ast_channel_sendurl( peer, args.url );
}
if ( (ast_test_flag(&opts, OPT_PRIVACY) || ast_test_flag(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) {
if ( (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) && pa.privdb_val == AST_PRIVACY_UNKNOWN) {
if (do_privacy(chan, peer, &opts, opt_args, &pa)) {
res = 0;
goto out;
}
}
if (!ast_test_flag(&opts, OPT_ANNOUNCE) || ast_strlen_zero(opt_args[OPT_ARG_ANNOUNCE])) {
if (!ast_test_flag64(&opts, OPT_ANNOUNCE) || ast_strlen_zero(opt_args[OPT_ARG_ANNOUNCE])) {
res = 0;
} else {
int digit = 0;
@@ -1564,20 +1564,20 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
}
if (chan && peer && ast_test_flag(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
if (chan && peer && ast_test_flag64(&opts, OPT_GOTO) && !ast_strlen_zero(opt_args[OPT_ARG_GOTO])) {
replace_macro_delimiter(opt_args[OPT_ARG_GOTO]);
ast_parseable_goto(chan, opt_args[OPT_ARG_GOTO]);
ast_parseable_goto(peer, opt_args[OPT_ARG_GOTO]);
peer->priority++;
ast_pbx_start(peer);
hanguptree(outgoing, NULL, ast_test_flag(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0);
hanguptree(outgoing, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0);
if (continue_exec)
*continue_exec = 1;
res = 0;
goto done;
}
if (ast_test_flag(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) {
if (ast_test_flag64(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) {
struct ast_app *theapp;
const char *macro_result;
@@ -1609,18 +1609,18 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (!strcasecmp(macro_result, "BUSY")) {
ast_copy_string(pa.status, macro_result, sizeof(pa.status));
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(macro_result, "CONGESTION") || !strcasecmp(macro_result, "CHANUNAVAIL")) {
ast_copy_string(pa.status, macro_result, sizeof(pa.status));
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(macro_result, "CONTINUE")) {
/* hangup peer and keep chan alive assuming the macro has changed
the context / exten / priority or perhaps
the next priority in the current exten is desired.
*/
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(macro_result, "ABORT")) {
/* Hangup both ends unless the caller has the g flag */
@@ -1631,13 +1631,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (strchr(macro_transfer_dest, '^')) { /* context^exten^priority*/
replace_macro_delimiter(macro_transfer_dest);
if (!ast_parseable_goto(chan, macro_transfer_dest))
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
}
}
}
}
if (ast_test_flag(&opts, OPT_CALLEE_GOSUB) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GOSUB])) {
if (ast_test_flag64(&opts, OPT_CALLEE_GOSUB) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GOSUB])) {
struct ast_app *theapp;
const char *gosub_result;
char *gosub_args, *gosub_argstart;
@@ -1692,18 +1692,18 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (!strcasecmp(gosub_result, "BUSY")) {
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(gosub_result, "CONGESTION") || !strcasecmp(gosub_result, "CHANUNAVAIL")) {
ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(gosub_result, "CONTINUE")) {
/* hangup peer and keep chan alive assuming the macro has changed
the context / exten / priority or perhaps
the next priority in the current exten is desired.
*/
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
res = -1;
} else if (!strcasecmp(gosub_result, "ABORT")) {
/* Hangup both ends unless the caller has the g flag */
@@ -1714,7 +1714,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (strchr(gosub_transfer_dest, '^')) { /* context^exten^priority*/
replace_macro_delimiter(gosub_transfer_dest);
if (!ast_parseable_goto(chan, gosub_transfer_dest))
ast_set_flag(peerflags, OPT_GO_ON);
ast_set_flag64(peerflags, OPT_GO_ON);
}
}
}
@@ -1740,21 +1740,21 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
res = -1;
end_time = time(NULL);
} else {
if (ast_test_flag(peerflags, OPT_CALLEE_TRANSFER))
if (ast_test_flag64(peerflags, OPT_CALLEE_TRANSFER))
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
if (ast_test_flag(peerflags, OPT_CALLER_TRANSFER))
if (ast_test_flag64(peerflags, OPT_CALLER_TRANSFER))
ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
if (ast_test_flag(peerflags, OPT_CALLEE_HANGUP))
if (ast_test_flag64(peerflags, OPT_CALLEE_HANGUP))
ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
if (ast_test_flag(peerflags, OPT_CALLER_HANGUP))
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP))
ast_set_flag(&(config.features_caller), AST_FEATURE_DISCONNECT);
if (ast_test_flag(peerflags, OPT_CALLEE_MONITOR))
if (ast_test_flag64(peerflags, OPT_CALLEE_MONITOR))
ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
if (ast_test_flag(peerflags, OPT_CALLER_MONITOR))
if (ast_test_flag64(peerflags, OPT_CALLER_MONITOR))
ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
if (ast_test_flag(peerflags, OPT_CALLEE_PARK))
if (ast_test_flag64(peerflags, OPT_CALLEE_PARK))
ast_set_flag(&(config.features_callee), AST_FEATURE_PARKCALL);
if (ast_test_flag(peerflags, OPT_CALLER_PARK))
if (ast_test_flag64(peerflags, OPT_CALLER_PARK))
ast_set_flag(&(config.features_caller), AST_FEATURE_PARKCALL);
if (moh) {
@@ -1794,14 +1794,14 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
if (ast_test_flag(&opts, OPT_PEER_H)) {
if (ast_test_flag64(&opts, OPT_PEER_H)) {
ast_log(LOG_NOTICE,"PEER context: %s; PEER exten: %s; PEER priority: %d\n",
peer->context, peer->exten, peer->priority);
}
strcpy(peer->context, chan->context);
if (ast_test_flag(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
strcpy(peer->exten, "h");
peer->priority = 1;
while (ast_exists_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num)) {
@@ -1835,7 +1835,7 @@ out:
senddialendevent(chan, pa.status);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
if ((ast_test_flag(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
if ((ast_test_flag64(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
if (calldurationlimit)
chan->whentohangup = 0;
res = 0;
@@ -1847,7 +1847,7 @@ done:
static int dial_exec(struct ast_channel *chan, void *data)
{
struct ast_flags peerflags;
struct ast_flags64 peerflags;
memset(&peerflags, 0, sizeof(peerflags));
@@ -1859,7 +1859,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
char *announce = NULL, *dialdata = NULL;
const char *context = NULL;
int sleep = 0, loops = 0, res = -1;
struct ast_flags peerflags;
struct ast_flags64 peerflags;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "RetryDial requires an argument!\n");
@@ -1915,7 +1915,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
break;
if (res == 0) {
if (ast_test_flag(&peerflags, OPT_DTMF_EXIT)) {
if (ast_test_flag64(&peerflags, OPT_DTMF_EXIT)) {
if (!ast_strlen_zero(announce)) {
if (ast_fileexists(announce, NULL, chan->language) > 0) {
if(!(res = ast_streamfile(chan, announce, chan->language)))
+2 -2
View File
@@ -364,7 +364,7 @@ struct minivm_account {
char attachfmt[80]; /*!< Format for voicemail audio file attachment */
char etemplate[80]; /*!< Pager template */
char ptemplate[80]; /*!< Voicemail format */
uint64_t flags; /*!< MVM_ flags */
unsigned int flags; /*!< MVM_ flags */
struct ast_variable *chanvars; /*!< Variables for e-mail template */
double volgain; /*!< Volume gain for voicemails sent via e-mail */
AST_LIST_ENTRY(minivm_account) list;
@@ -395,7 +395,7 @@ static AST_LIST_HEAD_STATIC(message_templates, minivm_template);
/*! \brief Options for leaving voicemail with the voicemail() application */
struct leave_vm_options {
uint64_t flags;
unsigned int flags;
signed char record_gain;
};
+2 -2
View File
@@ -97,7 +97,7 @@ struct mixmonitor {
char *filename;
char *post_process;
char *name;
uint64_t flags;
unsigned int flags;
};
enum {
@@ -226,7 +226,7 @@ static void *mixmonitor_thread(void *obj)
return NULL;
}
static void launch_monitor_thread(struct ast_channel *chan, const char *filename, uint64_t flags,
static void launch_monitor_thread(struct ast_channel *chan, const char *filename, unsigned int flags,
int readvol, int writevol, const char *post_process)
{
pthread_t thread;
+3 -3
View File
@@ -370,7 +370,7 @@ struct ast_vm_user {
char uniqueid[20]; /*!< Unique integer identifier */
char exit[80];
char attachfmt[20]; /*!< Attachment format */
uint64_t flags; /*!< VM_ flags */
unsigned int flags; /*!< VM_ flags */
int saydurationm;
int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */
int maxsecs; /*!< Maximum number of seconds per message for this mailbox */
@@ -2190,7 +2190,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
}
if (!strcmp(format, "wav49"))
format = "WAV";
ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %lld\n", attach, format, attach_user_voicemail, (unsigned long long)ast_test_flag((&globalflags), VM_ATTACH));
ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH));
/* Make a temporary file instead of piping directly to sendmail, in case the mail
command hangs */
if ((p = vm_mkftemp(tmp)) == NULL) {
@@ -2987,7 +2987,7 @@ static void run_externnotify(char *context, char *extension)
}
struct leave_vm_options {
uint64_t flags;
unsigned int flags;
signed char record_gain;
};
+4 -4
View File
@@ -315,7 +315,7 @@ struct iax2_user {
int encmethods;
int amaflags;
int adsi;
uint64_t flags;
unsigned int flags;
int capability;
int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
int curauthreq; /*!< Current number of outstanding AUTHREQs */
@@ -353,7 +353,7 @@ struct iax2_peer {
int sockfd; /*!< Socket to use for transmission */
struct in_addr mask;
int adsi;
uint64_t flags;
unsigned int flags;
/* Dynamic Registration fields */
struct sockaddr_in defaddr; /*!< Default address if there is one */
@@ -604,7 +604,7 @@ struct chan_iax2_pvt {
/*! Associated peer for poking */
struct iax2_peer *peerpoke;
/*! IAX_ flags */
uint64_t flags;
unsigned int flags;
int adsi;
/*! Transferring status */
@@ -2807,7 +2807,7 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
struct create_addr_info {
int capability;
uint64_t flags;
unsigned int flags;
int maxtime;
int encmethods;
int found;
+1 -1
View File
@@ -104,7 +104,7 @@ static const struct ast_channel_tech local_tech = {
struct local_pvt {
ast_mutex_t lock; /* Channel private lock */
uint64_t flags; /* Private flags */
unsigned int flags; /* Private flags */
char context[AST_MAX_CONTEXT]; /* Context to call */
char exten[AST_MAX_EXTENSION]; /* Extension to call */
int reqformat; /* Requested format */
+3 -3
View File
@@ -639,7 +639,7 @@ struct sip_request {
int headers; /*!< # of SIP Headers */
int method; /*!< Method of this request */
int lines; /*!< Body Content */
uint64_t flags; /*!< SIP_PKT Flags for this packet */
unsigned int flags; /*!< SIP_PKT Flags for this packet */
char *header[SIP_MAX_HEADERS];
char *line[SIP_MAX_LINES];
char data[SIP_MAX_PACKET];
@@ -1080,7 +1080,7 @@ struct sip_pkt {
int retrans; /*!< Retransmission number */
int method; /*!< SIP method for this packet */
int seqno; /*!< Sequence number */
uint64_t flags; /*!< non-zero if this is a response packet (e.g. 200 OK) */
unsigned int flags; /*!< non-zero if this is a response packet (e.g. 200 OK) */
struct sip_pvt *owner; /*!< Owner AST call */
int retransid; /*!< Retransmission ID */
int timer_a; /*!< SIP timer A, retransmission timer */
@@ -11584,7 +11584,7 @@ static int sip_show_channel(int fd, int argc, char *argv[])
ast_cli(fd, " Original uri: %s\n", cur->uri);
if (!ast_strlen_zero(cur->cid_num))
ast_cli(fd, " Caller-ID: %s\n", cur->cid_num);
ast_cli(fd, " Need Destroy: %lld\n", (unsigned long long)ast_test_flag(&cur->flags[0], SIP_NEEDDESTROY));
ast_cli(fd, " Need Destroy: %d\n", ast_test_flag(&cur->flags[0], SIP_NEEDDESTROY));
ast_cli(fd, " Last Message: %s\n", cur->lastmsg);
ast_cli(fd, " Promiscuous Redir: %s\n", ast_test_flag(&cur->flags[0], SIP_PROMISCREDIR) ? "Yes" : "No");
ast_cli(fd, " Route: %s\n", cur->route ? cur->route->hop : "N/A");
+3 -3
View File
@@ -69,7 +69,7 @@ struct iax_template {
unsigned int server;
unsigned short serverport;
unsigned int altserver;
uint64_t flags;
unsigned int flags;
unsigned int format;
unsigned int tos;
} *templates;
@@ -88,7 +88,7 @@ static struct iax_flag {
{ "disable3way", PROV_FLAG_DIS_THREEWAY },
};
char *iax_provflags2str(char *buf, int buflen, uint64_t flags)
char *iax_provflags2str(char *buf, int buflen, unsigned int flags)
{
int x;
@@ -117,7 +117,7 @@ static unsigned int iax_str2flags(const char *buf)
int x;
int len;
int found;
uint64_t flags = 0;
unsigned int flags = 0;
char *e;
while(buf && *buf) {
e = strchr(buf, ',');
+1 -1
View File
@@ -45,7 +45,7 @@
#define PROV_FLAG_DIS_CIDCW (1 << 6) /* CID/CW Disabled */
#define PROV_FLAG_DIS_THREEWAY (1 << 7) /* Three-way calling, transfer disabled */
char *iax_provflags2str(char *buf, int buflen, uint64_t flags);
char *iax_provflags2str(char *buf, int buflen, unsigned int flags);
int iax_provision_reload(void);
int iax_provision_unload(void);
int iax_provision_build(struct iax_ie_data *provdata, unsigned int *signature, const char *template, int force);
+1 -1
View File
@@ -67,7 +67,7 @@ struct acf_odbc_query {
char writehandle[5][30];
char sql_read[2048];
char sql_write[2048];
uint64_t flags;
unsigned int flags;
int rowlimit;
struct ast_custom_function *acf;
};
+2 -2
View File
@@ -55,7 +55,7 @@ enum {
struct ast_jb_conf
{
/*! \brief Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags. */
uint64_t flags;
unsigned int flags;
/*! \brief Max size of the jitterbuffer implementation. */
long max_size;
/*! \brief Resynchronization threshold of the jitterbuffer implementation. */
@@ -98,7 +98,7 @@ struct ast_jb
/*! \brief File for frame timestamp tracing. */
FILE *logfile;
/*! \brief Jitterbuffer internal state flags. */
uint64_t flags;
unsigned int flags;
};
+11
View File
@@ -425,6 +425,17 @@ struct ast_app_option {
*/
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr);
/*!
\brief Parses a string containing application options and sets flags/arguments.
\param options The array of possible options declared with AST_APP_OPTIONS
\param flags The 64-bit flag structure to have option flags set
\param args The array of argument pointers to hold arguments found
\param optstr The string containing the options to be parsed
\return zero for success, non-zero if an error occurs
\sa AST_APP_OPTIONS
*/
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr);
/*! \brief Present a dialtone and collect a certain length extension.
\return Returns 1 on valid extension entered, -1 on hangup, or 0 on invalid extension.
\note Note that if 'collect' holds digits already, new digits will be appended, so be sure it's initialized properly */
+1 -1
View File
@@ -83,7 +83,7 @@ struct ast_cdr {
/*! What account number to use */
char accountcode[AST_MAX_ACCOUNT_CODE];
/*! flags */
uint64_t flags;
unsigned int flags;
/*! Unique Channel Identifier */
char uniqueid[32];
/*! User field */
+2 -2
View File
@@ -468,7 +468,7 @@ struct ast_channel {
(see \ref AstChanVar ) */
ast_group_t callgroup; /*!< Call group for call pickups */
ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
uint64_t flags; /*!< channel flags of AST_FLAG_ type */
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
unsigned short transfercapability; /*!< ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */
AST_LIST_HEAD_NOLOCK(, ast_frame) readq;
int alertpipe[2];
@@ -567,7 +567,7 @@ struct ast_bridge_config {
const char *end_sound;
const char *start_sound;
int firstpass;
uint64_t flags;
unsigned int flags;
};
struct chanmon;
+1 -1
View File
@@ -61,7 +61,7 @@ struct ast_channel_spy {
struct ast_channel *chan;
struct ast_channel_spy_queue read_queue;
struct ast_channel_spy_queue write_queue;
uint64_t flags;
unsigned int flags;
enum chanspy_states status;
const char *type;
/* The volume adjustment values are very straightforward:
+1 -1
View File
@@ -192,7 +192,7 @@ struct dundi_peer_status {
#define DEFAULT_MAXMS 2000
struct dundi_result {
uint64_t flags;
unsigned int flags;
int weight;
int expiration;
int techint;
+1 -1
View File
@@ -39,7 +39,7 @@ struct ast_call_feature {
char exten[FEATURE_MAX_LEN];
char default_exten[FEATURE_MAX_LEN];
int (*operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense);
uint64_t flags;
unsigned int flags;
char app[FEATURE_APP_LEN];
char app_args[FEATURE_APP_ARGS_LEN];
char moh_class[FEATURE_MOH_LEN];
+2 -2
View File
@@ -102,7 +102,7 @@ struct aji_buddy {
char channel[160];
struct aji_resource *resources;
enum aji_btype btype;
uint64_t flags;
unsigned int flags;
};
struct aji_buddy_container {
@@ -137,7 +137,7 @@ struct aji_client {
int timeout;
int message_timeout;
int authorized;
uint64_t flags;
unsigned int flags;
int component; /* 0 client, 1 component */
struct aji_buddy_container buddies;
AST_LIST_HEAD(messages,aji_message) messages;
+1 -1
View File
@@ -215,7 +215,7 @@ struct ast_module_info {
*/
const char *key;
uint64_t flags;
unsigned int flags;
};
void ast_module_register(const struct ast_module_info *);
+1 -1
View File
@@ -51,7 +51,7 @@ struct ast_speech {
/*! Structure lock */
ast_mutex_t lock;
/*! Set flags */
uint64_t flags;
unsigned int flags;
/*! Processing sound (used when engine is processing audio and getting results) */
char *processing_sound;
/*! Current state of structure */
+66 -2
View File
@@ -50,7 +50,7 @@
your variable.
The flag macros below use a set of compiler tricks to verify
that the caller is using an "unsigned long long" variable to hold
that the caller is using an "unsigned int" variable to hold
the flags, and nothing else. If the caller uses any other
type of variable, a warning message similar to this:
@@ -64,7 +64,7 @@
\endverbatim
*/
extern uint64_t __unsigned_int_flags_dummy;
extern unsigned int __unsigned_int_flags_dummy;
#define ast_test_flag(p,flag) ({ \
typeof ((p)->flags) __p = (p)->flags; \
@@ -115,6 +115,64 @@ extern uint64_t __unsigned_int_flags_dummy;
(p)->flags |= (value); \
} while (0)
/* The following 64-bit flag code can most likely be erased after app_dial
is reorganized to either reduce the large number of options, or handle
them in some other way. At the time of this writing, app_dial would be
the only user of 64-bit option flags */
extern uint64_t __unsigned_int_flags_dummy64;
#define ast_test_flag64(p,flag) ({ \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
((p)->flags & (flag)); \
})
#define ast_set_flag64(p,flag) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
((p)->flags |= (flag)); \
} while(0)
#define ast_clear_flag64(p,flag) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
((p)->flags &= ~(flag)); \
} while(0)
#define ast_copy_flags64(dest,src,flagz) do { \
typeof ((dest)->flags) __d = (dest)->flags; \
typeof ((src)->flags) __s = (src)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__d == &__x); \
(void) (&__s == &__x); \
(dest)->flags &= ~(flagz); \
(dest)->flags |= ((src)->flags & (flagz)); \
} while (0)
#define ast_set2_flag64(p,value,flag) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
if (value) \
(p)->flags |= (flag); \
else \
(p)->flags &= ~(flag); \
} while (0)
#define ast_set_flags_to64(p,flag,value) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
(p)->flags &= ~(flag); \
(p)->flags |= (value); \
} while (0)
/* Non-type checking variations for non-unsigned int flags. You
should only use non-unsigned int flags where required by
protocol etc and if you know what you're doing :) */
@@ -146,6 +204,12 @@ extern uint64_t __unsigned_int_flags_dummy;
/*! \brief Structure used to handle boolean flags
*/
struct ast_flags {
unsigned int flags;
};
/*! \brief Structure used to handle a large number of boolean flags == used only in app_dial?
*/
struct ast_flags64 {
uint64_t flags;
};
+40
View File
@@ -1457,3 +1457,43 @@ int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags
return res;
}
/* the following function will probably only be used in app_dial, until app_dial is reorganized to
better handle the large number of options it provides. After it is, you need to get rid of this variant
-- unless, of course, someone else digs up some use for large flag fields. */
int ast_app_parse_options64(const struct ast_app_option *options, struct ast_flags64 *flags, char **args, char *optstr)
{
char *s, *arg;
int curarg, res = 0;
unsigned int argloc;
flags->flags = 0;
if (!optstr)
return 0;
s = optstr;
while (*s) {
curarg = *s++ & 0x7f; /* the array (in app.h) has 128 entries */
ast_set_flag64(flags, options[curarg].flag);
argloc = options[curarg].arg_index;
if (*s == '(') {
/* Has argument */
arg = ++s;
if ((s = strchr(s, ')'))) {
if (argloc)
args[argloc - 1] = arg;
*s++ = '\0';
} else {
ast_log(LOG_WARNING, "Missing closing parenthesis for argument '%c' in string '%s'\n", curarg, arg);
res = -1;
break;
}
} else if (argloc) {
args[argloc - 1] = NULL;
}
}
return res;
}
+1 -1
View File
@@ -2454,7 +2454,7 @@ done:
int ast_internal_timing_enabled(struct ast_channel *chan)
{
int ret = ast_opt_internal_timing && chan->timingfd > -1;
ast_debug(5, "Internal timing is %s (option_internal_timing=%lld chan->timingfd=%d)\n", ret? "enabled": "disabled", (unsigned long long)ast_opt_internal_timing, chan->timingfd);
ast_debug(5, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
return ret;
}
+2 -2
View File
@@ -86,8 +86,8 @@ struct ast_module {
int usecount; /* the number of 'users' currently in this module */
struct module_user_list users; /* the list of users in the module */
struct {
uint64_t running:1;
uint64_t declined:1;
unsigned int running:1;
unsigned int declined:1;
} flags;
AST_LIST_ENTRY(ast_module) entry;
char resource[0];
+3 -3
View File
@@ -152,7 +152,7 @@ struct ast_rtp {
int send_payload;
int send_duration;
int nat;
uint64_t flags;
unsigned int flags;
struct sockaddr_in us; /*!< Socket representation of the local endpoint. */
struct sockaddr_in them; /*!< Socket representation of the remote endpoint. */
struct timeval rxcore;
@@ -845,7 +845,7 @@ static struct ast_frame *process_cisco_dtmf(struct ast_rtp *rtp, unsigned char *
char resp = 0;
struct ast_frame *f = NULL;
unsigned char seq;
uint64_t flags;
unsigned int flags;
unsigned int power;
/* We should have at least 4 bytes in RTP data */
@@ -888,7 +888,7 @@ static struct ast_frame *process_cisco_dtmf(struct ast_rtp *rtp, unsigned char *
event = data[3] & 0x1f;
if (option_debug > 2 || rtpdebug)
ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02llx, power=%d, history count=%d)\n", event, len, seq, (unsigned long long)flags, power, (len - 4) / 2);
ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
if (event < 10) {
resp = '0' + event;
} else if (event < 11) {
+4 -4
View File
@@ -179,7 +179,7 @@ struct dundi_transaction {
dundi_eid them_eid; /*!< Their EID, to us */
ast_aes_encrypt_key ecx; /*!< AES 128 Encryption context */
ast_aes_decrypt_key dcx; /*!< AES 128 Decryption context */
uint64_t flags; /*!< Has final packet been sent */
unsigned int flags; /*!< Has final packet been sent */
int ttl; /*!< Remaining TTL for queries on this one */
int thread; /*!< We have a calling thread */
int retranstimer; /*!< How long to wait before retransmissions */
@@ -892,8 +892,8 @@ static int cache_save(dundi_eid *eidpeer, struct dundi_request *req, int start,
/* Skip anything with an illegal pipe in it */
if (strchr(req->dr[x].dest, '|'))
continue;
snprintf(data + strlen(data), sizeof(data) - strlen(data), "%lld/%d/%d/%s/%s|",
(unsigned long long)req->dr[x].flags, req->dr[x].weight, req->dr[x].techint, req->dr[x].dest,
snprintf(data + strlen(data), sizeof(data) - strlen(data), "%d/%d/%d/%s/%s|",
req->dr[x].flags, req->dr[x].weight, req->dr[x].techint, req->dr[x].dest,
dundi_eid_to_str_short(eidpeer_str, sizeof(eidpeer_str), &req->dr[x].eid));
}
ast_db_put("dundi/cache", key1, data);
@@ -1154,7 +1154,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
if (option_debug)
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", expiration);
ptr += length + 1;
while((sscanf(ptr, "%lld/%d/%d/%n", (unsigned long long*)&(flags.flags), &weight, &tech, &length) == 3)) {
while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
ptr += length;
term = strchr(ptr, '|');
if (term) {
+1 -1
View File
@@ -1318,7 +1318,7 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL);
else
ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL);
ast_debug(3, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%lld\n", chan->name, peer->name, sense, (unsigned long long)features.flags);
ast_debug(3, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d\n", chan->name, peer->name, sense, features.flags);
ast_rwlock_rdlock(&features_lock);
for (x = 0; x < FEATURES_COUNT; x++) {
+1 -1
View File
@@ -138,7 +138,7 @@ struct mohclass {
int allowed_files;
/*! The current number of files loaded into the filearray */
int total_files;
uint64_t flags;
unsigned int flags;
/*! The format from the MOH source, not applicable to "files" mode */
int format;
/*! The pid of the external application delivering MOH */