Get rid of all that old needlock garbage now that we're using recursive mutexes
authorMark Spencer <markster@digium.com>
Tue, 6 Apr 2004 22:17:32 +0000 (22:17 +0000)
committerMark Spencer <markster@digium.com>
Tue, 6 Apr 2004 22:17:32 +0000 (22:17 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2644 65c4cc65-6c06-0410-ace0-fbb531ad65f3

40 files changed:
app.c
apps/app_agi.c
apps/app_disa.c
apps/app_echo.c
apps/app_festival.c
apps/app_ices.c
apps/app_intercom.c
apps/app_meetme.c
apps/app_milliwatt.c
apps/app_mp3.c
apps/app_nbscat.c
apps/app_qcall.c
apps/app_record.c
apps/app_voicemail.c
apps/app_zapbarge.c
apps/app_zapscan.c
channel.c
channels/chan_agent.c
channels/chan_h323.c
channels/chan_iax.c
channels/chan_iax2.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_nbs.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_vpb.c
channels/chan_zap.c
dsp.c
file.c
include/asterisk/channel.h
include/asterisk/channel_pvt.h
include/asterisk/dsp.h
include/asterisk/pbx.h
indications.c
pbx.c
res/res_adsi.c
res/res_musiconhold.c
res/res_parking.c

diff --git a/app.c b/app.c
index 32a5f42..4c4cfab 100755 (executable)
--- a/app.c
+++ b/app.c
@@ -86,7 +86,7 @@ int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prom
                        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;
@@ -135,7 +135,7 @@ int ast_app_getvoice(struct ast_channel *c, char *dest, char *dstfmt, char *prom
                        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);
index e2cdd0e..529fbe2 100755 (executable)
@@ -521,7 +521,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
 
         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;
@@ -633,7 +633,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
                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);
@@ -1484,13 +1484,13 @@ static int eagi_exec(struct ast_channel *chan, void *data)
        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));
                }
        }
index a518cb7..26676d4 100755 (executable)
@@ -129,12 +129,12 @@ static int disa_exec(struct ast_channel *chan, void *data)
        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;
index 7de3000..42355a2 100755 (executable)
@@ -45,8 +45,8 @@ static int echo_exec(struct ast_channel *chan, void *data)
        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);
index 702fdd8..337de43 100755 (executable)
@@ -158,7 +158,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
        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;
@@ -230,7 +230,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
 //     if (pid > -1)
 //             kill(pid, SIGKILL);
        if (!res && owriteformat)
-               ast_set_write_format(chan, owriteformat, 1);
+               ast_set_write_format(chan, owriteformat);
        return res;
 }
 
index 27abab8..294ecc6 100755 (executable)
@@ -113,7 +113,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
        }
 
        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]);
@@ -164,7 +164,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
        if (pid > -1)
                kill(pid, SIGKILL);
        if (!res && oreadformat)
-               ast_set_read_format(chan, oreadformat, 0);
+               ast_set_read_format(chan, oreadformat);
        return res;
 }
 
