aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-06 22:17:32 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-04-06 22:17:32 +0000
commitb837107b6b89ed55e1ac5e2ef829e72275914403 (patch)
treef9360f7b870da96fcd47e19ff8c203287e906599 /channels
parent72df970e585d58cc41da5f90b28ce4676217ef0a (diff)
Get rid of all that old needlock garbage now that we're using recursive mutexes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2644 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_agent.c18
-rwxr-xr-xchannels/chan_h323.c4
-rwxr-xr-xchannels/chan_iax.c16
-rwxr-xr-xchannels/chan_iax2.c28
-rwxr-xr-xchannels/chan_local.c13
-rwxr-xr-xchannels/chan_mgcp.c26
-rwxr-xr-xchannels/chan_nbs.c4
-rwxr-xr-xchannels/chan_phone.c2
-rwxr-xr-xchannels/chan_sip.c67
-rwxr-xr-xchannels/chan_skinny.c16
-rwxr-xr-xchannels/chan_vpb.c6
-rwxr-xr-xchannels/chan_zap.c24
12 files changed, 103 insertions, 121 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 81ab35641..885c4ca60 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -137,13 +137,13 @@ static struct agent_pvt {
/* 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)
@@ -464,7 +464,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
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)));
@@ -474,7 +474,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
}
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)));
@@ -708,7 +708,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
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);
@@ -1266,12 +1266,12 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
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));
}
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index fef2fec97..484e70c92 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -923,7 +923,7 @@ int send_digit(unsigned call_reference, char digit)
f.mallocd = 0;
f.src = "SEND_DIGIT";
- return ast_queue_frame(p->owner, &f, 1);
+ return ast_queue_frame(p->owner, &f);
}
/**
@@ -1215,7 +1215,7 @@ void cleanup_connection(call_details_t cd)
/* Send hangup */
if (p->owner)
- ast_queue_hangup(p->owner, 1);
+ ast_queue_hangup(p->owner);
p = NULL;
return;
diff --git a/channels/chan_iax.c b/channels/chan_iax.c
index e85d34876..6123a1cac 100755
--- a/channels/chan_iax.c
+++ b/channels/chan_iax.c
@@ -839,10 +839,6 @@ static int iax_queue_frame(int callno, struct ast_frame *f)
/* 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 */
@@ -850,7 +846,7 @@ static int iax_queue_frame(int callno, struct ast_frame *f)
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;
}
@@ -1077,7 +1073,7 @@ retry:
/* 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) {
@@ -1516,7 +1512,7 @@ static int iax_sendhtml(struct ast_channel *c, int subclass, char *data, int dat
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;
@@ -3798,7 +3794,7 @@ retryowner:
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);
}
@@ -3981,9 +3977,9 @@ retryowner:
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);
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 7f9c2cad7..1550deea4 100755
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -851,10 +851,6 @@ static int iax2_queue_frame(int callno, struct ast_frame *f)
/* 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 */
@@ -862,7 +858,7 @@ static int iax2_queue_frame(int callno, struct ast_frame *f)
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;
}
@@ -1229,7 +1225,7 @@ static int iax2_predestroy(int callno)
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--;
@@ -1302,7 +1298,7 @@ retry:
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) {
@@ -1767,17 +1763,15 @@ static int iax2_sendhtml(struct ast_channel *c, int subclass, char *data, int da
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;
}
@@ -4366,7 +4360,7 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2)
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;
@@ -4725,7 +4719,7 @@ retryowner:
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);
}
@@ -4914,7 +4908,7 @@ retryowner:
} 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
@@ -4962,9 +4956,9 @@ retryowner2:
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);
}
}
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 0d56ec27a..81ee2e93f 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -112,7 +112,7 @@ retrylock:
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;
@@ -185,23 +185,20 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f)
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;
}
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 8cc71b289..2927e7a42 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -776,7 +776,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout)
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 */
@@ -1016,15 +1016,15 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
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);
}
}
}
@@ -1070,7 +1070,7 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
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);
@@ -1337,7 +1337,7 @@ static int rtpready(struct ast_rtp *rtp, struct ast_frame *f, void *data)
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);
}
}
@@ -2664,7 +2664,7 @@ static int attempt_transfer(struct mgcp_endpoint *p)
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;
@@ -2694,7 +2694,7 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev)
}
/*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 */
@@ -2748,7 +2748,7 @@ static void handle_hd_hf(struct mgcp_subchannel *sub, char *ev)
}
/*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);*/
}
}
}
@@ -2914,7 +2914,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
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");
@@ -2925,7 +2925,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
/* 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) {
@@ -2956,9 +2956,9 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
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')) {
diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c
index 1960acbe2..b4e5392c4 100755
--- a/channels/chan_nbs.c
+++ b/channels/chan_nbs.c
@@ -73,10 +73,10 @@ static int nbs_call(struct ast_channel *ast, char *dest, int timeout)
/* 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;
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 5ebe02192..5a36b6427 100755
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -185,7 +185,7 @@ static int phone_call(struct ast_channel *ast, char *dest, int timeout)
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;
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 3119bb130..271f547f8 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -510,7 +510,7 @@ static int retrans_pkt(void *data)
}
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 */
@@ -560,7 +560,7 @@ static int __sip_autodestruct(void *data)
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);
}
@@ -933,7 +933,7 @@ static int auto_congest(void *nothing)
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);
}
}
@@ -1381,20 +1381,17 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
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;
}
@@ -1680,11 +1677,11 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
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);
}
}
}
@@ -2139,8 +2136,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req)
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 */
@@ -4407,7 +4404,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req)
f.offset = 0;
f.data = buf;
f.datalen = strlen(buf);
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
}
}
@@ -4677,7 +4674,7 @@ static void receive_info(struct sip_pvt *p, struct sip_request *req)
f.offset = 0;
f.data = NULL;
f.datalen = 0;
- ast_queue_frame(p->owner, &f, 0);
+ ast_queue_frame(p->owner, &f);
}
}
}
@@ -5030,13 +5027,13 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
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);
}
@@ -5046,7 +5043,7 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
/* 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;
@@ -5060,10 +5057,10 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
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;
@@ -5152,7 +5149,7 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
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;
@@ -5177,7 +5174,7 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
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 */
@@ -5192,19 +5189,19 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
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 */
@@ -5401,7 +5398,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
}
/* 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) {
@@ -5543,9 +5540,9 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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;
@@ -5566,7 +5563,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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) {
@@ -5600,16 +5597,16 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
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);
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index c8309f724..ceb2d66c0 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1470,7 +1470,7 @@ static int skinny_call(struct ast_channel *ast, char *dest, int timeout)
}
if (l->dnd) {
- ast_queue_control(ast, AST_CONTROL_BUSY, 0);
+ ast_queue_control(ast, AST_CONTROL_BUSY);
return -1;
}
@@ -1495,7 +1495,7 @@ static int skinny_call(struct ast_channel *ast, char *dest, int timeout)
// 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;
@@ -1602,8 +1602,8 @@ static struct ast_frame *skinny_rtp_read(struct skinny_subchannel *sub)
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);
}
}
}
@@ -1649,7 +1649,7 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
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);
@@ -2141,7 +2141,7 @@ static int handle_message(skinny_req *req, struct skinnysession *s)
/* 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);
@@ -2175,9 +2175,9 @@ static int handle_message(skinny_req *req, struct skinnysession *s)
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);
diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c
index fb0b7b3c8..68a99778a 100755
--- a/channels/chan_vpb.c
+++ b/channels/chan_vpb.c
@@ -635,7 +635,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
// 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",
@@ -1151,7 +1151,7 @@ static int vpb_call(struct ast_channel *ast, char *dest, int timeout)
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);
@@ -1456,7 +1456,7 @@ static void *do_chanreads(void *pvt)
// 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;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 7617478f9..7cf148145 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -640,11 +640,11 @@ static void swap_subs(struct zt_pvt *p, int a, int b)
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);
}
}
@@ -2554,12 +2554,11 @@ static int zt_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags,
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;
@@ -2572,8 +2571,7 @@ static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, in
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;
}
@@ -2930,7 +2928,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
/* 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) ||
@@ -3666,7 +3664,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
}
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) {
@@ -3713,7 +3711,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
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");
@@ -6365,7 +6363,7 @@ static void *pri_dchannel(void *vpri)
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);
}
}
}
@@ -6473,7 +6471,7 @@ static void *pri_dchannel(void *vpri)
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;
}
@@ -7304,7 +7302,7 @@ static int action_zapdialoffhook(struct mansession *s, struct message *m)
}
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;