aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-22 16:29:54 +0000
committermvanbaak <mvanbaak@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-22 16:29:54 +0000
commitc1210321e7aeb274076b14fc2f622edf442246fa (patch)
treebcbbf4eda53cdb8257bbc7add4616e01e31b1ae2 /apps
parent2d9ba021dd38039616c82a4e317f652abe246ba3 (diff)
- revert change to ast_queue_hangup and create ast_queue_hangup_with_cause
- make data member of the ast_frame struct a named union instead of a void Recently the ast_queue_hangup function got a new parameter, the hangupcause Feedback came in that this is no good and that instead a new function should be created. This I did. The hangupcause was stored in the seqno member of the ast_frame struct. This is not very elegant, and since there's already a data member that one should be used. Problem is, this member was a void *. Now it's a named union so it can hold a pointer, an uint32 and there's a padding in case someone wants to store another type in there in the future. This commit is so massive, because all ast_frame.data uses have to be altered to ast_frame.data.data Thanks russellb and kpfleming for the feedback. (closes issue #12674) Reported by: mvanbaak git-svn-id: http://svn.digium.com/svn/asterisk/trunk@117802 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_alarmreceiver.c6
-rw-r--r--apps/app_chanspy.c2
-rw-r--r--apps/app_dial.c11
-rw-r--r--apps/app_disa.c4
-rw-r--r--apps/app_externalivr.c4
-rw-r--r--apps/app_festival.c2
-rw-r--r--apps/app_followme.c4
-rw-r--r--apps/app_ices.c2
-rw-r--r--apps/app_meetme.c4
-rw-r--r--apps/app_milliwatt.c2
-rw-r--r--apps/app_mp3.c2
-rw-r--r--apps/app_nbscat.c2
-rw-r--r--apps/app_queue.c5
-rw-r--r--apps/app_sms.c4
-rw-r--r--apps/app_speech_utils.c2
-rw-r--r--apps/app_test.c2
-rw-r--r--apps/app_zapbarge.c4
-rw-r--r--apps/app_zapscan.c4
18 files changed, 34 insertions, 32 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index 5230681f2..37d817742 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -185,7 +185,7 @@ static int send_tone_burst(struct ast_channel *chan, float freq, int duration, i
wf.subclass = AST_FORMAT_ULAW;
wf.offset = AST_FRIENDLY_OFFSET;
wf.mallocd = 0;
- wf.data = tone_block.buf;
+ wf.data.ptr = tone_block.buf;
wf.datalen = f->datalen;
wf.samples = wf.datalen;
@@ -252,8 +252,8 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
/* If they hung up, leave */
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
- if (f->seqno) {
- chan->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ chan->hangupcause = f->data.uint32;
}
ast_frfree(f);
res = -1;
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 75d485123..f6886347d 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -263,7 +263,7 @@ static int spy_generate(struct ast_channel *chan, void *data, int len, int sampl
}
if (csth->fd)
- write(csth->fd, f->data, f->datalen);
+ write(csth->fd, f->data.ptr, f->datalen);
ast_frfree(f);
diff --git a/apps/app_dial.c b/apps/app_dial.c
index d72a85411..105bce60d 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -765,7 +765,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
}
break;
case AST_FRAME_HTML:
- if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1) {
+ if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data.ptr, f->datalen) == -1) {
ast_log(LOG_WARNING, "Unable to send URL\n");
}
break;
@@ -789,8 +789,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
strcpy(pa->status, "CANCEL");
ast_cdr_noanswer(in->cdr);
if (f) {
- if (f->seqno)
- in->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ in->hangupcause = f->data.uint32;
+ }
ast_frfree(f);
}
return NULL;
@@ -824,7 +825,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
/* Forward HTML stuff */
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
- if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data, f->datalen) == -1)
+ if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data.ptr, f->datalen) == -1)
ast_log(LOG_WARNING, "Unable to send URL\n");
if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END))) {
@@ -837,7 +838,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
(f->subclass == AST_CONTROL_VIDUPDATE) ||
(f->subclass == AST_CONTROL_SRCUPDATE))) {
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
- ast_indicate_data(outgoing->chan, f->subclass, f->data, f->datalen);
+ ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
}
ast_frfree(f);
}
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 53bcc2c99..b624a426a 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -195,8 +195,8 @@ static int disa_exec(struct ast_channel *chan, void *data)
}
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
- if (f->seqno)
- chan->hangupcause = f->seqno;
+ if (f->data.uint32)
+ chan->hangupcause = f->data.uint32;
ast_frfree(f);
ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
return -1;
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c
index a7369602a..7d802579a 100644
--- a/apps/app_externalivr.c
+++ b/apps/app_externalivr.c
@@ -630,8 +630,8 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
send_eivr_event(eivr_events, 'H', NULL, chan);
- if (f->seqno) {
- chan->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ chan->hangupcause = f->data.uint32;
}
ast_frfree(f);
res = -1;
diff --git a/apps/app_festival.c b/apps/app_festival.c
index 096b34c25..42b71fb76 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -218,7 +218,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
myf.f.samples = res / 2;
myf.f.offset = AST_FRIENDLY_OFFSET;
myf.f.src = __PRETTY_FUNCTION__;
- myf.f.data = myf.frdata;
+ myf.f.data.ptr = myf.frdata;
if (ast_write(chan, &myf.f) < 0) {
res = -1;
ast_frfree(f);
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 35ce6f749..e582cc5df 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -607,8 +607,8 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
switch(f->subclass) {
case AST_CONTROL_HANGUP:
ast_verb(3, "%s received a hangup frame.\n", winner->name);
- if (f->seqno) {
- winner->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ winner->hangupcause = f->data.uint32;
}
if (dg == 0) {
ast_verb(3, "The calling channel hungup. Need to drop everyone else.\n");
diff --git a/apps/app_ices.c b/apps/app_ices.c
index 0a011b3b3..7a4c9f18f 100644
--- a/apps/app_ices.c
+++ b/apps/app_ices.c
@@ -157,7 +157,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
break;
}
if (f->frametype == AST_FRAME_VOICE) {
- res = write(fds[1], f->data, f->datalen);
+ res = write(fds[1], f->data.ptr, f->datalen);
if (res < 0) {
if (errno != EAGAIN) {
ast_log(LOG_WARNING, "Write failed to pipe: %s\n", strerror(errno));
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index ff52323aa..08e2fb56e 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -2342,7 +2342,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
to write out all the samples.
*/
if (user->talking)
- careful_write(fd, f->data, f->datalen, 0);
+ careful_write(fd, f->data.ptr, f->datalen, 0);
}
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
char tmp[2];
@@ -2566,7 +2566,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
fr.subclass = AST_FORMAT_SLINEAR;
fr.datalen = res;
fr.samples = res / 2;
- fr.data = buf;
+ fr.data.ptr = buf;
fr.offset = AST_FRIENDLY_OFFSET;
if (!user->listen.actual &&
((confflags & CONFFLAG_MONITOR) ||
diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c
index 754faa555..cf6b1f5ee 100644
--- a/apps/app_milliwatt.c
+++ b/apps/app_milliwatt.c
@@ -61,9 +61,9 @@ static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int
.frametype = AST_FRAME_VOICE,
.subclass = AST_FORMAT_ULAW,
.offset = AST_FRIENDLY_OFFSET,
- .data = buf + AST_FRIENDLY_OFFSET,
.src = __FUNCTION__,
};
+ wf.data.ptr = buf + AST_FRIENDLY_OFFSET;
/* Instead of len, use samples, because channel.c generator_force
* generate(chan, tmp, 0, 160) ignores len. In any case, len is
diff --git a/apps/app_mp3.c b/apps/app_mp3.c
index 33bee620a..23db94fbc 100644
--- a/apps/app_mp3.c
+++ b/apps/app_mp3.c
@@ -167,7 +167,7 @@ static int mp3_exec(struct ast_channel *chan, void *data)
myf.f.src = __PRETTY_FUNCTION__;
myf.f.delivery.tv_sec = 0;
myf.f.delivery.tv_usec = 0;
- myf.f.data = myf.frdata;
+ myf.f.data.ptr = myf.frdata;
if (ast_write(chan, &myf.f) < 0) {
res = -1;
break;
diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c
index f47129674..5bc920f50 100644
--- a/apps/app_nbscat.c
+++ b/apps/app_nbscat.c
@@ -150,7 +150,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
myf.f.src = __PRETTY_FUNCTION__;
myf.f.delivery.tv_sec = 0;
myf.f.delivery.tv_usec = 0;
- myf.f.data = myf.frdata;
+ myf.f.data.ptr = myf.frdata;
if (ast_write(chan, &myf.f) < 0) {
res = -1;
break;
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 904aebd6d..8bbf733dd 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2669,8 +2669,9 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
/* Got hung up */
*to = -1;
if (f) {
- if (f->seqno)
- in->hangupcause = f->seqno;
+ if (f->data.uint32) {
+ in->hangupcause = f->data.uint32;
+ }
ast_frfree(f);
}
return NULL;
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 0272468d6..e09bf5942 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -1501,7 +1501,7 @@ static int sms_generate(struct ast_channel *chan, void *data, int len, int sampl
f.datalen = samples * sizeof(*buf);
f.offset = AST_FRIENDLY_OFFSET;
f.mallocd = 0;
- f.data = buf;
+ f.data.ptr = buf;
f.samples = samples;
f.src = "app_sms";
/* create a buffer containing the digital sms pattern */
@@ -1905,7 +1905,7 @@ static int sms_exec(struct ast_channel *chan, void *data)
break;
}
if (f->frametype == AST_FRAME_VOICE) {
- sms_process(&h, f->samples, f->data);
+ sms_process(&h, f->samples, f->data.ptr);
}
ast_frfree(f);
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 5082478af..568c01bc3 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -647,7 +647,7 @@ static int speech_background(struct ast_channel *chan, void *data)
}
/* Write audio frame out to speech engine if no DTMF has been received */
if (!strlen(dtmf) && f != NULL && f->frametype == AST_FRAME_VOICE) {
- ast_speech_write(speech, f->data, f->datalen);
+ ast_speech_write(speech, f->data.ptr, f->datalen);
}
break;
case AST_SPEECH_STATE_WAIT:
diff --git a/apps/app_test.c b/apps/app_test.c
index e13dc865f..e873777e4 100644
--- a/apps/app_test.c
+++ b/apps/app_test.c
@@ -84,7 +84,7 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who)
break;
}
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
- foo = (short *)f->data;
+ foo = (short *)f->data.ptr;
for (x=0;x<f->samples;x++) {
noise += abs(foo[x]);
samples++;
diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c
index bb8c4cbb3..892dd1ec0 100644
--- a/apps/app_zapbarge.c
+++ b/apps/app_zapbarge.c
@@ -207,7 +207,7 @@ zapretry:
if (f->frametype == AST_FRAME_VOICE) {
if (f->subclass == AST_FORMAT_ULAW) {
/* Carefully write */
- careful_write(fd, f->data, f->datalen);
+ careful_write(fd, f->data.ptr, f->datalen);
} else
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass);
}
@@ -221,7 +221,7 @@ zapretry:
fr.subclass = AST_FORMAT_ULAW;
fr.datalen = res;
fr.samples = res;
- fr.data = buf;
+ fr.data.ptr = buf;
fr.offset = AST_FRIENDLY_OFFSET;
if (ast_write(chan, &fr) < 0) {
ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));
diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c
index 2f46f52dd..372467572 100644
--- a/apps/app_zapscan.c
+++ b/apps/app_zapscan.c
@@ -231,7 +231,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
if (f->frametype == AST_FRAME_VOICE) {
if (f->subclass == AST_FORMAT_ULAW) {
/* Carefully write */
- careful_write(fd, f->data, f->datalen);
+ careful_write(fd, f->data.ptr, f->datalen);
} else {
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass);
}
@@ -246,7 +246,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags)
fr.subclass = AST_FORMAT_ULAW;
fr.datalen = res;
fr.samples = res;
- fr.data = buf;
+ fr.data.ptr = buf;
fr.offset = AST_FRIENDLY_OFFSET;
if (ast_write(chan, &fr) < 0) {
ast_log(LOG_WARNING, "Unable to write frame to channel: %s\n", strerror(errno));