index 96219de..925ea37 100755 (executable)
@@ -138,7 +138,7 @@ static int intercom_exec(struct ast_channel *chan, void *data)
        /* 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;
@@ -170,7 +170,7 @@ static int intercom_exec(struct ast_channel *chan, void *data)
        }
        LOCAL_USER_REMOVE(u);
        if (!res)
-               ast_set_read_format(chan, oreadformat, 1);
+               ast_set_read_format(chan, oreadformat);
        return res;
 }
 
index ad58809..b7d488a 100755 (executable)
@@ -274,25 +274,25 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
 
        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;
                }
index 03c2050..78f0604 100755 (executable)
@@ -104,8 +104,8 @@ static int milliwatt_exec(struct ast_channel *chan, void *data)
 
        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);
index 2ada2ab..aee0479 100755 (executable)
@@ -126,7 +126,7 @@ static int mp3_exec(struct ast_channel *chan, void *data)
        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;
@@ -192,7 +192,7 @@ static int mp3_exec(struct ast_channel *chan, void *data)
        if (pid > -1)
                kill(pid, SIGKILL);
        if (!res && owriteformat)
-               ast_set_write_format(chan, owriteformat, 1);
+               ast_set_write_format(chan, owriteformat);
        return res;
 }
 
index 3499f55..ed5116d 100755 (executable)
@@ -109,7 +109,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
        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;
@@ -175,7 +175,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
        if (pid > -1)
                kill(pid, SIGKILL);
        if (!res && owriteformat)
-               ast_set_write_format(chan, owriteformat, 0);
+               ast_set_write_format(chan, owriteformat);
        return res;
 }
 
index 879b1c8..e876f0a 100755 (executable)
@@ -219,8 +219,8 @@ time_t      t;
        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);
index 81a7704..80dd1da 100755 (executable)
@@ -141,7 +141,7 @@ static int record_exec(struct ast_channel *chan, void *data)
 
                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;
@@ -223,7 +223,7 @@ static int record_exec(struct ast_channel *chan, void *data)
 
        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)
index 252fdb2..d0ba1d5 100755 (executable)
@@ -1029,7 +1029,7 @@ static int play_and_prepend(struct ast_channel *chan, char *playfile, char *reco
        
        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;
@@ -1162,7 +1162,7 @@ static int play_and_prepend(struct ast_channel *chan, char *playfile, char *reco
                }
        }
        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);
                }
        }
@@ -1240,7 +1240,7 @@ static int play_and_record(struct ast_channel *chan, char *playfile, char *recor
        
        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;
@@ -1345,7 +1345,7 @@ static int play_and_record(struct ast_channel *chan, char *playfile, char *recor
                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);
                }
        }
index 1c03afc..0b865df 100755 (executable)
@@ -93,13 +93,13 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
        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;
        }
index ef7ac42..b24fe5d 100755 (executable)
@@ -93,13 +93,13 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
         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;
         }
index c26bb67..77b0fc8 100755 (executable)
--- a/channel.c
+++ b/channel.c
@@ -360,7 +360,7 @@ struct ast_channel *ast_channel_alloc(int needqueue)
        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;
@@ -372,8 +372,7 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int lock)
                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) {
@@ -389,8 +388,7 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int lock)
                } 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;
                }
        }
@@ -409,23 +407,22 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, int lock)
        } 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)
@@ -595,7 +592,7 @@ int ast_softhangup_nolock(struct ast_channel *chan, int cause)
                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);
@@ -630,7 +627,7 @@ int ast_hangup(struct ast_channel *chan)
           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");
        }
 
@@ -855,7 +852,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
                        }
                }
                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);
@@ -1057,7 +1054,7 @@ struct ast_frame *ast_read(struct ast_channel *chan)
        
        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
@@ -1418,7 +1415,7 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
        }
        /* 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;
@@ -1514,14 +1511,13 @@ int ast_write(struct ast_channel *chan, struct ast_frame *fr)
        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;
        
@@ -1529,8 +1525,7 @@ int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
        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;
        }
        
@@ -1545,19 +1540,17 @@ int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
        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 */
@@ -1565,8 +1558,7 @@ int ast_set_read_format(struct ast_channel *chan, int fmts, int needlock)
        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;
        }
        
@@ -1582,8 +1574,7 @@ int ast_set_read_format(struct ast_channel *chan, int fmts, int needlock)
        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;
 }
 
@@ -1952,13 +1943,13 @@ int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *pe
                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;
@@ -1972,13 +1963,13 @@ int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *pe
                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;
@@ -2005,8 +1996,8 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
        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;
 }
@@ -2019,7 +2010,7 @@ void ast_change_name(struct ast_channel *chan, char *newname)
        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;
@@ -2044,9 +2035,8 @@ int ast_do_masquerade(struct ast_channel *original, int needlock)
           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);
 
@@ -2107,7 +2097,7 @@ int ast_do_masquerade(struct ast_channel *original, int needlock)
 
 
        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);
        }
@@ -2117,8 +2107,7 @@ int ast_do_masquerade(struct ast_channel *original, int needlock)
                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;
        }
        
@@ -2185,20 +2174,21 @@ int ast_do_masquerade(struct ast_channel *original, int needlock)
        /* 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
@@ -2210,15 +2200,13 @@ int ast_do_masquerade(struct ast_channel *original, int needlock)
           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 */
@@ -2484,7 +2472,7 @@ static void tonepair_release(struct ast_channel *chan, void *params)
 {
        struct tonepair_state *ts = params;
        if (chan) {
-               ast_set_write_format(chan, ts->origwfmt, 0);
+               ast_set_write_format(chan, ts->origwfmt);
        }
        free(ts);
 }
@@ -2498,7 +2486,7 @@ static void * tonepair_alloc(struct ast_channel *chan, void *params)
                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;
index 81ab356..885c4ca 100755 (executable)
@@ -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));
                                                }
index fef2fec..484e70c 100755 (executable)
@@ -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; 
index e85d348..6123a1c 100755 (executable)
@@ -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);
index 7f9c2ca..1550dee 100755 (executable)
@@ -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);
                                                }
                                        }
index 0d56ec2..81ee2e9 100755 (executable)
@@ -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;
 }
 
index 8cc71b2..2927e7a 100755 (executable)
@@ -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')) {
index 1960acb..b4e5392 100755 (executable)
@@ -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;
index 5ebe021..5a36b64 100755 (executable)
@@ -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;
 }
 
