aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-03-27 06:50:12 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-03-27 06:50:12 +0000
commit5acf40987d242dc3f7c9329b8b9b61b3e512113a (patch)
tree8787e6295801bf6156269a895cc43bd31aaab412 /apps
parentf23e53be88380f4dde772c5fd4c336271d01ebc4 (diff)
Make read/write mode have a lock parameter and use it properly.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2572 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_agi.c8
-rwxr-xr-xapps/app_disa.c4
-rwxr-xr-xapps/app_echo.c6
-rwxr-xr-xapps/app_festival.c4
-rwxr-xr-xapps/app_intercom.c4
-rwxr-xr-xapps/app_meetme.c8
-rwxr-xr-xapps/app_milliwatt.c4
-rwxr-xr-xapps/app_mp3.c4
-rwxr-xr-xapps/app_qcall.c4
-rwxr-xr-xapps/app_record.c4
-rwxr-xr-xapps/app_voicemail.c8
-rwxr-xr-xapps/app_zapbarge.c4
-rwxr-xr-xapps/app_zapscan.c4
13 files changed, 34 insertions, 32 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c
index 529fbe2e1..e2cdd0ebc 100755
--- a/apps/app_agi.c
+++ b/apps/app_agi.c
@@ -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);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
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);
+ res = ast_set_read_format(chan, rfmt, 1);
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)) {
+ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1)) {
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)) {
+ if (ast_set_read_format(chan, readformat, 1)) {
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(readformat));
}
}
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 26676d4bb..a518cb7e1 100755
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -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))
+ if (ast_set_write_format(chan,AST_FORMAT_ULAW, 1))
{
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))
+ if (ast_set_read_format(chan,AST_FORMAT_ULAW, 1))
{
ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n",chan->name);
return -1;
diff --git a/apps/app_echo.c b/apps/app_echo.c
index 27ba0d86f..7de30008b 100755
--- a/apps/app_echo.c
+++ b/apps/app_echo.c
@@ -45,13 +45,15 @@ 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));
- ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
+ ast_set_write_format(chan, ast_best_codec(chan->nativeformats), 1);
+ ast_set_read_format(chan, ast_best_codec(chan->nativeformats), 1);
/* Do our thing here */
while(ast_waitfor(chan, -1) > -1) {
f = ast_read(chan);
if (!f)
break;
+ f->delivery.tv_sec = 0;
+ f->delivery.tv_usec = 0;
if (f->frametype == AST_FRAME_VOICE) {
if (ast_write(chan, f))
break;
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 337de43b6..702fdd8e6 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -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);
+ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1);
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);
+ ast_set_write_format(chan, owriteformat, 1);
return res;
}
diff --git a/apps/app_intercom.c b/apps/app_intercom.c
index 925ea37c2..96219deec 100755
--- a/apps/app_intercom.c
+++ b/apps/app_intercom.c
@@ -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);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
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);
+ ast_set_read_format(chan, oreadformat, 1);
return res;
}
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index b7d488ad0..ad58809b3 100755
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -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) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1) < 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) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1) < 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) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 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) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}
diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c
index 78f0604ce..03c2050a7 100755
--- a/apps/app_milliwatt.c
+++ b/apps/app_milliwatt.c
@@ -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);
- ast_set_read_format(chan, AST_FORMAT_ULAW);
+ ast_set_write_format(chan, AST_FORMAT_ULAW, 1);
+ ast_set_read_format(chan, AST_FORMAT_ULAW, 1);
if (chan->_state != AST_STATE_UP)
{
ast_answer(chan);
diff --git a/apps/app_mp3.c b/apps/app_mp3.c
index d050d5896..7f7d31849 100755
--- a/apps/app_mp3.c
+++ b/apps/app_mp3.c
@@ -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);
+ res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 1);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
return -1;
@@ -190,7 +190,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);
+ ast_set_write_format(chan, owriteformat, 1);
return res;
}
diff --git a/apps/app_qcall.c b/apps/app_qcall.c
index e876f0ae3..879b1c8ad 100755
--- a/apps/app_qcall.c
+++ b/apps/app_qcall.c
@@ -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);
- ast_set_write_format(channel,AST_FORMAT_SLINEAR);
+ ast_set_read_format(channel,AST_FORMAT_SLINEAR, 1);
+ ast_set_write_format(channel,AST_FORMAT_SLINEAR, 1);
#ifdef OURCLID
if (channel->callerid)
free(channel->callerid);
diff --git a/apps/app_record.c b/apps/app_record.c
index 80dd1da89..81a7704e8 100755
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -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);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
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);
+ res = ast_set_read_format(chan, rfmt, 1);
if (res)
ast_log(LOG_WARNING, "Unable to restore read format on '%s'\n", chan->name);
if (sildet)
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index fdf6208d9..5e562e333 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1028,7 +1028,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);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
@@ -1161,7 +1161,7 @@ static int play_and_prepend(struct ast_channel *chan, char *playfile, char *reco
}
}
if (rfmt) {
- if (ast_set_read_format(chan, rfmt)) {
+ if (ast_set_read_format(chan, rfmt, 1)) {
ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
}
}
@@ -1239,7 +1239,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);
+ res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 1);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n");
return -1;
@@ -1344,7 +1344,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)) {
+ if (ast_set_read_format(chan, rfmt, 1)) {
ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(rfmt), chan->name);
}
}
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index 0b865df5b..1c03afc0b 100755
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -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) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 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) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}
diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c
index b24fe5d57..ef7ac4215 100755
--- a/apps/app_zapscan.c
+++ b/apps/app_zapscan.c
@@ -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) < 0) {
+ if (ast_set_write_format(chan, AST_FORMAT_ULAW, 1) < 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) < 0) {
+ if (ast_set_read_format(chan, AST_FORMAT_ULAW, 1) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read ulaw mode\n", chan->name);
goto outrun;
}