mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
- 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: https://origsvn.digium.com/svn/asterisk/trunk@117802 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -377,7 +377,7 @@ static int alsa_write(struct ast_channel *chan, struct ast_frame *f)
|
||||
ast_log(LOG_WARNING, "Frame too large\n");
|
||||
res = -1;
|
||||
} else {
|
||||
memcpy(sizbuf + sizpos, f->data, f->datalen);
|
||||
memcpy(sizbuf + sizpos, f->data.ptr, f->datalen);
|
||||
len += f->datalen;
|
||||
pos = 0;
|
||||
state = snd_pcm_state(alsa.ocard);
|
||||
@@ -426,7 +426,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
||||
f.subclass = 0;
|
||||
f.samples = 0;
|
||||
f.datalen = 0;
|
||||
f.data = NULL;
|
||||
f.data.ptr = NULL;
|
||||
f.offset = 0;
|
||||
f.src = "Console";
|
||||
f.mallocd = 0;
|
||||
@@ -471,7 +471,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
||||
f.subclass = AST_FORMAT_SLINEAR;
|
||||
f.samples = FRAME_SIZE;
|
||||
f.datalen = FRAME_SIZE * 2;
|
||||
f.data = buf;
|
||||
f.data.ptr = buf;
|
||||
f.offset = AST_FRIENDLY_OFFSET;
|
||||
f.src = "Console";
|
||||
f.mallocd = 0;
|
||||
@@ -718,14 +718,14 @@ static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||
}
|
||||
|
||||
text2send[strlen(text2send) - 1] = '\n';
|
||||
f.data = text2send;
|
||||
f.data.ptr = text2send;
|
||||
f.datalen = strlen(text2send) + 1;
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
f.frametype = AST_FRAME_CONTROL;
|
||||
f.subclass = AST_CONTROL_ANSWER;
|
||||
f.data = NULL;
|
||||
f.data.ptr = NULL;
|
||||
f.datalen = 0;
|
||||
ast_queue_frame(alsa.owner, &f);
|
||||
ast_channel_unlock(alsa.owner);
|
||||
@@ -765,7 +765,7 @@ static char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
|
||||
hookstate = 0;
|
||||
grab_owner();
|
||||
if (alsa.owner) {
|
||||
ast_queue_hangup(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
|
||||
ast_queue_hangup_with_cause(alsa.owner, AST_CAUSE_NORMAL_CLEARING);
|
||||
ast_channel_unlock(alsa.owner);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user