index 3119bb1..271f547 100755 (executable)
@@ -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);
index c8309f7..ceb2d66 100755 (executable)
@@ -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);
index fb0b7b3..68a9977 100755 (executable)
@@ -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;
index 7617478..7cf1481 100755 (executable)
@@ -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;
diff --git a/dsp.c b/dsp.c
index a0f73f4..dc45309 100755 (executable)
--- a/dsp.c
+++ b/dsp.c
@@ -1416,7 +1416,7 @@ int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence)
        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;
@@ -1508,7 +1508,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                                        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;
                                }
@@ -1525,7 +1525,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                                                        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;
@@ -1547,7 +1547,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                                                }
                                                FIX_INF(af);
                                                if (chan)
-                                                       ast_queue_frame(chan, af, needlock);
+                                                       ast_queue_frame(chan, af);
                                                ast_frfree(af);
                                                return &dsp->f;
                                        }
@@ -1564,7 +1564,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                                        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;
                                }
@@ -1577,7 +1577,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                                        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;
                                }
@@ -1596,7 +1596,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
                        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);
diff --git a/file.c b/file.c
index 578b1fe..9cdaec5 100755 (executable)
--- a/file.c
+++ b/file.c
@@ -166,7 +166,7 @@ int ast_stopstream(struct ast_channel *tmp)
                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;
@@ -464,7 +464,7 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, char *filename,
        }
        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)
index dea3708..aea8cbc 100755 (executable)
@@ -572,7 +572,7 @@ int ast_prod(struct ast_channel *chan);
  * 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
 /*! 
@@ -581,7 +581,7 @@ int ast_set_read_format(struct ast_channel *chan, int format, int needlock);
  * 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
 /*! 
@@ -777,7 +777,7 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data),
    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 */
 
index 9de8754..97a48f9 100755 (executable)
@@ -60,7 +60,7 @@ struct ast_channel_pvt {
        /*! 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 */
@@ -75,12 +75,12 @@ struct ast_channel_pvt {
 /*! 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);
index e3624a3..2f28c5d 100755 (executable)
@@ -45,7 +45,7 @@ int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone);
 
 /* 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  */
index 9beb566..ba7507a 100755 (executable)
@@ -481,7 +481,7 @@ int ast_lock_context(struct ast_context *con);
 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);
 
index 5a6a8b9..fefec91 100755 (executable)
@@ -58,7 +58,7 @@ static void playtones_release(struct ast_channel *chan, void *params)
 {
        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);
@@ -72,7 +72,7 @@ static void * playtones_alloc(struct ast_channel *chan, void *params)
                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;
diff --git a/pbx.c b/pbx.c
index 47f7853..cb7c644 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -2842,21 +2842,21 @@ struct ast_context *ast_context_create(struct ast_context **extcontexts, char *n
        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;
                }
@@ -3517,11 +3517,10 @@ int ast_add_extension(char *context, int replace, char *extension, int priority,
        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))
@@ -3531,8 +3530,7 @@ int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int pri
                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
@@ -3562,12 +3560,11 @@ int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int pri
                        /* 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)) {
@@ -3577,8 +3574,7 @@ int ast_async_goto(struct ast_channel *chan, char *context, char *exten, int pri
                        }
                } else {
                        res = -1;
-                       if (needlock)
-                               ast_mutex_unlock(&chan->lock);
+                       ast_mutex_unlock(&chan->lock);
                }
        }
        return res;
@@ -3594,7 +3590,7 @@ int ast_async_goto_by_name(char *channame, char *context, char *exten, int prior
                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;
 }
 
@@ -4087,15 +4083,14 @@ static void destroy_exten(struct ast_exten *e)
        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) &&
@@ -4150,20 +4145,18 @@ void __ast_context_destroy(struct ast_context *con, char *registrar, int lock)
                                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)
index e237189..c581e7a 100755 (executable)
@@ -367,15 +367,15 @@ int adsi_transmit_message(struct ast_channel *chan, unsigned char *msg, int msgl
 
        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;
@@ -385,9 +385,9 @@ int adsi_transmit_message(struct ast_channel *chan, unsigned char *msg, int msgl
                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;
 }
index febdaaa..d0c1b64 100755 (executable)
@@ -397,7 +397,7 @@ static void moh_release(struct ast_channel *chan, void *data)
        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);
@@ -420,7 +420,7 @@ static void *moh_alloc(struct ast_channel *chan, void *params)
        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;
index 000defe..2808348 100755 (executable)
@@ -378,7 +378,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, int allo
                                                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 {
@@ -736,7 +736,7 @@ int ast_pickup_call(struct ast_channel *chan)
                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);