mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
More flagification, courtesy drumkilla (bug #3280)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4748 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
4
app.c
4
app.c
@@ -390,7 +390,7 @@ int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, in
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char *rev, char *stop, char *pause, int skipms)
|
int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, int skipms)
|
||||||
{
|
{
|
||||||
struct timeval started, ended;
|
struct timeval started, ended;
|
||||||
long elapsed = 0,last_elapsed =0;
|
long elapsed = 0,last_elapsed =0;
|
||||||
@@ -483,7 +483,7 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_play_and_wait(struct ast_channel *chan, char *fn)
|
int ast_play_and_wait(struct ast_channel *chan, const char *fn)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
d = ast_streamfile(chan, fn, chan->language);
|
d = ast_streamfile(chan, fn, chan->language);
|
||||||
|
@@ -1085,21 +1085,21 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
memset(&config,0,sizeof(struct ast_bridge_config));
|
memset(&config,0,sizeof(struct ast_bridge_config));
|
||||||
if (play_to_caller)
|
if (play_to_caller)
|
||||||
config.features_caller |= AST_FEATURE_PLAY_WARNING;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);
|
||||||
if (play_to_callee)
|
if (play_to_callee)
|
||||||
config.features_callee |= AST_FEATURE_PLAY_WARNING;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_PLAY_WARNING);
|
||||||
if (ast_test_flag(&peerflags, DIAL_ALLOWREDIRECT_IN))
|
if (ast_test_flag(&peerflags, DIAL_ALLOWREDIRECT_IN))
|
||||||
config.features_callee |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
|
||||||
if (ast_test_flag(&peerflags, DIAL_ALLOWREDIRECT_OUT))
|
if (ast_test_flag(&peerflags, DIAL_ALLOWREDIRECT_OUT))
|
||||||
config.features_caller |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
|
||||||
if (ast_test_flag(&peerflags, DIAL_ALLOWDISCONNECT_IN))
|
if (ast_test_flag(&peerflags, DIAL_ALLOWDISCONNECT_IN))
|
||||||
config.features_callee |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
|
||||||
if (ast_test_flag(&peerflags, DIAL_ALLOWDISCONNECT_OUT))
|
if (ast_test_flag(&peerflags, DIAL_ALLOWDISCONNECT_OUT))
|
||||||
config.features_caller |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_DISCONNECT);
|
||||||
if (ast_test_flag(&peerflags, DIAL_MONITOR_IN))
|
if (ast_test_flag(&peerflags, DIAL_MONITOR_IN))
|
||||||
config.features_callee |= AST_FEATURE_AUTOMON;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
|
||||||
if (ast_test_flag(&peerflags, DIAL_MONITOR_OUT))
|
if (ast_test_flag(&peerflags, DIAL_MONITOR_OUT))
|
||||||
config.features_caller |= AST_FEATURE_AUTOMON;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
|
||||||
config.timelimit = timelimit;
|
config.timelimit = timelimit;
|
||||||
config.play_warning = play_warning;
|
config.play_warning = play_warning;
|
||||||
config.warning_freq = warning_freq;
|
config.warning_freq = warning_freq;
|
||||||
|
@@ -41,7 +41,7 @@ static void ast_cdr_clone(struct ast_cdr *cdr) {
|
|||||||
gettimeofday(&newcdr->start, NULL);
|
gettimeofday(&newcdr->start, NULL);
|
||||||
memset(&newcdr->answer, 0, sizeof(newcdr->answer));
|
memset(&newcdr->answer, 0, sizeof(newcdr->answer));
|
||||||
newcdr->disposition = AST_CDR_NOANSWER;
|
newcdr->disposition = AST_CDR_NOANSWER;
|
||||||
ast_cdr_add_flag(cdr,AST_CDR_FLAG_CHILD|AST_CDR_FLAG_LOCKED);
|
ast_set_flag(cdr, AST_CDR_FLAG_CHILD|AST_CDR_FLAG_LOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ast_cdr_fork(struct ast_channel *chan) {
|
static void ast_cdr_fork(struct ast_channel *chan) {
|
||||||
|
@@ -1543,13 +1543,13 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri
|
|||||||
|
|
||||||
memset(&config,0,sizeof(struct ast_bridge_config));
|
memset(&config,0,sizeof(struct ast_bridge_config));
|
||||||
if (ast_test_flag(&flags, QUEUE_FLAG_REDIR_IN))
|
if (ast_test_flag(&flags, QUEUE_FLAG_REDIR_IN))
|
||||||
config.features_callee |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
|
||||||
if (ast_test_flag(&flags, QUEUE_FLAG_REDIR_OUT))
|
if (ast_test_flag(&flags, QUEUE_FLAG_REDIR_OUT))
|
||||||
config.features_caller |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
|
||||||
if (ast_test_flag(&flags, QUEUE_FLAG_DISCON_IN))
|
if (ast_test_flag(&flags, QUEUE_FLAG_DISCON_IN))
|
||||||
config.features_callee |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_DISCONNECT);
|
||||||
if (ast_test_flag(&flags, QUEUE_FLAG_DISCON_OUT))
|
if (ast_test_flag(&flags, QUEUE_FLAG_DISCON_OUT))
|
||||||
config.features_caller |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_DISCONNECT);
|
||||||
bridge = ast_bridge_call(qe->chan,peer,&config);
|
bridge = ast_bridge_call(qe->chan,peer,&config);
|
||||||
|
|
||||||
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
|
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
|
||||||
|
49
cdr.c
49
cdr.c
@@ -110,7 +110,7 @@ void ast_cdr_free(struct ast_cdr *cdr)
|
|||||||
while (cdr) {
|
while (cdr) {
|
||||||
next = cdr->next;
|
next = cdr->next;
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (!ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' not posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' not posted\n", chan);
|
||||||
if (!cdr->end.tv_sec && !cdr->end.tv_usec)
|
if (!cdr->end.tv_sec && !cdr->end.tv_usec)
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
|
||||||
@@ -135,9 +135,9 @@ void ast_cdr_start(struct ast_cdr *cdr)
|
|||||||
{
|
{
|
||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if (!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (cdr->start.tv_sec || cdr->start.tv_usec)
|
if (cdr->start.tv_sec || cdr->start.tv_usec)
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already started\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already started\n", chan);
|
||||||
@@ -152,7 +152,7 @@ void ast_cdr_answer(struct ast_cdr *cdr)
|
|||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (cdr->disposition < AST_CDR_ANSWERED)
|
if (cdr->disposition < AST_CDR_ANSWERED)
|
||||||
cdr->disposition = AST_CDR_ANSWERED;
|
cdr->disposition = AST_CDR_ANSWERED;
|
||||||
@@ -167,9 +167,9 @@ void ast_cdr_busy(struct ast_cdr *cdr)
|
|||||||
{
|
{
|
||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if (!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (cdr->disposition < AST_CDR_BUSY)
|
if (cdr->disposition < AST_CDR_BUSY)
|
||||||
cdr->disposition = AST_CDR_BUSY;
|
cdr->disposition = AST_CDR_BUSY;
|
||||||
@@ -183,9 +183,9 @@ void ast_cdr_failed(struct ast_cdr *cdr)
|
|||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED))
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||||
cdr->disposition = AST_CDR_FAILED;
|
cdr->disposition = AST_CDR_FAILED;
|
||||||
cdr = cdr->next;
|
cdr = cdr->next;
|
||||||
}
|
}
|
||||||
@@ -221,9 +221,9 @@ void ast_cdr_setdestchan(struct ast_cdr *cdr, char *chann)
|
|||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED))
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||||
strncpy(cdr->dstchannel, chann, sizeof(cdr->dstchannel) - 1);
|
strncpy(cdr->dstchannel, chann, sizeof(cdr->dstchannel) - 1);
|
||||||
cdr = cdr->next;
|
cdr = cdr->next;
|
||||||
}
|
}
|
||||||
@@ -233,9 +233,9 @@ void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
|
|||||||
{
|
{
|
||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (!app)
|
if (!app)
|
||||||
app = "";
|
app = "";
|
||||||
@@ -253,7 +253,7 @@ int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
|
|||||||
char tmp[AST_MAX_EXTENSION] = "";
|
char tmp[AST_MAX_EXTENSION] = "";
|
||||||
char *num;
|
char *num;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
/* Grab source from ANI or normal Caller*ID */
|
/* Grab source from ANI or normal Caller*ID */
|
||||||
if (c->cid.cid_ani)
|
if (c->cid.cid_ani)
|
||||||
num = c->cid.cid_ani;
|
num = c->cid.cid_ani;
|
||||||
@@ -285,7 +285,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
|
|||||||
char *num;
|
char *num;
|
||||||
char tmp[AST_MAX_EXTENSION] = "";
|
char tmp[AST_MAX_EXTENSION] = "";
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (!ast_strlen_zero(cdr->channel))
|
if (!ast_strlen_zero(cdr->channel))
|
||||||
ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan);
|
ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan);
|
||||||
@@ -335,7 +335,7 @@ void ast_cdr_end(struct ast_cdr *cdr)
|
|||||||
char *chan;
|
char *chan;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (!cdr->start.tv_sec && !cdr->start.tv_usec)
|
if (!cdr->start.tv_sec && !cdr->start.tv_usec)
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", chan);
|
||||||
@@ -380,7 +380,7 @@ int ast_cdr_setaccount(struct ast_channel *chan, const char *account)
|
|||||||
|
|
||||||
strncpy(chan->accountcode, account, sizeof(chan->accountcode) - 1);
|
strncpy(chan->accountcode, account, sizeof(chan->accountcode) - 1);
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED))
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||||
strncpy(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode) - 1);
|
strncpy(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode) - 1);
|
||||||
cdr = cdr->next;
|
cdr = cdr->next;
|
||||||
}
|
}
|
||||||
@@ -404,7 +404,7 @@ int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield)
|
|||||||
struct ast_cdr *cdr = chan->cdr;
|
struct ast_cdr *cdr = chan->cdr;
|
||||||
|
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED))
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||||
strncpy(cdr->userfield, userfield, sizeof(cdr->userfield) - 1);
|
strncpy(cdr->userfield, userfield, sizeof(cdr->userfield) - 1);
|
||||||
cdr = cdr->next;
|
cdr = cdr->next;
|
||||||
}
|
}
|
||||||
@@ -419,7 +419,7 @@ int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield)
|
|||||||
{
|
{
|
||||||
|
|
||||||
int len = strlen(cdr->userfield);
|
int len = strlen(cdr->userfield);
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED))
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
|
||||||
strncpy(cdr->userfield+len, userfield, sizeof(cdr->userfield) - len - 1);
|
strncpy(cdr->userfield+len, userfield, sizeof(cdr->userfield) - len - 1);
|
||||||
cdr = cdr->next;
|
cdr = cdr->next;
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ int ast_cdr_update(struct ast_channel *c)
|
|||||||
char tmp[AST_MAX_EXTENSION] = "";
|
char tmp[AST_MAX_EXTENSION] = "";
|
||||||
/* Grab source from ANI or normal Caller*ID */
|
/* Grab source from ANI or normal Caller*ID */
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
if(!ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if(!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
/* Grab source from ANI or normal Caller*ID */
|
/* Grab source from ANI or normal Caller*ID */
|
||||||
if (c->cid.cid_ani)
|
if (c->cid.cid_ani)
|
||||||
num = c->cid.cid_ani;
|
num = c->cid.cid_ani;
|
||||||
@@ -491,7 +491,7 @@ void ast_cdr_post(struct ast_cdr *cdr)
|
|||||||
struct ast_cdr_beitem *i;
|
struct ast_cdr_beitem *i;
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
|
||||||
if (ast_cdr_has_flag(cdr,AST_CDR_FLAG_POSTED))
|
if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
|
||||||
if (!cdr->end.tv_sec && !cdr->end.tv_usec)
|
if (!cdr->end.tv_sec && !cdr->end.tv_usec)
|
||||||
ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
|
ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
|
||||||
@@ -502,7 +502,7 @@ void ast_cdr_post(struct ast_cdr *cdr)
|
|||||||
cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec + (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;
|
cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec + (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;
|
||||||
} else
|
} else
|
||||||
cdr->billsec = 0;
|
cdr->billsec = 0;
|
||||||
ast_cdr_add_flag(cdr,AST_CDR_FLAG_POSTED);
|
ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
|
||||||
ast_mutex_lock(&cdrlock);
|
ast_mutex_lock(&cdrlock);
|
||||||
i = bes;
|
i = bes;
|
||||||
while(i) {
|
while(i) {
|
||||||
@@ -516,15 +516,16 @@ void ast_cdr_post(struct ast_cdr *cdr)
|
|||||||
|
|
||||||
void ast_cdr_reset(struct ast_cdr *cdr, int flags)
|
void ast_cdr_reset(struct ast_cdr *cdr, int flags)
|
||||||
{
|
{
|
||||||
|
struct ast_flags tmp = {flags};
|
||||||
while (cdr) {
|
while (cdr) {
|
||||||
/* Post if requested */
|
/* Post if requested */
|
||||||
if (ast_cdr_compare_flag(flags,AST_CDR_FLAG_LOCKED) || !ast_cdr_has_flag(cdr,AST_CDR_FLAG_LOCKED)) {
|
if (ast_test_flag(&tmp, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
|
||||||
if (ast_cdr_compare_flag(flags,AST_CDR_FLAG_POSTED)) {
|
if (ast_test_flag(&tmp, AST_CDR_FLAG_POSTED)) {
|
||||||
ast_cdr_end(cdr);
|
ast_cdr_end(cdr);
|
||||||
ast_cdr_post(cdr);
|
ast_cdr_post(cdr);
|
||||||
}
|
}
|
||||||
/* Reset to initial state */
|
/* Reset to initial state */
|
||||||
cdr->flags=0;
|
ast_clear_flag(cdr, AST_FLAGS_ALL);
|
||||||
memset(&cdr->start, 0, sizeof(cdr->start));
|
memset(&cdr->start, 0, sizeof(cdr->start));
|
||||||
memset(&cdr->end, 0, sizeof(cdr->end));
|
memset(&cdr->end, 0, sizeof(cdr->end));
|
||||||
memset(&cdr->answer, 0, sizeof(cdr->answer));
|
memset(&cdr->answer, 0, sizeof(cdr->answer));
|
||||||
|
14
channel.c
14
channel.c
@@ -2675,9 +2675,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
|
|||||||
gettimeofday(&start_time,NULL);
|
gettimeofday(&start_time,NULL);
|
||||||
time_left_ms = config->timelimit;
|
time_left_ms = config->timelimit;
|
||||||
|
|
||||||
if ((config->features_caller & AST_FEATURE_PLAY_WARNING) && config->start_sound && firstpass)
|
if ((ast_test_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING)) && config->start_sound && firstpass)
|
||||||
bridge_playfile(c0,c1,config->start_sound,time_left_ms / 1000);
|
bridge_playfile(c0,c1,config->start_sound,time_left_ms / 1000);
|
||||||
if ((config->features_callee & AST_FEATURE_PLAY_WARNING) && config->start_sound && firstpass)
|
if ((ast_test_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING)) && config->start_sound && firstpass)
|
||||||
bridge_playfile(c1,c0,config->start_sound,time_left_ms / 1000);
|
bridge_playfile(c1,c0,config->start_sound,time_left_ms / 1000);
|
||||||
|
|
||||||
/* Stop if we're a zombie or need a soft hangup */
|
/* Stop if we're a zombie or need a soft hangup */
|
||||||
@@ -2715,7 +2715,7 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
|
|||||||
elapsed_ms = tvdiff(&precise_now,&start_time);
|
elapsed_ms = tvdiff(&precise_now,&start_time);
|
||||||
time_left_ms = config->timelimit - elapsed_ms;
|
time_left_ms = config->timelimit - elapsed_ms;
|
||||||
|
|
||||||
if (playitagain && ((config->features_caller & AST_FEATURE_PLAY_WARNING) || (config->features_callee & AST_FEATURE_PLAY_WARNING)) && (config->play_warning && time_left_ms <= config->play_warning)) {
|
if (playitagain && ((ast_test_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING)) || (ast_test_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING))) && (config->play_warning && time_left_ms <= config->play_warning)) {
|
||||||
/* narrowing down to the end */
|
/* narrowing down to the end */
|
||||||
if (config->warning_freq == 0) {
|
if (config->warning_freq == 0) {
|
||||||
playit = 1;
|
playit = 1;
|
||||||
@@ -2731,9 +2731,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (time_left_ms <= 0) {
|
if (time_left_ms <= 0) {
|
||||||
if ((config->features_caller & AST_FEATURE_PLAY_WARNING) && config->end_sound)
|
if ((ast_test_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING)) && config->end_sound)
|
||||||
bridge_playfile(c0,c1,config->end_sound,0);
|
bridge_playfile(c0,c1,config->end_sound,0);
|
||||||
if ((config->features_callee & AST_FEATURE_PLAY_WARNING) && config->end_sound)
|
if ((ast_test_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING)) && config->end_sound)
|
||||||
bridge_playfile(c1,c0,config->end_sound,0);
|
bridge_playfile(c1,c0,config->end_sound,0);
|
||||||
*fo = NULL;
|
*fo = NULL;
|
||||||
if (who) *rc = who;
|
if (who) *rc = who;
|
||||||
@@ -2741,9 +2741,9 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, struct as
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (time_left_ms >= 5000 && playit) {
|
if (time_left_ms >= 5000 && playit) {
|
||||||
if ((config->features_caller & AST_FEATURE_PLAY_WARNING) && config->warning_sound && config->play_warning)
|
if ((ast_test_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING)) && config->warning_sound && config->play_warning)
|
||||||
bridge_playfile(c0,c1,config->warning_sound,time_left_ms / 1000);
|
bridge_playfile(c0,c1,config->warning_sound,time_left_ms / 1000);
|
||||||
if ((config->features_callee & AST_FEATURE_PLAY_WARNING) && config->warning_sound && config->play_warning)
|
if ((ast_test_flag(&(config->features_callee), AST_FEATURE_PLAY_WARNING)) && config->warning_sound && config->play_warning)
|
||||||
bridge_playfile(c1,c0,config->warning_sound,time_left_ms / 1000);
|
bridge_playfile(c1,c0,config->warning_sound,time_left_ms / 1000);
|
||||||
playit = 0;
|
playit = 0;
|
||||||
}
|
}
|
||||||
|
@@ -60,10 +60,10 @@ int ast_dtmf_stream(struct ast_channel *chan, struct ast_channel *peer, char *di
|
|||||||
int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride);
|
int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, int allowoverride);
|
||||||
|
|
||||||
//! Stream a file with fast forward, pause, reverse.
|
//! Stream a file with fast forward, pause, reverse.
|
||||||
int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char *rev, char *stop, char *pause, int skipms);
|
int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, int skipms);
|
||||||
|
|
||||||
//! Play a stream and wait for a digit, returning the digit that was pressed
|
//! Play a stream and wait for a digit, returning the digit that was pressed
|
||||||
int ast_play_and_wait(struct ast_channel *chan, char *fn);
|
int ast_play_and_wait(struct ast_channel *chan, const char *fn);
|
||||||
|
|
||||||
//! Record a file for a max amount of time (in seconds), in a given list of formats separated by '|', outputting the duration of the recording, and with a maximum
|
//! Record a file for a max amount of time (in seconds), in a given list of formats separated by '|', outputting the duration of the recording, and with a maximum
|
||||||
// permitted silence time in milliseconds of 'maxsilence' under 'silencethreshold' or use '-1' for either or both parameters for defaults.
|
// permitted silence time in milliseconds of 'maxsilence' under 'silencethreshold' or use '-1' for either or both parameters for defaults.
|
||||||
|
@@ -73,7 +73,7 @@ struct ast_cdr {
|
|||||||
/*! What account number to use */
|
/*! What account number to use */
|
||||||
char accountcode[20];
|
char accountcode[20];
|
||||||
/*! flags */
|
/*! flags */
|
||||||
int flags;
|
unsigned int flags;
|
||||||
/* Unique Channel Identifier */
|
/* Unique Channel Identifier */
|
||||||
char uniqueid[32];
|
char uniqueid[32];
|
||||||
/* User field */
|
/* User field */
|
||||||
@@ -249,11 +249,6 @@ extern int ast_default_amaflags;
|
|||||||
|
|
||||||
extern char ast_default_accountcode[20];
|
extern char ast_default_accountcode[20];
|
||||||
|
|
||||||
#define ast_cdr_compare_flag(flags, flag) (flags & (flag))
|
|
||||||
#define ast_cdr_has_flag(cdr, flag) ((cdr)->flags & (flag))
|
|
||||||
#define ast_cdr_add_flag(cdr, flag) ((cdr)->flags |= (flag))
|
|
||||||
#define ast_cdr_del_flag(cdr, flag) ((cdr)->flags &= ~(flag))
|
|
||||||
|
|
||||||
extern struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
|
extern struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr);
|
||||||
|
|
||||||
#endif /* _CDR_H */
|
#endif /* _CDR_H */
|
||||||
|
@@ -36,6 +36,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include <asterisk/cdr.h>
|
#include <asterisk/cdr.h>
|
||||||
#include <asterisk/monitor.h>
|
#include <asterisk/monitor.h>
|
||||||
|
#include <asterisk/utils.h>
|
||||||
|
|
||||||
|
|
||||||
#define AST_CHANNEL_NAME 80
|
#define AST_CHANNEL_NAME 80
|
||||||
@@ -238,8 +239,8 @@ struct ast_channel {
|
|||||||
#define AST_FEATURE_FLAG_NEEDSDTMF (1 << 0)
|
#define AST_FEATURE_FLAG_NEEDSDTMF (1 << 0)
|
||||||
|
|
||||||
struct ast_bridge_config {
|
struct ast_bridge_config {
|
||||||
unsigned int features_caller;
|
struct ast_flags features_caller;
|
||||||
unsigned int features_callee;
|
struct ast_flags features_callee;
|
||||||
long timelimit;
|
long timelimit;
|
||||||
long play_warning;
|
long play_warning;
|
||||||
long warning_freq;
|
long warning_freq;
|
||||||
|
@@ -179,7 +179,7 @@ struct dundi_peer_status {
|
|||||||
#define DEFAULT_MAXMS 2000
|
#define DEFAULT_MAXMS 2000
|
||||||
|
|
||||||
struct dundi_result {
|
struct dundi_result {
|
||||||
int flags;
|
unsigned int flags;
|
||||||
int weight;
|
int weight;
|
||||||
int expiration;
|
int expiration;
|
||||||
int techint;
|
int techint;
|
||||||
|
@@ -82,6 +82,33 @@ extern unsigned int __unsigned_int_flags_dummy;
|
|||||||
(p)->flags &= ~(flag); \
|
(p)->flags &= ~(flag); \
|
||||||
} while (0)
|
} 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 :) */
|
||||||
|
#define ast_test_flag_nonstd(p,flag) ({ \
|
||||||
|
((p)->flags & (flag)); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define ast_set_flag_nonstd(p,flag) do { \
|
||||||
|
((p)->flags |= (flag)); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define ast_clear_flag_nonstd(p,flag) do { \
|
||||||
|
((p)->flags &= ~(flag)); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define ast_copy_flags_nonstd(dest,src,flagz) do { \
|
||||||
|
(dest)->flags &= ~(flagz); \
|
||||||
|
(dest)->flags |= ((src)->flags & (flagz)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define ast_set2_flag_nonstd(p,value,flag) do { \
|
||||||
|
if (value) \
|
||||||
|
(p)->flags |= (flag); \
|
||||||
|
else \
|
||||||
|
(p)->flags &= ~(flag); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define AST_FLAGS_ALL UINT_MAX
|
#define AST_FLAGS_ALL UINT_MAX
|
||||||
|
|
||||||
struct ast_flags {
|
struct ast_flags {
|
||||||
|
131
pbx/pbx_dundi.c
131
pbx/pbx_dundi.c
@@ -164,7 +164,7 @@ struct dundi_transaction {
|
|||||||
dundi_eid them_eid; /* Their EID, to us */
|
dundi_eid them_eid; /* Their EID, to us */
|
||||||
aes_encrypt_ctx ecx; /* AES 128 Encryption context */
|
aes_encrypt_ctx ecx; /* AES 128 Encryption context */
|
||||||
aes_decrypt_ctx dcx; /* AES 128 Decryption context */
|
aes_decrypt_ctx dcx; /* AES 128 Decryption context */
|
||||||
int flags; /* Has final packet been sent */
|
unsigned int flags; /* Has final packet been sent */
|
||||||
int ttl; /* Remaining TTL for queries on this one */
|
int ttl; /* Remaining TTL for queries on this one */
|
||||||
int thread; /* We have a calling thread */
|
int thread; /* We have a calling thread */
|
||||||
int retranstimer; /* How long to wait before retransmissions */
|
int retranstimer; /* How long to wait before retransmissions */
|
||||||
@@ -461,7 +461,7 @@ static int reset_transaction(struct dundi_transaction *trans)
|
|||||||
trans->oiseqno = 0;
|
trans->oiseqno = 0;
|
||||||
trans->oseqno = 0;
|
trans->oseqno = 0;
|
||||||
trans->aseqno = 0;
|
trans->aseqno = 0;
|
||||||
trans->flags &= ~FLAG_FINAL;
|
ast_clear_flag(trans, FLAG_FINAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,39 +507,38 @@ struct dundi_query_state {
|
|||||||
|
|
||||||
static int dundi_lookup_local(struct dundi_result *dr, struct dundi_mapping *map, char *called_number, dundi_eid *us_eid, int anscnt, struct dundi_hint_metadata *hmd)
|
static int dundi_lookup_local(struct dundi_result *dr, struct dundi_mapping *map, char *called_number, dundi_eid *us_eid, int anscnt, struct dundi_hint_metadata *hmd)
|
||||||
{
|
{
|
||||||
int flags;
|
struct ast_flags flags = {0};
|
||||||
int x;
|
int x;
|
||||||
if (!ast_strlen_zero(map->lcontext)) {
|
if (!ast_strlen_zero(map->lcontext)) {
|
||||||
flags = 0;
|
|
||||||
if (ast_exists_extension(NULL, map->lcontext, called_number, 1, NULL))
|
if (ast_exists_extension(NULL, map->lcontext, called_number, 1, NULL))
|
||||||
flags |= DUNDI_FLAG_EXISTS;
|
ast_set_flag(&flags, DUNDI_FLAG_EXISTS);
|
||||||
if (ast_canmatch_extension(NULL, map->lcontext, called_number, 1, NULL))
|
if (ast_canmatch_extension(NULL, map->lcontext, called_number, 1, NULL))
|
||||||
flags |= DUNDI_FLAG_CANMATCH;
|
ast_set_flag(&flags, DUNDI_FLAG_CANMATCH);
|
||||||
if (ast_matchmore_extension(NULL, map->lcontext, called_number, 1, NULL))
|
if (ast_matchmore_extension(NULL, map->lcontext, called_number, 1, NULL))
|
||||||
flags |= DUNDI_FLAG_MATCHMORE;
|
ast_set_flag(&flags, DUNDI_FLAG_MATCHMORE);
|
||||||
if (ast_ignore_pattern(map->lcontext, called_number))
|
if (ast_ignore_pattern(map->lcontext, called_number))
|
||||||
flags |= DUNDI_FLAG_IGNOREPAT;
|
ast_set_flag(&flags, DUNDI_FLAG_IGNOREPAT);
|
||||||
|
|
||||||
/* Clearly we can't say 'don't ask' anymore if we found anything... */
|
/* Clearly we can't say 'don't ask' anymore if we found anything... */
|
||||||
if (flags)
|
if (ast_test_flag(&flags, AST_FLAGS_ALL))
|
||||||
hmd->flags &= ~DUNDI_HINT_DONT_ASK;
|
ast_clear_flag_nonstd(hmd, DUNDI_HINT_DONT_ASK);
|
||||||
|
|
||||||
if (map->options & DUNDI_FLAG_INTERNAL_NOPARTIAL) {
|
if (map->options & DUNDI_FLAG_INTERNAL_NOPARTIAL) {
|
||||||
/* Skip partial answers */
|
/* Skip partial answers */
|
||||||
flags &= ~(DUNDI_FLAG_MATCHMORE|DUNDI_FLAG_CANMATCH);
|
ast_clear_flag(&flags, DUNDI_FLAG_MATCHMORE|DUNDI_FLAG_CANMATCH);
|
||||||
}
|
}
|
||||||
if (flags) {
|
if (ast_test_flag(&flags, AST_FLAGS_ALL)) {
|
||||||
struct varshead headp;
|
struct varshead headp;
|
||||||
struct ast_var_t *newvariable;
|
struct ast_var_t *newvariable;
|
||||||
flags |= map->options & 0xffff;
|
ast_set_flag(&flags, map->options & 0xffff);
|
||||||
dr[anscnt].flags = flags;
|
ast_copy_flags(dr + anscnt, &flags, AST_FLAGS_ALL);
|
||||||
dr[anscnt].techint = map->tech;
|
dr[anscnt].techint = map->tech;
|
||||||
dr[anscnt].weight = map->weight;
|
dr[anscnt].weight = map->weight;
|
||||||
dr[anscnt].expiration = DUNDI_DEFAULT_CACHE_TIME;
|
dr[anscnt].expiration = DUNDI_DEFAULT_CACHE_TIME;
|
||||||
strncpy(dr[anscnt].tech, tech2str(map->tech), sizeof(dr[anscnt].tech));
|
strncpy(dr[anscnt].tech, tech2str(map->tech), sizeof(dr[anscnt].tech));
|
||||||
dr[anscnt].eid = *us_eid;
|
dr[anscnt].eid = *us_eid;
|
||||||
dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
|
dundi_eid_to_str(dr[anscnt].eid_str, sizeof(dr[anscnt].eid_str), &dr[anscnt].eid);
|
||||||
if (flags & DUNDI_FLAG_EXISTS) {
|
if (ast_test_flag(&flags, DUNDI_FLAG_EXISTS)) {
|
||||||
AST_LIST_HEAD_INIT(&headp);
|
AST_LIST_HEAD_INIT(&headp);
|
||||||
newvariable = ast_var_assign("NUMBER", called_number);
|
newvariable = ast_var_assign("NUMBER", called_number);
|
||||||
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
|
AST_LIST_INSERT_HEAD(&headp, newvariable, entries);
|
||||||
@@ -622,9 +621,9 @@ static void *dundi_lookup_thread(void *data)
|
|||||||
}
|
}
|
||||||
ast_mutex_lock(&peerlock);
|
ast_mutex_lock(&peerlock);
|
||||||
/* Truncate if "don't ask" isn't present */
|
/* Truncate if "don't ask" isn't present */
|
||||||
if (!(hmd.flags & DUNDI_HINT_DONT_ASK))
|
if (!ast_test_flag_nonstd(&hmd, DUNDI_HINT_DONT_ASK))
|
||||||
hmd.exten[0] = '\0';
|
hmd.exten[0] = '\0';
|
||||||
if (st->trans->flags & FLAG_DEAD) {
|
if (ast_test_flag(st->trans, FLAG_DEAD)) {
|
||||||
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
destroy_trans(st->trans, 0);
|
destroy_trans(st->trans, 0);
|
||||||
@@ -661,9 +660,9 @@ static void *dundi_precache_thread(void *data)
|
|||||||
|
|
||||||
ast_mutex_lock(&peerlock);
|
ast_mutex_lock(&peerlock);
|
||||||
/* Truncate if "don't ask" isn't present */
|
/* Truncate if "don't ask" isn't present */
|
||||||
if (!(hmd.flags & DUNDI_HINT_DONT_ASK))
|
if (!ast_test_flag_nonstd(&hmd, DUNDI_HINT_DONT_ASK))
|
||||||
hmd.exten[0] = '\0';
|
hmd.exten[0] = '\0';
|
||||||
if (st->trans->flags & FLAG_DEAD) {
|
if (ast_test_flag(st->trans, FLAG_DEAD)) {
|
||||||
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
destroy_trans(st->trans, 0);
|
destroy_trans(st->trans, 0);
|
||||||
@@ -714,7 +713,7 @@ static void *dundi_query_thread(void *data)
|
|||||||
res = dundi_query_eid_internal(&dei, st->called_context, &st->reqeid, &hmd, st->ttl, 1, st->eids);
|
res = dundi_query_eid_internal(&dei, st->called_context, &st->reqeid, &hmd, st->ttl, 1, st->eids);
|
||||||
}
|
}
|
||||||
ast_mutex_lock(&peerlock);
|
ast_mutex_lock(&peerlock);
|
||||||
if (st->trans->flags & FLAG_DEAD) {
|
if (ast_test_flag(st->trans, FLAG_DEAD)) {
|
||||||
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
destroy_trans(st->trans, 0);
|
destroy_trans(st->trans, 0);
|
||||||
@@ -812,10 +811,10 @@ static int cache_save_hint(dundi_eid *eidpeer, struct dundi_request *req, struct
|
|||||||
expiration = DUNDI_DEFAULT_CACHE_TIME;
|
expiration = DUNDI_DEFAULT_CACHE_TIME;
|
||||||
|
|
||||||
/* Only cache hint if "don't ask" is there... */
|
/* Only cache hint if "don't ask" is there... */
|
||||||
if (!(ntohs(hint->flags)& DUNDI_HINT_DONT_ASK))
|
if (!ast_test_flag_nonstd(hint, htons(DUNDI_HINT_DONT_ASK)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unaffected = ntohs(hint->flags) & DUNDI_HINT_UNAFFECTED;
|
unaffected = ast_test_flag_nonstd(hint, htons(DUNDI_HINT_UNAFFECTED));
|
||||||
|
|
||||||
dundi_eid_to_str_short(eidpeer_str, sizeof(eidpeer_str), eidpeer);
|
dundi_eid_to_str_short(eidpeer_str, sizeof(eidpeer_str), eidpeer);
|
||||||
dundi_eid_to_str_short(eidroot_str, sizeof(eidroot_str), &req->root_eid);
|
dundi_eid_to_str_short(eidroot_str, sizeof(eidroot_str), &req->root_eid);
|
||||||
@@ -933,7 +932,7 @@ static int dundi_prop_precache(struct dundi_transaction *trans, struct dundi_ies
|
|||||||
strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies->answers[x]->protocol),
|
strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies->answers[x]->protocol),
|
||||||
sizeof(trans->parent->dr[trans->parent->respcount].tech));
|
sizeof(trans->parent->dr[trans->parent->respcount].tech));
|
||||||
trans->parent->respcount++;
|
trans->parent->respcount++;
|
||||||
trans->parent->hmd->flags &= ~DUNDI_HINT_DONT_ASK;
|
ast_clear_flag_nonstd(trans->parent->hmd, DUNDI_HINT_DONT_ASK);
|
||||||
} else if (trans->parent->dr[z].weight > ies->answers[x]->weight) {
|
} else if (trans->parent->dr[z].weight > ies->answers[x]->weight) {
|
||||||
/* Update weight if appropriate */
|
/* Update weight if appropriate */
|
||||||
trans->parent->dr[z].weight = ies->answers[x]->weight;
|
trans->parent->dr[z].weight = ies->answers[x]->weight;
|
||||||
@@ -1126,7 +1125,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
|
|||||||
char data[1024]="";
|
char data[1024]="";
|
||||||
char *ptr, *term, *src;
|
char *ptr, *term, *src;
|
||||||
int tech;
|
int tech;
|
||||||
int flags;
|
struct ast_flags flags;
|
||||||
int weight;
|
int weight;
|
||||||
int length;
|
int length;
|
||||||
int z;
|
int z;
|
||||||
@@ -1141,7 +1140,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
|
|||||||
if (expiration > 0) {
|
if (expiration > 0) {
|
||||||
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now));
|
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now));
|
||||||
ptr += length;
|
ptr += length;
|
||||||
while((sscanf(ptr, "%d/%d/%d/%n", &flags, &weight, &tech, &length) == 3)) {
|
while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
|
||||||
ptr += length;
|
ptr += length;
|
||||||
term = strchr(ptr, '|');
|
term = strchr(ptr, '|');
|
||||||
if (term) {
|
if (term) {
|
||||||
@@ -1153,7 +1152,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
|
|||||||
} else
|
} else
|
||||||
src = "";
|
src = "";
|
||||||
ast_log(LOG_DEBUG, "Found cached answer '%s/%s' originally from '%s' with flags '%s' on behalf of '%s'\n",
|
ast_log(LOG_DEBUG, "Found cached answer '%s/%s' originally from '%s' with flags '%s' on behalf of '%s'\n",
|
||||||
tech2str(tech), ptr, src, dundi_flags2str(fs, sizeof(fs), flags), eid_str_full);
|
tech2str(tech), ptr, src, dundi_flags2str(fs, sizeof(fs), flags.flags), eid_str_full);
|
||||||
/* Make sure it's not already there */
|
/* Make sure it's not already there */
|
||||||
for (z=0;z<req->respcount;z++) {
|
for (z=0;z<req->respcount;z++) {
|
||||||
if ((req->dr[z].techint == tech) &&
|
if ((req->dr[z].techint == tech) &&
|
||||||
@@ -1162,7 +1161,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
|
|||||||
}
|
}
|
||||||
if (z == req->respcount) {
|
if (z == req->respcount) {
|
||||||
/* Copy into parent responses */
|
/* Copy into parent responses */
|
||||||
req->dr[req->respcount].flags = flags;
|
ast_copy_flags(&(req->dr[req->respcount]), &flags, AST_FLAGS_ALL);
|
||||||
req->dr[req->respcount].weight = weight;
|
req->dr[req->respcount].weight = weight;
|
||||||
req->dr[req->respcount].techint = tech;
|
req->dr[req->respcount].techint = tech;
|
||||||
req->dr[req->respcount].expiration = expiration;
|
req->dr[req->respcount].expiration = expiration;
|
||||||
@@ -1174,7 +1173,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
|
|||||||
strncpy(req->dr[req->respcount].tech, tech2str(tech),
|
strncpy(req->dr[req->respcount].tech, tech2str(tech),
|
||||||
sizeof(req->dr[req->respcount].tech));
|
sizeof(req->dr[req->respcount].tech));
|
||||||
req->respcount++;
|
req->respcount++;
|
||||||
req->hmd->flags &= ~DUNDI_HINT_DONT_ASK;
|
ast_clear_flag_nonstd(req->hmd, DUNDI_HINT_DONT_ASK);
|
||||||
} else if (req->dr[z].weight > weight)
|
} else if (req->dr[z].weight > weight)
|
||||||
req->dr[z].weight = weight;
|
req->dr[z].weight = weight;
|
||||||
ptr = term + 1;
|
ptr = term + 1;
|
||||||
@@ -1253,7 +1252,7 @@ static void apply_peer(struct dundi_transaction *trans, struct dundi_peer *p)
|
|||||||
trans->them_eid = p->eid;
|
trans->them_eid = p->eid;
|
||||||
/* Enable encryption if appropriate */
|
/* Enable encryption if appropriate */
|
||||||
if (!ast_strlen_zero(p->inkey))
|
if (!ast_strlen_zero(p->inkey))
|
||||||
trans->flags |= FLAG_ENCRYPT;
|
ast_set_flag(trans, FLAG_ENCRYPT);
|
||||||
if (p->maxms) {
|
if (p->maxms) {
|
||||||
trans->autokilltimeout = p->maxms;
|
trans->autokilltimeout = p->maxms;
|
||||||
trans->retranstimer = DUNDI_DEFAULT_RETRANS_TIMER;
|
trans->retranstimer = DUNDI_DEFAULT_RETRANS_TIMER;
|
||||||
@@ -1406,10 +1405,10 @@ static int dundi_encrypt(struct dundi_transaction *trans, struct dundi_packet *p
|
|||||||
if (update_key(peer))
|
if (update_key(peer))
|
||||||
return -1;
|
return -1;
|
||||||
if (!peer->sentfullkey)
|
if (!peer->sentfullkey)
|
||||||
trans->flags |= FLAG_SENDFULLKEY;
|
ast_set_flag(trans, FLAG_SENDFULLKEY);
|
||||||
/* Append key data */
|
/* Append key data */
|
||||||
dundi_ie_append_eid(&ied, DUNDI_IE_EID, &trans->us_eid);
|
dundi_ie_append_eid(&ied, DUNDI_IE_EID, &trans->us_eid);
|
||||||
if (trans->flags & FLAG_SENDFULLKEY) {
|
if (ast_test_flag(trans, FLAG_SENDFULLKEY)) {
|
||||||
dundi_ie_append_raw(&ied, DUNDI_IE_SHAREDKEY, peer->txenckey, 128);
|
dundi_ie_append_raw(&ied, DUNDI_IE_SHAREDKEY, peer->txenckey, 128);
|
||||||
dundi_ie_append_raw(&ied, DUNDI_IE_SIGNATURE, peer->txenckey + 128, 128);
|
dundi_ie_append_raw(&ied, DUNDI_IE_SIGNATURE, peer->txenckey + 128, 128);
|
||||||
} else {
|
} else {
|
||||||
@@ -1634,7 +1633,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
if (ies.cause < 1) {
|
if (ies.cause < 1) {
|
||||||
/* Success of some sort */
|
/* Success of some sort */
|
||||||
ast_log(LOG_DEBUG, "Looks like success of some sort (%d), %d answers\n", ies.cause, ies.anscount);
|
ast_log(LOG_DEBUG, "Looks like success of some sort (%d), %d answers\n", ies.cause, ies.anscount);
|
||||||
if (trans->flags & FLAG_ENCRYPT) {
|
if (ast_test_flag(trans, FLAG_ENCRYPT)) {
|
||||||
authpass = encrypted;
|
authpass = encrypted;
|
||||||
} else
|
} else
|
||||||
authpass = 1;
|
authpass = 1;
|
||||||
@@ -1668,7 +1667,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies.answers[x]->protocol),
|
strncpy(trans->parent->dr[trans->parent->respcount].tech, tech2str(ies.answers[x]->protocol),
|
||||||
sizeof(trans->parent->dr[trans->parent->respcount].tech));
|
sizeof(trans->parent->dr[trans->parent->respcount].tech));
|
||||||
trans->parent->respcount++;
|
trans->parent->respcount++;
|
||||||
trans->parent->hmd->flags &= ~DUNDI_HINT_DONT_ASK;
|
ast_clear_flag_nonstd(trans->parent->hmd, DUNDI_HINT_DONT_ASK);
|
||||||
} else if (trans->parent->dr[z].weight > ies.answers[x]->weight) {
|
} else if (trans->parent->dr[z].weight > ies.answers[x]->weight) {
|
||||||
/* Update weight if appropriate */
|
/* Update weight if appropriate */
|
||||||
trans->parent->dr[z].weight = ies.answers[x]->weight;
|
trans->parent->dr[z].weight = ies.answers[x]->weight;
|
||||||
@@ -1680,18 +1679,18 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
/* Save all the results (if any) we had. Even if no results, still cache lookup. Let
|
/* Save all the results (if any) we had. Even if no results, still cache lookup. Let
|
||||||
the cache know if this request was unaffected by our entity list. */
|
the cache know if this request was unaffected by our entity list. */
|
||||||
cache_save(&trans->them_eid, trans->parent, y,
|
cache_save(&trans->them_eid, trans->parent, y,
|
||||||
ies.hint ? ntohs(ies.hint->flags) & DUNDI_HINT_UNAFFECTED : 0, ies.expiration, 0);
|
ies.hint ? ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_UNAFFECTED)) : 0, ies.expiration, 0);
|
||||||
if (ies.hint) {
|
if (ies.hint) {
|
||||||
cache_save_hint(&trans->them_eid, trans->parent, ies.hint, ies.expiration);
|
cache_save_hint(&trans->them_eid, trans->parent, ies.hint, ies.expiration);
|
||||||
if (ntohs(ies.hint->flags) & DUNDI_HINT_TTL_EXPIRED)
|
if (ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_TTL_EXPIRED)))
|
||||||
trans->parent->hmd->flags |= DUNDI_HINT_TTL_EXPIRED;
|
ast_set_flag_nonstd(trans->parent->hmd, DUNDI_HINT_TTL_EXPIRED);
|
||||||
if (ntohs(ies.hint->flags) & DUNDI_HINT_DONT_ASK) {
|
if (ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_DONT_ASK))) {
|
||||||
if (strlen(ies.hint->data) > strlen(trans->parent->hmd->exten)) {
|
if (strlen(ies.hint->data) > strlen(trans->parent->hmd->exten)) {
|
||||||
strncpy(trans->parent->hmd->exten, ies.hint->data,
|
strncpy(trans->parent->hmd->exten, ies.hint->data,
|
||||||
sizeof(trans->parent->hmd->exten) - 1);
|
sizeof(trans->parent->hmd->exten) - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
trans->parent->hmd->flags &= ~DUNDI_HINT_DONT_ASK;
|
ast_clear_flag_nonstd(trans->parent->hmd, DUNDI_HINT_DONT_ASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ies.expiration > 0) {
|
if (ies.expiration > 0) {
|
||||||
@@ -1718,7 +1717,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
if (ies.cause < 1) {
|
if (ies.cause < 1) {
|
||||||
/* Success of some sort */
|
/* Success of some sort */
|
||||||
ast_log(LOG_DEBUG, "Looks like success of some sort (%d)\n", ies.cause);
|
ast_log(LOG_DEBUG, "Looks like success of some sort (%d)\n", ies.cause);
|
||||||
if (trans->flags & FLAG_ENCRYPT) {
|
if (ast_test_flag(trans, FLAG_ENCRYPT)) {
|
||||||
authpass = encrypted;
|
authpass = encrypted;
|
||||||
} else
|
} else
|
||||||
authpass = 1;
|
authpass = 1;
|
||||||
@@ -1750,8 +1749,8 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ies.hint) {
|
if (ies.hint) {
|
||||||
if (ntohs(ies.hint->flags) & DUNDI_HINT_TTL_EXPIRED)
|
if (ast_test_flag_nonstd(ies.hint, htons(DUNDI_HINT_TTL_EXPIRED)))
|
||||||
trans->parent->hmd->flags |= DUNDI_HINT_TTL_EXPIRED;
|
ast_set_flag_nonstd(trans->parent->hmd, DUNDI_HINT_TTL_EXPIRED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Close connection if not final */
|
/* Close connection if not final */
|
||||||
@@ -1772,7 +1771,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
if (ies.cause < 1) {
|
if (ies.cause < 1) {
|
||||||
int hasauth;
|
int hasauth;
|
||||||
/* Success of some sort */
|
/* Success of some sort */
|
||||||
if (trans->flags & FLAG_ENCRYPT) {
|
if (ast_test_flag(trans, FLAG_ENCRYPT)) {
|
||||||
hasauth = encrypted;
|
hasauth = encrypted;
|
||||||
} else
|
} else
|
||||||
hasauth = 1;
|
hasauth = 1;
|
||||||
@@ -1805,13 +1804,13 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
dundi_send(trans, DUNDI_COMMAND_CANCEL, 0, 1, NULL);
|
dundi_send(trans, DUNDI_COMMAND_CANCEL, 0, 1, NULL);
|
||||||
break;
|
break;
|
||||||
case DUNDI_COMMAND_ENCREJ:
|
case DUNDI_COMMAND_ENCREJ:
|
||||||
if ((trans->flags & FLAG_SENDFULLKEY) || !trans->lasttrans || !(peer = find_peer(&trans->them_eid))) {
|
if ((ast_test_flag(trans, FLAG_SENDFULLKEY)) || !trans->lasttrans || !(peer = find_peer(&trans->them_eid))) {
|
||||||
/* No really, it's over at this point */
|
/* No really, it's over at this point */
|
||||||
if (!final)
|
if (!final)
|
||||||
dundi_send(trans, DUNDI_COMMAND_CANCEL, 0, 1, NULL);
|
dundi_send(trans, DUNDI_COMMAND_CANCEL, 0, 1, NULL);
|
||||||
} else {
|
} else {
|
||||||
/* Send with full key */
|
/* Send with full key */
|
||||||
trans->flags |= FLAG_SENDFULLKEY;
|
ast_set_flag(trans, FLAG_SENDFULLKEY);
|
||||||
if (final) {
|
if (final) {
|
||||||
/* Ooops, we got a final message, start by sending ACK... */
|
/* Ooops, we got a final message, start by sending ACK... */
|
||||||
dundi_ack(trans, hdr->cmdresp & 0x80);
|
dundi_ack(trans, hdr->cmdresp & 0x80);
|
||||||
@@ -1853,7 +1852,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
trans->ecx = peer->them_ecx;
|
trans->ecx = peer->them_ecx;
|
||||||
trans->dcx = peer->them_dcx;
|
trans->dcx = peer->them_dcx;
|
||||||
}
|
}
|
||||||
if ((trans->flags & FLAG_ENCRYPT) && ies.encblock && ies.enclen) {
|
if (ast_test_flag(trans, FLAG_ENCRYPT) && ies.encblock && ies.enclen) {
|
||||||
struct dundi_hdr *dhdr;
|
struct dundi_hdr *dhdr;
|
||||||
unsigned char decoded[MAX_PACKET_SIZE];
|
unsigned char decoded[MAX_PACKET_SIZE];
|
||||||
int ddatalen;
|
int ddatalen;
|
||||||
@@ -1873,7 +1872,7 @@ static int handle_command_response(struct dundi_transaction *trans, struct dundi
|
|||||||
}
|
}
|
||||||
if (!final) {
|
if (!final) {
|
||||||
/* Turn off encryption */
|
/* Turn off encryption */
|
||||||
trans->flags &= ~FLAG_ENCRYPT;
|
ast_clear_flag(trans, FLAG_ENCRYPT);
|
||||||
dundi_send(trans, DUNDI_COMMAND_ENCREJ, 0, 1, NULL);
|
dundi_send(trans, DUNDI_COMMAND_ENCREJ, 0, 1, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1936,7 +1935,7 @@ static int handle_frame(struct dundi_hdr *h, struct sockaddr_in *sin, int datale
|
|||||||
/* Got a transaction, see where this header fits in */
|
/* Got a transaction, see where this header fits in */
|
||||||
if (h->oseqno == trans->iseqno) {
|
if (h->oseqno == trans->iseqno) {
|
||||||
/* Just what we were looking for... Anything but ack increments iseqno */
|
/* Just what we were looking for... Anything but ack increments iseqno */
|
||||||
if (ack_trans(trans, h->iseqno) && (trans->flags & FLAG_FINAL)) {
|
if (ack_trans(trans, h->iseqno) && ast_test_flag(trans, FLAG_FINAL)) {
|
||||||
/* If final, we're done */
|
/* If final, we're done */
|
||||||
destroy_trans(trans, 0);
|
destroy_trans(trans, 0);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2759,14 +2758,14 @@ static struct dundi_transaction *create_transaction(struct dundi_peer *p)
|
|||||||
memset(trans, 0, sizeof(struct dundi_transaction));
|
memset(trans, 0, sizeof(struct dundi_transaction));
|
||||||
if (global_storehistory) {
|
if (global_storehistory) {
|
||||||
gettimeofday(&trans->start, NULL);
|
gettimeofday(&trans->start, NULL);
|
||||||
trans->flags |= FLAG_STOREHIST;
|
ast_set_flag(trans, FLAG_STOREHIST);
|
||||||
}
|
}
|
||||||
trans->retranstimer = DUNDI_DEFAULT_RETRANS_TIMER;
|
trans->retranstimer = DUNDI_DEFAULT_RETRANS_TIMER;
|
||||||
trans->autokillid = -1;
|
trans->autokillid = -1;
|
||||||
if (p) {
|
if (p) {
|
||||||
apply_peer(trans, p);
|
apply_peer(trans, p);
|
||||||
if (!p->sentfullkey)
|
if (!p->sentfullkey)
|
||||||
trans->flags |= FLAG_SENDFULLKEY;
|
ast_set_flag(trans, FLAG_SENDFULLKEY);
|
||||||
}
|
}
|
||||||
trans->strans = tid;
|
trans->strans = tid;
|
||||||
trans->allnext = alltrans;
|
trans->allnext = alltrans;
|
||||||
@@ -2829,7 +2828,7 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
|
|||||||
int x;
|
int x;
|
||||||
int cnt;
|
int cnt;
|
||||||
char eid_str[20];
|
char eid_str[20];
|
||||||
if (trans->flags & (FLAG_ISREG | FLAG_ISQUAL | FLAG_STOREHIST)) {
|
if (ast_test_flag(trans, FLAG_ISREG | FLAG_ISQUAL | FLAG_STOREHIST)) {
|
||||||
peer = peers;
|
peer = peers;
|
||||||
while (peer) {
|
while (peer) {
|
||||||
if (peer->regtrans == trans)
|
if (peer->regtrans == trans)
|
||||||
@@ -2857,7 +2856,7 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
|
|||||||
}
|
}
|
||||||
peer->qualtrans = NULL;
|
peer->qualtrans = NULL;
|
||||||
}
|
}
|
||||||
if (trans->flags & FLAG_STOREHIST) {
|
if (ast_test_flag(trans, FLAG_STOREHIST)) {
|
||||||
if (trans->parent && !ast_strlen_zero(trans->parent->number)) {
|
if (trans->parent && !ast_strlen_zero(trans->parent->number)) {
|
||||||
if (!dundi_eid_cmp(&trans->them_eid, &peer->eid)) {
|
if (!dundi_eid_cmp(&trans->them_eid, &peer->eid)) {
|
||||||
peer->avgms = 0;
|
peer->avgms = 0;
|
||||||
@@ -2932,7 +2931,7 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
|
|||||||
trans->autokillid = -1;
|
trans->autokillid = -1;
|
||||||
if (trans->thread) {
|
if (trans->thread) {
|
||||||
/* If used by a thread, mark as dead and be done */
|
/* If used by a thread, mark as dead and be done */
|
||||||
trans->flags |= FLAG_DEAD;
|
ast_set_flag(trans, FLAG_DEAD);
|
||||||
} else
|
} else
|
||||||
free(trans);
|
free(trans);
|
||||||
}
|
}
|
||||||
@@ -2946,7 +2945,7 @@ static int dundi_rexmit(void *data)
|
|||||||
pack = data;
|
pack = data;
|
||||||
if (pack->retrans < 1) {
|
if (pack->retrans < 1) {
|
||||||
pack->retransid = -1;
|
pack->retransid = -1;
|
||||||
if (!(pack->parent->flags & FLAG_ISQUAL))
|
if (!ast_test_flag(pack->parent, FLAG_ISQUAL))
|
||||||
ast_log(LOG_NOTICE, "Max retries exceeded to host '%s:%d' msg %d on call %d\n",
|
ast_log(LOG_NOTICE, "Max retries exceeded to host '%s:%d' msg %d on call %d\n",
|
||||||
ast_inet_ntoa(iabuf, sizeof(iabuf), pack->parent->addr.sin_addr),
|
ast_inet_ntoa(iabuf, sizeof(iabuf), pack->parent->addr.sin_addr),
|
||||||
ntohs(pack->parent->addr.sin_port), pack->h->oseqno, ntohs(pack->h->strans));
|
ntohs(pack->parent->addr.sin_port), pack->h->oseqno, ntohs(pack->h->strans));
|
||||||
@@ -2970,7 +2969,7 @@ static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, i
|
|||||||
char eid_str[20];
|
char eid_str[20];
|
||||||
len = sizeof(struct dundi_packet) + sizeof(struct dundi_hdr) + (ied ? ied->pos : 0);
|
len = sizeof(struct dundi_packet) + sizeof(struct dundi_hdr) + (ied ? ied->pos : 0);
|
||||||
/* Reserve enough space for encryption */
|
/* Reserve enough space for encryption */
|
||||||
if (trans->flags & FLAG_ENCRYPT)
|
if (ast_test_flag(trans, FLAG_ENCRYPT))
|
||||||
len += 384;
|
len += 384;
|
||||||
pack = malloc(len);
|
pack = malloc(len);
|
||||||
if (pack) {
|
if (pack) {
|
||||||
@@ -2995,7 +2994,7 @@ static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, i
|
|||||||
}
|
}
|
||||||
if (final) {
|
if (final) {
|
||||||
pack->h->cmdresp |= DUNDI_COMMAND_FINAL;
|
pack->h->cmdresp |= DUNDI_COMMAND_FINAL;
|
||||||
trans->flags |= FLAG_FINAL;
|
ast_set_flag(trans, FLAG_FINAL);
|
||||||
}
|
}
|
||||||
pack->h->cmdflags = flags;
|
pack->h->cmdflags = flags;
|
||||||
if (cmdresp != DUNDI_COMMAND_ACK) {
|
if (cmdresp != DUNDI_COMMAND_ACK) {
|
||||||
@@ -3004,7 +3003,7 @@ static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, i
|
|||||||
}
|
}
|
||||||
trans->aseqno = trans->iseqno;
|
trans->aseqno = trans->iseqno;
|
||||||
/* If we have their public key, encrypt */
|
/* If we have their public key, encrypt */
|
||||||
if (trans->flags & FLAG_ENCRYPT) {
|
if (ast_test_flag(trans, FLAG_ENCRYPT)) {
|
||||||
switch(cmdresp) {
|
switch(cmdresp) {
|
||||||
case DUNDI_COMMAND_REGREQ:
|
case DUNDI_COMMAND_REGREQ:
|
||||||
case DUNDI_COMMAND_REGRESPONSE:
|
case DUNDI_COMMAND_REGRESPONSE:
|
||||||
@@ -3211,7 +3210,7 @@ static int precache_transactions(struct dundi_request *dr, struct dundi_mapping
|
|||||||
|
|
||||||
trans = dr->trans;
|
trans = dr->trans;
|
||||||
while(trans) {
|
while(trans) {
|
||||||
if (!(trans->flags & FLAG_DEAD))
|
if (!ast_test_flag(trans, FLAG_DEAD))
|
||||||
precache_trans(trans, maps, mapcount, expiration, foundanswers);
|
precache_trans(trans, maps, mapcount, expiration, foundanswers);
|
||||||
trans = trans->next;
|
trans = trans->next;
|
||||||
}
|
}
|
||||||
@@ -3222,7 +3221,7 @@ static int precache_transactions(struct dundi_request *dr, struct dundi_mapping
|
|||||||
while(trans) {
|
while(trans) {
|
||||||
transn = trans->next;
|
transn = trans->next;
|
||||||
trans->thread = 0;
|
trans->thread = 0;
|
||||||
if (trans->flags & FLAG_DEAD) {
|
if (ast_test_flag(trans, FLAG_DEAD)) {
|
||||||
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
ast_log(LOG_DEBUG, "Our transaction went away!\n");
|
||||||
destroy_trans(trans, 0);
|
destroy_trans(trans, 0);
|
||||||
}
|
}
|
||||||
@@ -3395,7 +3394,7 @@ static void build_transactions(struct dundi_request *dr, int ttl, int order, int
|
|||||||
if (!dundi_eid_cmp(avoid[x], &p->eid) || !dundi_eid_cmp(avoid[x], &p->us_eid)) {
|
if (!dundi_eid_cmp(avoid[x], &p->eid) || !dundi_eid_cmp(avoid[x], &p->us_eid)) {
|
||||||
/* If not a direct connection, it affects our answer */
|
/* If not a direct connection, it affects our answer */
|
||||||
if (directs && !directs[x])
|
if (directs && !directs[x])
|
||||||
dr->hmd->flags &= ~DUNDI_HINT_UNAFFECTED;
|
ast_clear_flag_nonstd(dr->hmd, DUNDI_HINT_UNAFFECTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3575,7 +3574,7 @@ static int dundi_lookup_internal(struct dundi_result *result, int maxret, struct
|
|||||||
do this earlier because we didn't know if we were going to have transactions
|
do this earlier because we didn't know if we were going to have transactions
|
||||||
or not. */
|
or not. */
|
||||||
if (!ttl) {
|
if (!ttl) {
|
||||||
hmd->flags |= DUNDI_HINT_TTL_EXPIRED;
|
ast_set_flag_nonstd(hmd, DUNDI_HINT_TTL_EXPIRED);
|
||||||
abort_request(&dr);
|
abort_request(&dr);
|
||||||
unregister_request(&dr);
|
unregister_request(&dr);
|
||||||
close(dr.pfds[0]);
|
close(dr.pfds[0]);
|
||||||
@@ -3799,7 +3798,7 @@ static int dundi_query_eid_internal(struct dundi_entity_info *dei, const char *d
|
|||||||
do this earlier because we didn't know if we were going to have transactions
|
do this earlier because we didn't know if we were going to have transactions
|
||||||
or not. */
|
or not. */
|
||||||
if (!ttl) {
|
if (!ttl) {
|
||||||
hmd->flags |= DUNDI_HINT_TTL_EXPIRED;
|
ast_set_flag_nonstd(hmd, DUNDI_HINT_TTL_EXPIRED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3863,7 +3862,7 @@ static int dundi_lookup_exec(struct ast_channel *chan, void *data)
|
|||||||
if (results > 0) {
|
if (results > 0) {
|
||||||
sort_results(dr, results);
|
sort_results(dr, results);
|
||||||
for (x=0;x<results;x++) {
|
for (x=0;x<results;x++) {
|
||||||
if (dr[x].flags & DUNDI_FLAG_EXISTS) {
|
if (ast_test_flag(dr + x, DUNDI_FLAG_EXISTS)) {
|
||||||
pbx_builtin_setvar_helper(chan, "DUNDTECH", dr[x].tech);
|
pbx_builtin_setvar_helper(chan, "DUNDTECH", dr[x].tech);
|
||||||
pbx_builtin_setvar_helper(chan, "DUNDDEST", dr[x].dest);
|
pbx_builtin_setvar_helper(chan, "DUNDDEST", dr[x].dest);
|
||||||
break;
|
break;
|
||||||
@@ -4088,7 +4087,7 @@ static int do_register(void *data)
|
|||||||
destroy_trans(peer->regtrans, 0);
|
destroy_trans(peer->regtrans, 0);
|
||||||
peer->regtrans = create_transaction(peer);
|
peer->regtrans = create_transaction(peer);
|
||||||
if (peer->regtrans) {
|
if (peer->regtrans) {
|
||||||
peer->regtrans->flags |= FLAG_ISREG;
|
ast_set_flag(peer->regtrans, FLAG_ISREG);
|
||||||
memset(&ied, 0, sizeof(ied));
|
memset(&ied, 0, sizeof(ied));
|
||||||
dundi_ie_append_short(&ied, DUNDI_IE_VERSION, DUNDI_DEFAULT_VERSION);
|
dundi_ie_append_short(&ied, DUNDI_IE_VERSION, DUNDI_DEFAULT_VERSION);
|
||||||
dundi_ie_append_eid(&ied, DUNDI_IE_EID, &peer->regtrans->us_eid);
|
dundi_ie_append_eid(&ied, DUNDI_IE_EID, &peer->regtrans->us_eid);
|
||||||
@@ -4130,7 +4129,7 @@ static void qualify_peer(struct dundi_peer *peer, int schedonly)
|
|||||||
peer->qualtrans = create_transaction(peer);
|
peer->qualtrans = create_transaction(peer);
|
||||||
if (peer->qualtrans) {
|
if (peer->qualtrans) {
|
||||||
gettimeofday(&peer->qualtx, NULL);
|
gettimeofday(&peer->qualtx, NULL);
|
||||||
peer->qualtrans->flags |= FLAG_ISQUAL;
|
ast_set_flag(peer->qualtrans, FLAG_ISQUAL);
|
||||||
dundi_send(peer->qualtrans, DUNDI_COMMAND_NULL, 0, 1, NULL);
|
dundi_send(peer->qualtrans, DUNDI_COMMAND_NULL, 0, 1, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4346,7 +4345,7 @@ static int dundi_helper(struct ast_channel *chan, const char *context, const cha
|
|||||||
}
|
}
|
||||||
res = dundi_lookup(results, MAX_RESULTS, chan, data, exten, 0);
|
res = dundi_lookup(results, MAX_RESULTS, chan, data, exten, 0);
|
||||||
for (x=0;x<res;x++) {
|
for (x=0;x<res;x++) {
|
||||||
if (results[x].flags & flag)
|
if (ast_test_flag(results + x, flag))
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
if (found >= priority)
|
if (found >= priority)
|
||||||
@@ -4399,7 +4398,7 @@ static int dundi_exec(struct ast_channel *chan, const char *context, const char
|
|||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
sort_results(results, res);
|
sort_results(results, res);
|
||||||
for (x=0;x<res;x++) {
|
for (x=0;x<res;x++) {
|
||||||
if (results[x].flags & DUNDI_FLAG_EXISTS) {
|
if (ast_test_flag(results + x, DUNDI_FLAG_EXISTS)) {
|
||||||
if (!--priority)
|
if (!--priority)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -623,8 +623,8 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memset(&bconfig,0,sizeof(struct ast_bridge_config));
|
memset(&bconfig,0,sizeof(struct ast_bridge_config));
|
||||||
bconfig.features_caller |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(bconfig.features_caller), AST_FEATURE_DISCONNECT);
|
||||||
bconfig.features_callee |= AST_FEATURE_DISCONNECT;
|
ast_set_flag(&(bconfig.features_callee), AST_FEATURE_DISCONNECT);
|
||||||
res = ast_bridge_call(transferer,newchan,&bconfig);
|
res = ast_bridge_call(transferer,newchan,&bconfig);
|
||||||
if (newchan->_softhangup || newchan->_state != AST_STATE_UP) {
|
if (newchan->_softhangup || newchan->_state != AST_STATE_UP) {
|
||||||
ast_hangup(newchan);
|
ast_hangup(newchan);
|
||||||
@@ -671,7 +671,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
|
|||||||
ast_channel_masquerade(xferchan, transferee);
|
ast_channel_masquerade(xferchan, transferee);
|
||||||
ast_explicit_goto(xferchan, transferee->context, transferee->exten, transferee->priority);
|
ast_explicit_goto(xferchan, transferee->context, transferee->exten, transferee->priority);
|
||||||
xferchan->_state = AST_STATE_UP;
|
xferchan->_state = AST_STATE_UP;
|
||||||
xferchan->flags = 0;
|
ast_clear_flag(xferchan, AST_FLAGS_ALL);
|
||||||
xferchan->_softhangup = 0;
|
xferchan->_softhangup = 0;
|
||||||
|
|
||||||
if ((f = ast_read(xferchan))) {
|
if ((f = ast_read(xferchan))) {
|
||||||
@@ -685,7 +685,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
newchan->_state = AST_STATE_UP;
|
newchan->_state = AST_STATE_UP;
|
||||||
newchan->flags = 0;
|
ast_clear_flag(newchan, AST_FLAGS_ALL);
|
||||||
newchan->_softhangup = 0;
|
newchan->_softhangup = 0;
|
||||||
|
|
||||||
tobj = malloc(sizeof(struct ast_bridge_thread_obj));
|
tobj = malloc(sizeof(struct ast_bridge_thread_obj));
|
||||||
@@ -789,16 +789,16 @@ static int remap_feature(const char *name, const char *value)
|
|||||||
static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
|
static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
unsigned int features;
|
struct ast_flags features;
|
||||||
int res = FEATURE_RETURN_PASSDIGITS;
|
int res = FEATURE_RETURN_PASSDIGITS;
|
||||||
|
|
||||||
if (sense == FEATURE_SENSE_CHAN)
|
if (sense == FEATURE_SENSE_CHAN)
|
||||||
features = config->features_caller;
|
ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL);
|
||||||
else
|
else
|
||||||
features = config->features_callee;
|
ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL);
|
||||||
ast_log(LOG_DEBUG, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d\n", chan->name, peer->name, sense, features);
|
ast_log(LOG_DEBUG, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d\n", chan->name, peer->name, sense, features.flags);
|
||||||
for (x=0;x<FEATURES_COUNT;x++) {
|
for (x=0;x<FEATURES_COUNT;x++) {
|
||||||
if ((features & builtin_features[x].feature_mask) &&
|
if ((ast_test_flag(&features, builtin_features[x].feature_mask)) &&
|
||||||
!ast_strlen_zero(builtin_features[x].exten)) {
|
!ast_strlen_zero(builtin_features[x].exten)) {
|
||||||
/* Feature is up for consideration */
|
/* Feature is up for consideration */
|
||||||
if (!strcmp(builtin_features[x].exten, code)) {
|
if (!strcmp(builtin_features[x].exten, code)) {
|
||||||
@@ -816,14 +816,14 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
|
|||||||
static void set_config_flags(struct ast_bridge_config *config)
|
static void set_config_flags(struct ast_bridge_config *config)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
config->flags = 0;
|
ast_clear_flag(config, AST_FLAGS_ALL);
|
||||||
for (x=0;x<FEATURES_COUNT;x++) {
|
for (x=0;x<FEATURES_COUNT;x++) {
|
||||||
if (config->features_caller & builtin_features[x].feature_mask) {
|
if (ast_test_flag(&(config->features_caller), builtin_features[x].feature_mask)) {
|
||||||
if (builtin_features[x].flags & AST_FEATURE_FLAG_NEEDSDTMF)
|
if (ast_test_flag(builtin_features + x, AST_FEATURE_FLAG_NEEDSDTMF))
|
||||||
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
|
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0);
|
||||||
}
|
}
|
||||||
if (config->features_callee & builtin_features[x].feature_mask) {
|
if (ast_test_flag(&(config->features_callee), builtin_features[x].feature_mask)) {
|
||||||
if (builtin_features[x].flags & AST_FEATURE_FLAG_NEEDSDTMF)
|
if (ast_test_flag(builtin_features + x, AST_FEATURE_FLAG_NEEDSDTMF))
|
||||||
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
|
ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -866,10 +866,10 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
pbx_exec(peer, monitor_app, monitor_exec, 1);
|
pbx_exec(peer, monitor_app, monitor_exec, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
allowdisconnect_in = (config->features_callee & AST_FEATURE_DISCONNECT);
|
allowdisconnect_in = ast_test_flag(&(config->features_callee), AST_FEATURE_DISCONNECT);
|
||||||
allowdisconnect_out = (config->features_caller & AST_FEATURE_DISCONNECT);
|
allowdisconnect_out = ast_test_flag(&(config->features_caller), AST_FEATURE_DISCONNECT);
|
||||||
allowredirect_in = (config->features_callee & AST_FEATURE_REDIRECT);
|
allowredirect_in = ast_test_flag(&(config->features_callee), AST_FEATURE_REDIRECT);
|
||||||
allowredirect_out = (config->features_caller & AST_FEATURE_REDIRECT);
|
allowredirect_out = ast_test_flag(&(config->features_caller), AST_FEATURE_REDIRECT);
|
||||||
set_config_flags(config);
|
set_config_flags(config);
|
||||||
config->firstpass = 1;
|
config->firstpass = 1;
|
||||||
|
|
||||||
@@ -1030,8 +1030,8 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
memcpy(&backup_config, config, sizeof(struct ast_bridge_config));
|
memcpy(&backup_config, config, sizeof(struct ast_bridge_config));
|
||||||
/* Setup temporary config options */
|
/* Setup temporary config options */
|
||||||
config->play_warning = 0;
|
config->play_warning = 0;
|
||||||
config->features_caller &= ~(AST_FEATURE_PLAY_WARNING);
|
ast_clear_flag(&(config->features_caller), AST_FEATURE_PLAY_WARNING);
|
||||||
config->features_callee &= ~(AST_FEATURE_PLAY_WARNING);
|
ast_clear_flag(&(config->features_callee),AST_FEATURE_PLAY_WARNING);
|
||||||
config->warning_freq = 0;
|
config->warning_freq = 0;
|
||||||
config->warning_sound = NULL;
|
config->warning_sound = NULL;
|
||||||
config->end_sound = NULL;
|
config->end_sound = NULL;
|
||||||
@@ -1301,8 +1301,8 @@ static int park_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_verbose(VERBOSE_PREFIX_3 "Channel %s connected to parked call %d\n", chan->name, park);
|
ast_verbose(VERBOSE_PREFIX_3 "Channel %s connected to parked call %d\n", chan->name, park);
|
||||||
|
|
||||||
memset(&config,0,sizeof(struct ast_bridge_config));
|
memset(&config,0,sizeof(struct ast_bridge_config));
|
||||||
config.features_callee |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
|
||||||
config.features_caller |= AST_FEATURE_REDIRECT;
|
ast_set_flag(&(config.features_caller), AST_FEATURE_REDIRECT);
|
||||||
config.timelimit = 0;
|
config.timelimit = 0;
|
||||||
config.play_warning = 0;
|
config.play_warning = 0;
|
||||||
config.warning_freq = 0;
|
config.warning_freq = 0;
|
||||||
|
Reference in New Issue
Block a user