return res;
}
rfmt = c->readformat;
- res = ast_set_read_format(c, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(c, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
ast_frfree(f);
}
}
- res = ast_set_read_format(c, rfmt, 1);
+ res = ast_set_read_format(c, rfmt);
if (res)
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", c->name);
ast_dsp_free(sildet);
if (silence > 0) {
rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
fdprintf(agi->fd, "200 result=%d (randomerror) endpos=%ld\n", res, sample_offset);
if (silence > 0) {
- res = ast_set_read_format(chan, rfmt, 1);
+ res = ast_set_read_format(chan, rfmt);
if (res)
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name);
ast_dsp_free(sildet);
int readformat;
int res;
readformat = chan->readformat;
- if (ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1)) {
+ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set channel '%s' to linear mode\n", chan->name);
return -1;
}
res = agi_exec_full(chan, data, 1, 0);
if (!res) {
- if (ast_set_read_format(chan, readformat, 1)) {
+ if (ast_set_read_format(chan, readformat)) {
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(readformat));
}
}
FILE *fp;
char *stringp=NULL;
- if (ast_set_write_format(chan,AST_FORMAT_ULAW, 1))
+ if (ast_set_write_format(chan,AST_FORMAT_ULAW))
{
ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n",chan->name);
return -1;
}
- if (ast_set_read_format(chan,AST_FORMAT_ULAW, 1))
+ if (ast_set_read_format(chan,AST_FORMAT_ULAW))
{
ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n",chan->name);
return -1;
struct localuser *u;
struct ast_frame *f;
LOCAL_USER_ADD(u);
- ast_set_write_format(chan, ast_best_codec(chan->nativeformats), 1);
- ast_set_read_format(chan, ast_best_codec(chan->nativeformats), 1);
+ ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
+ ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
/* Do our thing here */
while(ast_waitfor(chan, -1) > -1) {
f = ast_read(chan);
ast_stopstream(chan);
owriteformat = chan->writeformat;
- res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
return -1;
// if (pid > -1)
// kill(pid, SIGKILL);
if (!res && owriteformat)
- ast_set_write_format(chan, owriteformat, 1);
+ ast_set_write_format(chan, owriteformat);
return res;
}
}
oreadformat = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 0);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
close(fds[0]);
close(fds[1]);
if (pid > -1)
kill(pid, SIGKILL);
if (!res && oreadformat)
- ast_set_read_format(chan, oreadformat, 0);
+ ast_set_read_format(chan, oreadformat);
return res;
}
/* Remember original read format */
oreadformat = chan->readformat;
/* Set mode to signed linear */
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set format to signed linear on channel %s\n", chan->name);
return -1;
}
LOCAL_USER_REMOVE(u);
if (!res)
- ast_set_read_format(chan, oreadformat, 1);
+ ast_set_read_format(chan, oreadformat);
return res;
}
if (confflags & CONFFLAG_VIDEO) {
/* Set it into linear mode (write) */
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to write linear mode\n", chan->name);
goto outrun;
}
/* Set it into linear mode (read) */
- if (ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", chan->name);
goto outrun;
}
} else {
/* Set it into U-law mode (write) */
- if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", chan->name);
goto outrun;
}
/* Set it into U-law mode (read) */
- if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}
struct localuser *u;
LOCAL_USER_ADD(u);
- ast_set_write_format(chan, AST_FORMAT_ULAW, 1);
- ast_set_read_format(chan, AST_FORMAT_ULAW, 1);
+ ast_set_write_format(chan, AST_FORMAT_ULAW);
+ ast_set_read_format(chan, AST_FORMAT_ULAW);
if (chan->_state != AST_STATE_UP)
{
ast_answer(chan);
ast_stopstream(chan);
owriteformat = chan->writeformat;
- res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
return -1;
if (pid > -1)
kill(pid, SIGKILL);
if (!res && owriteformat)
- ast_set_write_format(chan, owriteformat, 1);
+ ast_set_write_format(chan, owriteformat);
return res;
}
ast_stopstream(chan);
owriteformat = chan->writeformat;
- res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 0);
+ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
return -1;
if (pid > -1)
kill(pid, SIGKILL);
if (!res && owriteformat)
- ast_set_write_format(chan, owriteformat, 0);
+ ast_set_write_format(chan, owriteformat);
return res;
}
channel = ast_request(dialstr,AST_FORMAT_SLINEAR,tele);
if (channel)
{
- ast_set_read_format(channel,AST_FORMAT_SLINEAR, 1);
- ast_set_write_format(channel,AST_FORMAT_SLINEAR, 1);
+ ast_set_read_format(channel,AST_FORMAT_SLINEAR);
+ ast_set_write_format(channel,AST_FORMAT_SLINEAR);
#ifdef OURCLID
if (channel->callerid)
free(channel->callerid);
if (silence > 0) {
rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
LOCAL_USER_REMOVE(u);
if (silence > 0) {
- res = ast_set_read_format(chan, rfmt, 1);
+ res = ast_set_read_format(chan, rfmt);
if (res)
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name);
if (sildet)
if (maxsilence > 0) {
rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
}
}
if (rfmt) {
- if (ast_set_read_format(chan, rfmt, 1)) {
+ if (ast_set_read_format(chan, rfmt)) {
ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
}
}
if (maxsilence > 0) {
rfmt = chan->readformat;
- res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
ast_closestream(others[x]);
}
if (rfmt) {
- if (ast_set_read_format(chan, rfmt, 1)) {
+ if (ast_set_read_format(chan, rfmt)) {
ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
}
}
char *buf = __buf + AST_FRIENDLY_OFFSET;
/* Set it into U-law mode (write) */
- if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", chan->name);
goto outrun;
}
/* Set it into U-law mode (read) */
- if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}
char *buf = __buf + AST_FRIENDLY_OFFSET;
/* Set it into U-law mode (write) */
- if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to write ulaw mode\n", chan->name);
goto outrun;
}
/* Set it into U-law mode (read) */
- if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}
return tmp;
}
-int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int lock)
+int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
{
struct ast_frame *f;
struct ast_frame *prev, *cur;
ast_log(LOG_WARNING, "Unable to duplicate frame\n");
return -1;
}
- if (lock)
- ast_mutex_lock(&chan->lock);
+ ast_mutex_lock(&chan->lock);
prev = NULL;
cur = chan->pvt->readq;
while(cur) {
} else {
ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name);
ast_frfree(f);
- if (lock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return 0;
}
}
} else if (chan->blocking) {
pthread_kill(chan->blocker, SIGURG);
}
- if (lock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return 0;
}
-int ast_queue_hangup(struct ast_channel *chan, int lock)
+int ast_queue_hangup(struct ast_channel *chan)
{
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
chan->_softhangup |= AST_SOFTHANGUP_DEV;
- return ast_queue_frame(chan, &f, lock);
+ return ast_queue_frame(chan, &f);
}
-int ast_queue_control(struct ast_channel *chan, int control, int lock)
+int ast_queue_control(struct ast_channel *chan, int control)
{
struct ast_frame f = { AST_FRAME_CONTROL, };
f.subclass = control;
- return ast_queue_frame(chan, &f, lock);
+ return ast_queue_frame(chan, &f);
}
int ast_channel_defer_dtmf(struct ast_channel *chan)
ast_log(LOG_DEBUG, "Soft-Hanging up channel '%s'\n", chan->name);
/* Inform channel driver that we need to be hung up, if it cares */
chan->_softhangup |= cause;
- ast_queue_frame(chan, &f, 0);
+ ast_queue_frame(chan, &f);
/* Interrupt any select call or such */
if (chan->blocking)
pthread_kill(chan->blocker, SIGURG);
if someone is going to masquerade as us */
ast_mutex_lock(&chan->lock);
if (chan->masq) {
- if (ast_do_masquerade(chan, 1))
+ if (ast_do_masquerade(chan))
ast_log(LOG_WARNING, "Failed to perform masquerade\n");
}
}
}
if (c[x]->masq) {
- if (ast_do_masquerade(c[x], 1)) {
+ if (ast_do_masquerade(c[x])) {
ast_log(LOG_WARNING, "Masquerade failed\n");
*ms = -1;
ast_mutex_unlock(&c[x]->lock);
ast_mutex_lock(&chan->lock);
if (chan->masq) {
- if (ast_do_masquerade(chan, 1)) {
+ if (ast_do_masquerade(chan)) {
ast_log(LOG_WARNING, "Failed to perform masquerade\n");
f = NULL;
} else
}
/* Handle any pending masquerades */
if (chan->masq) {
- if (ast_do_masquerade(chan, 1)) {
+ if (ast_do_masquerade(chan)) {
ast_log(LOG_WARNING, "Failed to perform masquerade\n");
ast_mutex_unlock(&chan->lock);
return -1;
return res;
}
-int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
+int ast_set_write_format(struct ast_channel *chan, int fmts)
{
int fmt;
int native;
int res;
- if (needlock)
- ast_mutex_lock(&chan->lock);
+ ast_mutex_lock(&chan->lock);
native = chan->nativeformats;
fmt = fmts;
if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
ast_getformatname(fmts), ast_getformatname(chan->nativeformats));
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return -1;
}
chan->pvt->writetrans = ast_translator_build_path(chan->pvt->rawwriteformat, chan->writeformat);
if (option_debug)
ast_log(LOG_DEBUG, "Set channel %s to write format %s\n", chan->name, ast_getformatname(chan->writeformat));
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return 0;
}
-int ast_set_read_format(struct ast_channel *chan, int fmts, int needlock)
+int ast_set_read_format(struct ast_channel *chan, int fmts)
{
int fmt;
int native;
int res;
- if (needlock)
- ast_mutex_lock(&chan->lock);
+ ast_mutex_lock(&chan->lock);
native = chan->nativeformats;
fmt = fmts;
/* Find a translation path from the native read format to one of the user's read formats */
if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
ast_getformatname(chan->nativeformats), ast_getformatname(fmts));
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return -1;
}
if (option_debug)
ast_log(LOG_DEBUG, "Set channel %s to read format %s\n",
chan->name, ast_getformatname(chan->readformat));
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
return 0;
}
return -1;
}
/* Set read format on channel */
- res = ast_set_read_format(chan, peerf, 1);
+ res = ast_set_read_format(chan, peerf);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set read format on channel %s to %d\n", chan->name, chanf);
return -1;
}
/* Set write format on peer channel */
- res = ast_set_write_format(peer, peerf, 1);
+ res = ast_set_write_format(peer, peerf);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format on channel %s to %d\n", peer->name, peerf);
return -1;
return -1;
}
/* Set writeformat on channel */
- res = ast_set_write_format(chan, chanf, 1);
+ res = ast_set_write_format(chan, chanf);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format on channel %s to %d\n", chan->name, chanf);
return -1;
}
/* Set read format on peer channel */
- res = ast_set_read_format(peer, chanf, 1);
+ res = ast_set_read_format(peer, chanf);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set read format on channel %s to %d\n", peer->name, peerf);
return -1;
clone->masqr = original;
/* XXX can't really hold the lock here, but at the same time, it' s
not really safe not to XXX */
- ast_queue_frame(original, &null, 0);
- ast_queue_frame(clone, &null, 0);
+ ast_queue_frame(original, &null);
+ ast_queue_frame(clone, &null);
ast_log(LOG_DEBUG, "Done planning to masquerade %s into the structure of %s\n", original->name, clone->name);
return 0;
}
manager_event(EVENT_FLAG_CALL, "Rename", "Oldname: %s\r\nNewname: %s\r\nUniqueid: %s\r\n", tmp, chan->name, chan->uniqueid);
}
-int ast_do_masquerade(struct ast_channel *original, int needlock)
+int ast_do_masquerade(struct ast_channel *original)
{
int x,i;
int res=0;
channel's backend. I'm not sure we're going to keep this function, because
while the features are nice, the cost is very high in terms of pure nastiness. XXX */
- if (needlock)
- /* We need the clone's lock, too */
- ast_mutex_lock(&clone->lock);
+ /* We need the clone's lock, too */
+ ast_mutex_lock(&clone->lock);
ast_log(LOG_DEBUG, "Got clone lock on '%s' at %p\n", clone->name, &clone->lock);
if (clone->pvt->fixup){
- res = clone->pvt->fixup(original, clone, needlock);
+ res = clone->pvt->fixup(original, clone);
if (res)
ast_log(LOG_WARNING, "Fixup failed on channel %s, strange things may happen.\n", clone->name);
}
res = clone->pvt->hangup(clone);
if (res) {
ast_log(LOG_WARNING, "Hangup failed! Strange things may happen!\n");
- if (needlock)
- ast_mutex_unlock(&clone->lock);
+ ast_mutex_unlock(&clone->lock);
return -1;
}
/* pvt switches. pbx stays the same, as does next */
/* Set the write format */
- ast_set_write_format(original, wformat, 0);
+ ast_set_write_format(original, wformat);
/* Set the read format */
- ast_set_read_format(original, rformat, 0);
+ ast_set_read_format(original, rformat);
ast_log(LOG_DEBUG, "Putting channel %s in %d/%d formats\n", original->name, wformat, rformat);
/* Okay. Last thing is to let the channel driver know about all this mess, so he
can fix up everything as best as possible */
if (original->pvt->fixup) {
- res = original->pvt->fixup(clone, original, needlock);
+ res = original->pvt->fixup(clone, original);
if (res) {
ast_log(LOG_WARNING, "Driver for '%s' could not fixup channel %s\n",
original->type, original->name);
+ ast_mutex_unlock(&clone->lock);
return -1;
}
} else
zombie, then free it now (since it already is considered invalid). */
if (clone->zombie) {
ast_log(LOG_DEBUG, "Destroying clone '%s'\n", clone->name);
- if (needlock)
- ast_mutex_unlock(&clone->lock);
+ ast_mutex_unlock(&clone->lock);
ast_channel_free(clone);
manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n", zombn);
} else {
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
clone->zombie=1;
- if (needlock)
- ast_mutex_unlock(&clone->lock);
+ ast_mutex_unlock(&clone->lock);
}
/* Signal any blocker */
{
struct tonepair_state *ts = params;
if (chan) {
- ast_set_write_format(chan, ts->origwfmt, 0);
+ ast_set_write_format(chan, ts->origwfmt);
}
free(ts);
}
return NULL;
memset(ts, 0, sizeof(struct tonepair_state));
ts->origwfmt = chan->writeformat;
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1)) {
+ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", chan->name);
tonepair_release(NULL, ts);
ts = NULL;
/* Native formats changed, reset things */ \
ast->nativeformats = p->chan->nativeformats; \
ast_log(LOG_DEBUG, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\
- ast_set_read_format(ast, ast->readformat, 0); \
- ast_set_write_format(ast, ast->writeformat, 0); \
+ ast_set_read_format(ast, ast->readformat); \
+ ast_set_write_format(ast, ast->writeformat); \
} \
if (p->chan->readformat != ast->pvt->rawreadformat) \
- ast_set_read_format(p->chan, ast->pvt->rawreadformat, 0); \
+ ast_set_read_format(p->chan, ast->pvt->rawreadformat); \
if (p->chan->writeformat != ast->pvt->rawwriteformat) \
- ast_set_write_format(p->chan, ast->pvt->rawwriteformat, 0); \
+ ast_set_write_format(p->chan, ast->pvt->rawwriteformat); \
} \
} while(0)
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
}
if (!res) {
- res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats), 0);
+ res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats));
ast_log( LOG_DEBUG, "Set read format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
}
if (!res) {
- ast_set_write_format(p->chan, ast_best_codec(p->chan->nativeformats), 0);
+ ast_set_write_format(p->chan, ast_best_codec(p->chan->nativeformats));
ast_log( LOG_DEBUG, "Set write format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
if( ast_mutex_trylock(&p->app_lock) )
{
if (p->chan) {
- ast_queue_frame(p->chan, &null_frame, 1);
+ ast_queue_frame(p->chan, &null_frame);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
ast_mutex_lock(&p->app_lock);
ast_mutex_lock(&p->lock);
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock);
if (!res) {
- res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats), 0);
+ res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
}
if (!res) {
- ast_set_write_format(chan, ast_best_codec(chan->nativeformats), 0);
+ ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
}
f.mallocd = 0;
f.src = "SEND_DIGIT";
- return ast_queue_frame(p->owner, &f, 1);
+ return ast_queue_frame(p->owner, &f);
}
/**
/* Send hangup */
if (p->owner)
- ast_queue_hangup(p->owner, 1);
+ ast_queue_hangup(p->owner);
p = NULL;
return;
/* Assumes lock for callno is already held... */
for (;;) {
pass++;
- if (!ast_mutex_trylock(&iaxsl[callno])) {
- ast_log(LOG_WARNING, "Lock is not held on pass %d of iax_queue_frame\n", pass);
- CRASH;
- }
if (iaxs[callno] && iaxs[callno]->owner) {
if (ast_mutex_trylock(&iaxs[callno]->owner->lock)) {
/* Avoid deadlock by pausing and trying again */
usleep(1);
ast_mutex_lock(&iaxsl[callno]);
} else {
- ast_queue_frame(iaxs[callno]->owner, f, 0);
+ ast_queue_frame(iaxs[callno]->owner, f);
ast_mutex_unlock(&iaxs[callno]->owner->lock);
break;
}
/* If there's an owner, prod it to give up */
owner->pvt->pvt = NULL;
owner->_softhangup |= AST_SOFTHANGUP_DEV;
- ast_queue_hangup(owner, 0);
+ ast_queue_hangup(owner);
}
for (cur = iaxq.head; cur ; cur = cur->next) {
return send_command(c->pvt->pvt, AST_FRAME_HTML, subclass, 0, data, datalen, -1);
}
-static int iax_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan, int needlock)
+static int iax_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan)
{
struct chan_iax_pvt *pvt = newchan->pvt->pvt;
pvt->owner = newchan;
orignative = iaxs[fr.callno]->owner->nativeformats;
iaxs[fr.callno]->owner->nativeformats = f.subclass;
if (iaxs[fr.callno]->owner->readformat)
- ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat, 0);
+ ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
iaxs[fr.callno]->owner->nativeformats = orignative;
ast_mutex_unlock(&iaxs[fr.callno]->owner->lock);
}
ast_verbose(VERBOSE_PREFIX_3 "Format for call is %s\n", ast_getformatname(iaxs[fr.callno]->owner->nativeformats));
/* Setup read/write formats properly. */
if (iaxs[fr.callno]->owner->writeformat)
- ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat, 0);
+ ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat);
if (iaxs[fr.callno]->owner->readformat)
- ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat, 0);
+ ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
}
}
ast_mutex_lock(&dpcache_lock);
/* Assumes lock for callno is already held... */
for (;;) {
pass++;
- if (!ast_mutex_trylock(&iaxsl[callno])) {
- ast_log(LOG_WARNING, "Lock is not held on pass %d of iax2_queue_frame\n", pass);
- CRASH;
- }
if (iaxs[callno] && iaxs[callno]->owner) {
if (ast_mutex_trylock(&iaxs[callno]->owner->lock)) {
/* Avoid deadlock by pausing and trying again */
usleep(1);
ast_mutex_lock(&iaxsl[callno]);
} else {
- ast_queue_frame(iaxs[callno]->owner, f, 0);
+ ast_queue_frame(iaxs[callno]->owner, f);
ast_mutex_unlock(&iaxs[callno]->owner->lock);
break;
}
if (c) {
c->_softhangup |= AST_SOFTHANGUP_DEV;
c->pvt->pvt = NULL;
- ast_queue_hangup(c, 0);
+ ast_queue_hangup(c);
pvt->owner = NULL;
ast_mutex_lock(&usecnt_lock);
usecnt--;
if (owner) {
/* If there's an owner, prod it to give up */
owner->_softhangup |= AST_SOFTHANGUP_DEV;
- ast_queue_hangup(owner, 0);
+ ast_queue_hangup(owner);
}
for (cur = iaxq.head; cur ; cur = cur->next) {
return send_command_locked(PTR_TO_CALLNO(c->pvt->pvt), AST_FRAME_HTML, subclass, 0, data, datalen, -1);
}
-static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan, int lock)
+static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newchan)
{
unsigned short callno = PTR_TO_CALLNO(newchan->pvt->pvt);
- if (lock)
- ast_mutex_lock(&iaxsl[callno]);
+ ast_mutex_lock(&iaxsl[callno]);
if (iaxs[callno])
iaxs[callno]->owner = newchan;
else
ast_log(LOG_WARNING, "Uh, this isn't a good sign...\n");
- if (lock)
- ast_mutex_unlock(&iaxsl[callno]);
+ ast_mutex_unlock(&iaxsl[callno]);
return 0;
}
strncpy(chan2m->context, chan2->context, sizeof(chan2m->context) - 1);
strncpy(chan2m->exten, chan2->exten, sizeof(chan2m->exten) - 1);
chan2m->priority = chan2->priority;
- if (ast_do_masquerade(chan2m, 0)) {
+ if (ast_do_masquerade(chan2m)) {
ast_log(LOG_WARNING, "Masquerade failed :(\n");
ast_hangup(chan2m);
return -1;
orignative = iaxs[fr.callno]->owner->nativeformats;
iaxs[fr.callno]->owner->nativeformats = f.subclass;
if (iaxs[fr.callno]->owner->readformat)
- ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat, 0);
+ ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
iaxs[fr.callno]->owner->nativeformats = orignative;
ast_mutex_unlock(&iaxs[fr.callno]->owner->lock);
}
} else
ast_log(LOG_DEBUG, "Parked call on '%s'\n", iaxs[fr.callno]->owner->bridge->name);
} else {
- if (ast_async_goto(iaxs[fr.callno]->owner->bridge, iaxs[fr.callno]->context, ies.called_number, 1, 1))
+ if (ast_async_goto(iaxs[fr.callno]->owner->bridge, iaxs[fr.callno]->context, ies.called_number, 1))
ast_log(LOG_WARNING, "Async goto of '%s' to '%s@%s' failed\n", iaxs[fr.callno]->owner->bridge->name,
ies.called_number, iaxs[fr.callno]->context);
else
if (iaxs[fr.callno] && iaxs[fr.callno]->owner) {
/* Setup read/write formats properly. */
if (iaxs[fr.callno]->owner->writeformat)
- ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat, 0);
+ ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat);
if (iaxs[fr.callno]->owner->readformat)
- ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat, 0);
+ ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
ast_mutex_unlock(&iaxs[fr.callno]->owner->lock);
}
}
ast_mutex_lock(&p->lock);
goto retrylock;
}
- ast_queue_frame(other, f, 0);
+ ast_queue_frame(other, f);
ast_mutex_unlock(&other->lock);
p->glaredetect = 0;
return 0;
return res;
}
-static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, int needlock)
+static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct local_pvt *p = newchan->pvt->pvt;
- if (needlock)
- ast_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
if ((p->owner != oldchan) && (p->chan != oldchan)) {
ast_log(LOG_WARNING, "old channel wasn't %p but was %p/%p\n", oldchan, p->owner, p->chan);
- if (needlock)
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return -1;
}
if (p->owner == oldchan)
p->owner = newchan;
else
p->chan = newchan;
- if (needlock)
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return 0;
}
transmit_notify_request_with_callerid(sub, tone, ast->callerid);
ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast, AST_CONTROL_RINGING, 0);
+ ast_queue_control(ast, AST_CONTROL_RINGING);
if (sub->next->owner && strlen(sub->next->cxident) && strlen(sub->next->callid)) {
/* Put the connection back in sendrecv */
if (f->subclass != sub->owner->nativeformats) {
ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
sub->owner->nativeformats = f->subclass;
- ast_set_read_format(sub->owner, sub->owner->readformat, 0);
- ast_set_write_format(sub->owner, sub->owner->writeformat, 0);
+ ast_set_read_format(sub->owner, sub->owner->readformat);
+ ast_set_write_format(sub->owner, sub->owner->writeformat);
}
/* Courtesy fearnor aka alex@pilosoft.com */
if (sub->parent->dtmfinband) {
#if 0
ast_log(LOG_NOTICE, "MGCP ast_dsp_process\n");
#endif
- f = ast_dsp_process(sub->owner, sub->parent->dsp, f, 0);
+ f = ast_dsp_process(sub->owner, sub->parent->dsp, f);
}
}
}
return res;
}
-static int mgcp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, int needlock)
+static int mgcp_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct mgcp_subchannel *sub = newchan->pvt->pvt;
ast_log(LOG_NOTICE, "mgcp_fixup(%s, %s)\n", oldchan->name, newchan->name);
f = ast_dsp_process(p->owner,p->dsp,f,0);
}
}
- ast_queue_frame(p->owner, f, 0);
+ ast_queue_frame(p->owner, f);
ast_mutex_unlock(&p->owner->lock);
}
}
p->sub->next->owner->_softhangup |= AST_SOFTHANGUP_DEV;
if (p->sub->next->owner) {
p->sub->next->alreadygone = 1;
- ast_queue_hangup(p->sub->next->owner, 1);
+ ast_queue_hangup(p->sub->next->owner);
}
}
return 0;
}
/*transmit_notify_request(sub, "aw");*/
transmit_notify_request(sub, "");
- ast_queue_control(sub->owner, AST_CONTROL_ANSWER, 1);
+ ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
}
} else {
/* Start switch */
}
/*transmit_notify_request(sub, "aw");*/
transmit_notify_request(sub, "");
- /*ast_queue_control(sub->owner, AST_CONTROL_ANSWER, 1);*/
+ /*ast_queue_control(sub->owner, AST_CONTROL_ANSWER);*/
}
}
}
if ((res = attempt_transfer(p)) < 0) {
if (p->sub->next->owner) {
sub->next->alreadygone = 1;
- ast_queue_hangup(sub->next->owner,1);
+ ast_queue_hangup(sub->next->owner);
}
} else if (res) {
ast_log(LOG_WARNING, "Transfer attempt failed\n");
/* If there is another active call, mgcp_hangup will ring the phone with the other call */
if (sub->owner) {
sub->alreadygone = 1;
- ast_queue_hangup(sub->owner, 1);
+ ast_queue_hangup(sub->owner);
} else {
/* SC: verbose level check */
if (option_verbose > 2) {
f.src = "mgcp";
if (sub->owner) {
/* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
- ast_queue_frame(sub->owner, &f, 1);
+ ast_queue_frame(sub->owner, &f);
if (sub->next->owner) {
- ast_queue_frame(sub->next->owner, &f, 1);
+ ast_queue_frame(sub->next->owner, &f);
}
}
if (strstr(p->curtone, "wt") && (ev[0] == 'A')) {
/* If we can't connect, return congestion */
if (nbs_connect(p->nbs)) {
ast_log(LOG_WARNING, "NBS Connection failed on %s\n", ast->name);
- ast_queue_control(ast, AST_CONTROL_CONGESTION, 0);
+ ast_queue_control(ast, AST_CONTROL_CONGESTION);
} else {
ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast, AST_CONTROL_ANSWER, 0);
+ ast_queue_control(ast, AST_CONTROL_ANSWER);
}
return 0;
ioctl(p->fd, PHONE_RING_START,&cid);
ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast, AST_CONTROL_RINGING, 0);
+ ast_queue_control(ast, AST_CONTROL_RINGING);
return 0;
}
}
if (pkt->owner->owner) {
/* XXX Potential deadlocK?? XXX */
- ast_queue_hangup(pkt->owner->owner, 0);
+ ast_queue_hangup(pkt->owner->owner);
ast_mutex_unlock(&pkt->owner->owner->lock);
} else {
/* If no owner, destroy now */
ast_log(LOG_DEBUG, "Auto destroying call '%s'\n", p->callid);
if (p->owner) {
ast_log(LOG_WARNING, "Autodestruct on call '%s' with owner in place\n", p->callid);
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
} else {
sip_destroy(p);
}
if (p->owner) {
if (!ast_mutex_trylock(&p->owner->lock)) {
ast_log(LOG_NOTICE, "Auto-congesting %s\n", p->owner->name);
- ast_queue_control(p->owner, AST_CONTROL_CONGESTION, 0);
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
ast_mutex_unlock(&p->owner->lock);
}
}
return res;
}
-static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, int needlock)
+static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct sip_pvt *p = newchan->pvt->pvt;
- if (needlock)
- ast_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
if (p->owner != oldchan) {
ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner);
- if (needlock)
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return -1;
}
p->owner = newchan;
- if (needlock)
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return 0;
}
if (f->subclass != p->owner->nativeformats) {
ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
p->owner->nativeformats = f->subclass;
- ast_set_read_format(p->owner, p->owner->readformat, 0);
- ast_set_write_format(p->owner, p->owner->writeformat, 0);
+ ast_set_read_format(p->owner, p->owner->readformat);
+ ast_set_write_format(p->owner, p->owner->writeformat);
}
if ((p->dtmfmode & SIP_DTMF_INBAND) && p->vad) {
- f = ast_dsp_process(p->owner,p->vad,f,0);
+ f = ast_dsp_process(p->owner,p->vad,f);
}
}
}
if (!(p->owner->nativeformats & p->jointcapability)) {
ast_log(LOG_DEBUG, "Oooh, we need to change our formats since our peer supports only %d and not %d\n", p->jointcapability, p->owner->nativeformats);
p->owner->nativeformats = sip_codec_choose(p->jointcapability);
- ast_set_read_format(p->owner, p->owner->readformat, 0);
- ast_set_write_format(p->owner, p->owner->writeformat, 0);
+ ast_set_read_format(p->owner, p->owner->readformat);
+ ast_set_write_format(p->owner, p->owner->writeformat);
}
if (p->owner->bridge) {
/* Turn on/off music on hold if we are holding/unholding */
f.offset = 0;
f.data = buf;
f.datalen = strlen(buf);
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
}
}
f.offset = 0;
f.data = NULL;
f.datalen = 0;
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
}
}
}
process_sdp(p, req);
if (p->owner) {
/* Queue a progress frame */
- ast_queue_control(p->owner, AST_CONTROL_PROGRESS, 0);
+ ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
}
}
break;
case 180:
if (p->owner) {
- ast_queue_control(p->owner, AST_CONTROL_RINGING, 0);
+ ast_queue_control(p->owner, AST_CONTROL_RINGING);
if (p->owner->_state != AST_STATE_UP)
ast_setstate(p->owner, AST_STATE_RINGING);
}
/* They got the notify, this is the end */
if (p->owner) {
ast_log(LOG_WARNING, "Notify answer on an owned channel?\n");
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
} else {
if (!p->subscribed) {
p->needdestroy = 1;
if (p->owner) {
if (p->owner->_state != AST_STATE_UP) {
ast_setstate(p->owner, AST_STATE_UP);
- ast_queue_control(p->owner, AST_CONTROL_ANSWER, 0);
+ ast_queue_control(p->owner, AST_CONTROL_ANSWER);
} else {
struct ast_frame af = { AST_FRAME_NULL, };
- ast_queue_frame(p->owner, &af, 0);
+ ast_queue_frame(p->owner, &af);
}
}
p->authtries = 0;
break;
case 501: /* Not Implemented */
if (!strcasecmp(msg, "INVITE"))
- ast_queue_control(p->owner, AST_CONTROL_CONGESTION, 0);
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
else
ast_log(LOG_WARNING, "Host '%s' does not implement '%s'\n", inet_ntoa(p->sa.sin_addr), msg);
break;
case 305: /* Use Proxy */
parse_moved_contact(p, req);
if (p->owner)
- ast_queue_control(p->owner, AST_CONTROL_BUSY, 0);
+ ast_queue_control(p->owner, AST_CONTROL_BUSY);
break;
case 487:
/* channel now destroyed - dec the inUse counter */
case 600: /* Busy everywhere */
case 603: /* Decline */
if (p->owner)
- ast_queue_control(p->owner, AST_CONTROL_BUSY, 0);
+ ast_queue_control(p->owner, AST_CONTROL_BUSY);
break;
case 480: /* Temporarily Unavailable */
case 404: /* Not Found */
case 410: /* Gone */
case 500: /* Server error */
if (owner)
- ast_queue_control(p->owner, AST_CONTROL_CONGESTION, 0);
+ ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
break;
default:
/* Send hangup */
if (owner)
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
break;
}
/* ACK on invite */
}
/* Queue NULL frame to prod ast_rtp_bridge if appropriate */
if (p->owner)
- ast_queue_frame(p->owner, &af, 0);
+ ast_queue_frame(p->owner, &af);
} else if (sipdebug)
ast_verbose("Ignoring this request\n");
if (!p->lastinvite) {
transfer_to = c->bridge;
if (transfer_to) {
ast_moh_stop(transfer_to);
- ast_async_goto(transfer_to,p->context, p->refer_to,1, 1);
+ ast_async_goto(transfer_to,p->context, p->refer_to,1);
} else {
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
}
}
p->gotrefer = 1;
ast_rtp_stop(p->vrtp);
}
if (p->owner)
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
else
p->needdestroy = 1;
if (p->initreq.len > 0) {
if (transfer_to) {
/* Don't actually hangup here... */
ast_moh_stop(transfer_to);
- ast_async_goto(transfer_to,p->context, p->refer_to,1, 1);
+ ast_async_goto(transfer_to,p->context, p->refer_to,1);
} else
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
}
} else {
ast_log(LOG_WARNING, "Invalid transfer information from '%s'\n", inet_ntoa(p->recv.sin_addr));
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
}
} else if (p->owner)
- ast_queue_hangup(p->owner, 0);
+ ast_queue_hangup(p->owner);
else
p->needdestroy = 1;
transmit_response(p, "200 OK", req);
}
if (l->dnd) {
- ast_queue_control(ast, AST_CONTROL_BUSY, 0);
+ ast_queue_control(ast, AST_CONTROL_BUSY);
return -1;
}
// Select the active softkeys
ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast, AST_CONTROL_RINGING, 0);
+ ast_queue_control(ast, AST_CONTROL_RINGING);
sub->outgoing = 1;
// sub->cxmode = SKINNY_CX_RECVONLY;
if (f->subclass != sub->owner->nativeformats) {
ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
sub->owner->nativeformats = f->subclass;
- ast_set_read_format(sub->owner, sub->owner->readformat, 0);
- ast_set_write_format(sub->owner, sub->owner->writeformat, 0);
+ ast_set_read_format(sub->owner, sub->owner->readformat);
+ ast_set_write_format(sub->owner, sub->owner->writeformat);
}
}
}
return res;
}
-static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, int needlock)
+static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct skinny_subchannel *sub = newchan->pvt->pvt;
ast_log(LOG_NOTICE, "skinny_fixup(%s, %s)\n", oldchan->name, newchan->name);
/* If there is another active call, skinny_hangup will ring the phone with the other call */
if (sub->owner) {
sub->alreadygone = 1;
- ast_queue_hangup(sub->owner, 1);
+ ast_queue_hangup(sub->owner);
} else {
ast_log(LOG_WARNING, "Skinny(%s@%s-%d) channel already destroyed\n",
sub->parent->name, sub->parent->parent->name, sub->callid);
if (sub->owner) {
/* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
- ast_queue_frame(sub->owner, &f, 1);
+ ast_queue_frame(sub->owner, &f);
if (sub->next->owner) {
- ast_queue_frame(sub->next->owner, &f, 1);
+ ast_queue_frame(sub->next->owner, &f);
}
} else {
ast_verbose("No owner: %s\n", s->device->lines->name);
// Problem is that hangup holds p->owner->lock
if (f.frametype >= 0 && f.frametype != AST_FRAME_NULL) {
if (ast_mutex_trylock(&p->owner->lock)==0) {
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
ast_mutex_unlock(&p->owner->lock);
} else {
ast_verbose("Missed event %d/%d on %s\n",
ast_verbose(VERBOSE_PREFIX_3 " VPB Calling %s [t=%d] on %s returned %d\n", s, timeout, ast->name, res);
if (res == 0) {
ast_setstate(ast, AST_STATE_RINGING);
- ast_queue_control(ast,AST_CONTROL_RINGING, 0);
+ ast_queue_control(ast,AST_CONTROL_RINGING);
}
pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
// Using trylock here to prevent deadlock when channel is hungup
// (ast_hangup() immediately gets lock)
if (p->owner && (ast_mutex_trylock(&p->owner->lock)==0) ) {
- ast_queue_frame(p->owner, fr, 0);
+ ast_queue_frame(p->owner, fr);
ast_mutex_unlock(&p->owner->lock);
if (option_verbose > 4) {
short * data = (short*)readbuf;
if (p->subs[a].owner) {
p->subs[a].owner->fds[0] = p->subs[a].zfd;
- ast_queue_frame(p->subs[a].owner, &null, 0);
+ ast_queue_frame(p->subs[a].owner, &null);
}
if (p->subs[b].owner) {
p->subs[b].owner->fds[0] = p->subs[b].zfd;
- ast_queue_frame(p->subs[b].owner, &null, 0);
+ ast_queue_frame(p->subs[b].owner, &null);
}
}
static int zt_indicate(struct ast_channel *chan, int condition);
-static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, int needlock)
+static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct zt_pvt *p = newchan->pvt->pvt;
int x;
- if (needlock)
- ast_mutex_lock(&p->lock);
+ ast_mutex_lock(&p->lock);
ast_log(LOG_DEBUG, "New owner for channel %d is %s\n", p->channel, newchan->name);
if (p->owner == oldchan)
p->owner = newchan;
if (newchan->_state == AST_STATE_RINGING)
zt_indicate(newchan, AST_CONTROL_RINGING);
update_conf(p);
- if (needlock)
- ast_mutex_unlock(&p->lock);
+ ast_mutex_unlock(&p->lock);
return 0;
}
/* It hasn't been long enough since the last flashook. This is probably a bounce on
hanging up. Hangup both channels now */
if (p->subs[SUB_THREEWAY].owner)
- ast_queue_hangup(p->subs[SUB_THREEWAY].owner, 0);
+ ast_queue_hangup(p->subs[SUB_THREEWAY].owner);
p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_log(LOG_DEBUG, "Looks like a bounced flash, hanging up both calls on %d\n", p->channel);
} else if ((ast->pbx) ||
}
if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect || p->callprogress) && !index) {
/* Perform busy detection. etc on the zap line */
- f = ast_dsp_process(ast, p->dsp, &p->subs[index].f, 0);
+ f = ast_dsp_process(ast, p->dsp, &p->subs[index].f);
if (f) {
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_BUSY)) {
if ((ast->_state == AST_STATE_UP) && !p->outgoing) {
ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name);
/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten);
- if (ast_async_goto(ast, ast->context, "fax", 1, 0))
+ if (ast_async_goto(ast, ast->context, "fax", 1))
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, ast->context);
} else
ast_log(LOG_NOTICE, "Fax detected, but no fax extension\n");
digit = e->ring.callednum[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- ast_queue_frame(pri->pvt[chan]->owner, &f, 0);
+ ast_queue_frame(pri->pvt[chan]->owner, &f);
}
}
}
if (pri->pvt[chan] && pri->overlapdial && !pri->pvt[chan]->proceeding) {
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d span %d\n",chan,pri->pvt[chan]->span);
- ast_queue_frame(pri->pvt[chan]->owner, &f, 0);
+ ast_queue_frame(pri->pvt[chan]->owner, &f);
pri->pvt[chan]->proceeding=1;
}
}
for (i=0; i<strlen(number); i++) {
struct ast_frame f = { AST_FRAME_DTMF, number[i] };
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
}
astman_send_ack(s, m, "ZapDialOffhook");
return 0;
return __ast_dsp_silence(dsp, s, len, totalsilence);
}
-struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *af, int needlock)
+struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *af)
{
int silence;
int res;
dsp->thinkdigit = 'x';
FIX_INF(af);
if (chan)
- ast_queue_frame(chan, af, needlock);
+ ast_queue_frame(chan, af);
ast_frfree(af);
return &dsp->f;
}
dsp->f.subclass = dsp->thinkdigit;
FIX_INF(af);
if (chan)
- ast_queue_frame(chan, af, needlock);
+ ast_queue_frame(chan, af);
ast_frfree(af);
}
dsp->thinkdigit = digit;
}
FIX_INF(af);
if (chan)
- ast_queue_frame(chan, af, needlock);
+ ast_queue_frame(chan, af);
ast_frfree(af);
return &dsp->f;
}
dsp->td.mf.current_digits--;
FIX_INF(af);
if (chan)
- ast_queue_frame(chan, af, needlock);
+ ast_queue_frame(chan, af);
ast_frfree(af);
return &dsp->f;
}
dsp->td.dtmf.current_digits--;
FIX_INF(af);
if (chan)
- ast_queue_frame(chan, af, needlock);
+ ast_queue_frame(chan, af);
ast_frfree(af);
return &dsp->f;
}
case AST_CONTROL_CONGESTION:
dsp->f.subclass = res;
if (chan)
- ast_queue_frame(chan, &dsp->f, needlock);
+ ast_queue_frame(chan, &dsp->f);
break;
default:
ast_log(LOG_WARNING, "Don't know how to represent call progress message %d\n", res);
ast_closestream(tmp->vstream);
if (tmp->stream) {
ast_closestream(tmp->stream);
- if (tmp->oldwriteformat && ast_set_write_format(tmp, tmp->oldwriteformat, 1))
+ if (tmp->oldwriteformat && ast_set_write_format(tmp, tmp->oldwriteformat))
ast_log(LOG_WARNING, "Unable to restore format back to %d\n", tmp->oldwriteformat);
}
return 0;
}
chan->oldwriteformat = chan->writeformat;
/* Set the channel to a format we can work with */
- res = ast_set_write_format(chan, fmts, 1);
+ res = ast_set_write_format(chan, fmts);
fd = ast_filehelper(filename2, (char *)chan, NULL, ACTION_OPEN);
if(fd >= 0)
* Set read format for channel to whichever component of "format" is best.
* Returns 0 on success, -1 on failure
*/
-int ast_set_read_format(struct ast_channel *chan, int format, int needlock);
+int ast_set_read_format(struct ast_channel *chan, int format);
//! Sets write format on channel chan
/*!
* Set write format for channel to whichever compoent of "format" is best.
* Returns 0 on success, -1 on failure
*/
-int ast_set_write_format(struct ast_channel *chan, int format, int needlock);
+int ast_set_write_format(struct ast_channel *chan, int format);
//! Sends text to a channel
/*!
and 1 if supported and requested */
int ast_transfer(struct ast_channel *chan, char *dest);
-int ast_do_masquerade(struct ast_channel *chan, int grablock);
+int ast_do_masquerade(struct ast_channel *chan);
/* Misc. functions below */
/*! Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTION */
int (*indicate)(struct ast_channel *c, int condition);
/*! Fix up a channel: If a channel is consumed, this is called. Basically update any ->owner links */
- int (*fixup)(struct ast_channel *oldchan, struct ast_channel *newchan, int lock);
+ int (*fixup)(struct ast_channel *oldchan, struct ast_channel *newchan);
/*! Set a given option */
int (*setoption)(struct ast_channel *chan, int option, void *data, int datalen);
/*! Query a given option */
/*! Returns NULL on failure to allocate */
struct ast_channel *ast_channel_alloc(int needalertpipe);
-/*! Queue an outgoing frame, locking if necessary */
-int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f, int lock);
+/*! Queue an outgoing frame */
+int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
-int ast_queue_hangup(struct ast_channel *chan, int lock);
+int ast_queue_hangup(struct ast_channel *chan);
-int ast_queue_control(struct ast_channel *chan, int control, int lock);
+int ast_queue_control(struct ast_channel *chan, int control);
/*! Change the state of a channel */
int ast_setstate(struct ast_channel *chan, int state);
/* Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on
busies, and call progress, all dependent upon which features are enabled */
-struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf, int needlock);
+struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf);
/* Return non-zero if this is silence. Updates "totalsilence" with the total
number of seconds of silence */
int ast_unlock_context(struct ast_context *con);
-int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int priority, int needlock);
+int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int priority);
int ast_async_goto_by_name(char *chan, char *context, char *exten, int priority);
{
struct playtones_state *ps = params;
if (chan) {
- ast_set_write_format(chan, ps->origwfmt, 0);
+ ast_set_write_format(chan, ps->origwfmt);
}
if (ps->items) free(ps->items);
free(ps);
return NULL;
memset(ps, 0, sizeof(struct playtones_state));
ps->origwfmt = chan->writeformat;
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1)) {
+ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", chan->name);
playtones_release(NULL, ps);
ps = NULL;
return tmp;
}
-void __ast_context_destroy(struct ast_context *con, char *registrar, int lock);
+void __ast_context_destroy(struct ast_context *con, char *registrar);
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, char *registrar) {
struct ast_context *tmp, *lasttmp = NULL;
tmp = *extcontexts;
ast_mutex_lock(&conlock);
if (registrar) {
- __ast_context_destroy(NULL,registrar,0);
+ __ast_context_destroy(NULL,registrar);
while (tmp) {
lasttmp = tmp;
tmp = tmp->next;
}
} else {
while (tmp) {
- __ast_context_destroy(tmp,tmp->registrar,0);
+ __ast_context_destroy(tmp,tmp->registrar);
lasttmp = tmp;
tmp = tmp->next;
}
return -1;
}
-int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int priority, int needlock)
+int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int priority)
{
int res = 0;
- if (needlock)
- ast_mutex_lock(&chan->lock);
+ ast_mutex_lock(&chan->lock);
if (chan->pbx) {
/* This channel is currently in the PBX */
if (context && strlen(context))
if (priority)
chan->priority = priority - 1;
ast_softhangup_nolock(chan, AST_SOFTHANGUP_ASYNCGOTO);
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
} else {
/* In order to do it when the channel doesn't really exist within
the PBX, we have to make a new channel, masquerade, and start the PBX
/* Masquerade into temp channel */
ast_channel_masquerade(tmpchan, chan);
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
/* Grab the locks and get going */
ast_mutex_lock(&tmpchan->lock);
- ast_do_masquerade(tmpchan, 0);
+ ast_do_masquerade(tmpchan);
ast_mutex_unlock(&tmpchan->lock);
/* Start the PBX going on our stolen channel */
if (ast_pbx_start(tmpchan)) {
}
} else {
res = -1;
- if (needlock)
- ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan->lock);
}
}
return res;
chan = ast_channel_walk(chan);
}
if (chan)
- return ast_async_goto(chan, context, exten, priority, 1);
+ return ast_async_goto(chan, context, exten, priority);
return -1;
}
free(e);
}
-void __ast_context_destroy(struct ast_context *con, char *registrar, int lock)
+void __ast_context_destroy(struct ast_context *con, char *registrar)
{
struct ast_context *tmp, *tmpl=NULL;
struct ast_include *tmpi, *tmpil= NULL;
struct ast_sw *sw, *swl= NULL;
struct ast_exten *e, *el, *en;
struct ast_ignorepat *ipi, *ipl = NULL;
- if (lock)
- ast_mutex_lock(&conlock);
+ ast_mutex_lock(&conlock);
tmp = contexts;
while(tmp) {
if (((tmp->name && con && con->name && !strcasecmp(tmp->name, con->name)) || !con) &&
tmpil = NULL;
continue;
}
- if (lock)
- ast_mutex_unlock(&conlock);
+ ast_mutex_unlock(&conlock);
return;
}
tmpl = tmp;
tmp = tmp->next;
}
- if (lock)
- ast_mutex_unlock(&conlock);
+ ast_mutex_unlock(&conlock);
}
void ast_context_destroy(struct ast_context *con, char *registrar)
{
- __ast_context_destroy(con,registrar,1);
+ __ast_context_destroy(con,registrar);
}
static void wait_for_hangup(struct ast_channel *chan)
ast_stopstream(chan);
- if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1)) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW)) {
ast_log(LOG_WARNING, "Unable to set write format to ULAW\n");
return -1;
}
- if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1)) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW)) {
ast_log(LOG_WARNING, "Unable to set read format to ULAW\n");
if (writeformat) {
- if (ast_set_write_format(chan, writeformat, 1))
+ if (ast_set_write_format(chan, writeformat))
ast_log(LOG_WARNING, "Unable to restore write format to %d\n", writeformat);
}
return -1;
chan->adsicpe = (chan->adsicpe & ~ADSI_FLAG_DATAMODE) | newdatamode;
if (writeformat)
- ast_set_write_format(chan, writeformat, 1);
+ ast_set_write_format(chan, writeformat);
if (readformat)
- ast_set_read_format(chan, readformat, 1);
+ ast_set_read_format(chan, readformat);
return res;
}
oldwfmt = moh->origwfmt;
free(moh);
if (chan) {
- if (oldwfmt && ast_set_write_format(chan, oldwfmt, 0))
+ if (oldwfmt && ast_set_write_format(chan, oldwfmt))
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(oldwfmt));
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Stopped music on hold on %s\n", chan->name);
ast_mutex_unlock(&moh_lock);
if (res) {
res->origwfmt = chan->writeformat;
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1)) {
+ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format\n", chan->name);
moh_release(NULL, res);
res = NULL;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Transferring %s to '%s' (context %s) priority 1\n"
,transferee->name, newext, transferer_real_context);
- if (ast_async_goto(transferee, transferer_real_context, newext, 1, 1))
+ if (ast_async_goto(transferee, transferer_real_context, newext, 1))
ast_log(LOG_WARNING, "Async goto fialed :(\n");
res = -1;
} else {
res = ast_answer(chan);
if (res)
ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);
- res = ast_queue_control(chan, AST_CONTROL_ANSWER, 0);
+ res = ast_queue_control(chan, AST_CONTROL_ANSWER);
if (res)
ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n", chan->name);
res = ast_channel_masquerade(cur, chan);