Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
6a50e7a031
commit
d8e0c58437
|
@ -191,7 +191,7 @@ static int send_tone_burst(struct ast_channel *chan, float freq, int duration, i
|
||||||
|
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
wf.frametype = AST_FRAME_VOICE;
|
wf.frametype = AST_FRAME_VOICE;
|
||||||
wf.subclass = AST_FORMAT_ULAW;
|
wf.subclass.codec = AST_FORMAT_ULAW;
|
||||||
wf.offset = AST_FRIENDLY_OFFSET;
|
wf.offset = AST_FRIENDLY_OFFSET;
|
||||||
wf.mallocd = 0;
|
wf.mallocd = 0;
|
||||||
wf.data.ptr = tone_block.buf;
|
wf.data.ptr = tone_block.buf;
|
||||||
|
@ -260,7 +260,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If they hung up, leave */
|
/* If they hung up, leave */
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
|
||||||
if (f->data.uint32) {
|
if (f->data.uint32) {
|
||||||
chan->hangupcause = f->data.uint32;
|
chan->hangupcause = f->data.uint32;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
digit_string[i++] = f->subclass; /* save digit */
|
digit_string[i++] = f->subclass.integer; /* save digit */
|
||||||
|
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
|
||||||
AST_APP_ARG(argMaximumWordLength);
|
AST_APP_ARG(argMaximumWordLength);
|
||||||
);
|
);
|
||||||
|
|
||||||
ast_verb(3, "AMD: %s %s %s (Fmt: %d)\n", chan->name ,chan->cid.cid_ani, chan->cid.cid_rdnis, chan->readformat);
|
ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, chan->cid.cid_ani, chan->cid.cid_rdnis, ast_getformatname(chan->readformat));
|
||||||
|
|
||||||
/* Lets parse the arguments. */
|
/* Lets parse the arguments. */
|
||||||
if (!ast_strlen_zero(parse)) {
|
if (!ast_strlen_zero(parse)) {
|
||||||
|
|
|
@ -611,7 +611,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = (f->frametype == AST_FRAME_DTMF) ? f->subclass : 0;
|
res = (f->frametype == AST_FRAME_DTMF) ? f->subclass.integer : 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
if (!res)
|
if (!res)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -208,17 +208,17 @@ dahdiretry:
|
||||||
f = ast_read(c);
|
f = ast_read(c);
|
||||||
if (!f)
|
if (!f)
|
||||||
break;
|
break;
|
||||||
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
|
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
} else if (fd != chan->fds[0]) {
|
} else if (fd != chan->fds[0]) {
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass == AST_FORMAT_ULAW) {
|
if (f->subclass.codec == AST_FORMAT_ULAW) {
|
||||||
/* Carefully write */
|
/* Carefully write */
|
||||||
careful_write(fd, f->data.ptr, f->datalen);
|
careful_write(fd, f->data.ptr, f->datalen);
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%d) frame in the conference\n", f->subclass);
|
ast_log(LOG_WARNING, "Huh? Got a non-ulaw (%s) frame in the conference\n", ast_getformatname(f->subclass.codec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -227,7 +227,7 @@ dahdiretry:
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_VOICE;
|
fr.frametype = AST_FRAME_VOICE;
|
||||||
fr.subclass = AST_FORMAT_ULAW;
|
fr.subclass.codec = AST_FORMAT_ULAW;
|
||||||
fr.datalen = res;
|
fr.datalen = res;
|
||||||
fr.samples = res;
|
fr.samples = res;
|
||||||
fr.data.ptr = buf;
|
fr.data.ptr = buf;
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_CONTROL) {
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_ANSWER:
|
case AST_CONTROL_ANSWER:
|
||||||
/* This is our guy if someone answered. */
|
/* This is our guy if someone answered. */
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
|
@ -1145,7 +1145,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
|
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
|
||||||
}
|
}
|
||||||
} else if (single) {
|
} else if (single) {
|
||||||
switch (f->frametype) {
|
switch (f->frametype) {
|
||||||
|
@ -1157,7 +1157,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_HTML:
|
case AST_FRAME_HTML:
|
||||||
if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data.ptr, f->datalen) == -1) {
|
if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass.integer, f->data.ptr, f->datalen) == -1) {
|
||||||
ast_log(LOG_WARNING, "Unable to send URL\n");
|
ast_log(LOG_WARNING, "Unable to send URL\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1175,7 +1175,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
else if (!f || (f->frametype != AST_FRAME_VOICE))
|
else if (!f || (f->frametype != AST_FRAME_VOICE))
|
||||||
printf("Hangup received on %s\n", in->name);
|
printf("Hangup received on %s\n", in->name);
|
||||||
#endif
|
#endif
|
||||||
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
|
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
|
||||||
/* Got hung up */
|
/* Got hung up */
|
||||||
*to = -1;
|
*to = -1;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
|
@ -1195,11 +1195,11 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
const char *context;
|
const char *context;
|
||||||
ast_channel_lock(in);
|
ast_channel_lock(in);
|
||||||
context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
|
context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
|
||||||
if (onedigit_goto(in, context, (char) f->subclass, 1)) {
|
if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) {
|
||||||
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass);
|
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
|
||||||
*to = 0;
|
*to = 0;
|
||||||
ast_cdr_noanswer(in->cdr);
|
ast_cdr_noanswer(in->cdr);
|
||||||
*result = f->subclass;
|
*result = f->subclass.integer;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
ast_channel_unlock(in);
|
ast_channel_unlock(in);
|
||||||
|
@ -1209,7 +1209,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
|
if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
|
||||||
detect_disconnect(in, f->subclass, featurecode)) {
|
detect_disconnect(in, f->subclass.integer, featurecode)) {
|
||||||
ast_verb(3, "User requested call disconnect.\n");
|
ast_verb(3, "User requested call disconnect.\n");
|
||||||
*to = 0;
|
*to = 0;
|
||||||
strcpy(pa->status, "CANCEL");
|
strcpy(pa->status, "CANCEL");
|
||||||
|
@ -1221,7 +1221,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
|
|
||||||
/* Forward HTML stuff */
|
/* Forward HTML stuff */
|
||||||
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
|
if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
|
||||||
if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data.ptr, f->datalen) == -1)
|
if (ast_channel_sendhtml(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1)
|
||||||
ast_log(LOG_WARNING, "Unable to send URL\n");
|
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))) {
|
if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END))) {
|
||||||
|
@ -1229,16 +1229,16 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
|
||||||
ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
|
ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
|
||||||
}
|
}
|
||||||
if (single && (f->frametype == AST_FRAME_CONTROL)) {
|
if (single && (f->frametype == AST_FRAME_CONTROL)) {
|
||||||
if ((f->subclass == AST_CONTROL_HOLD) ||
|
if ((f->subclass.integer == AST_CONTROL_HOLD) ||
|
||||||
(f->subclass == AST_CONTROL_UNHOLD) ||
|
(f->subclass.integer == AST_CONTROL_UNHOLD) ||
|
||||||
(f->subclass == AST_CONTROL_VIDUPDATE) ||
|
(f->subclass.integer == AST_CONTROL_VIDUPDATE) ||
|
||||||
(f->subclass == AST_CONTROL_SRCUPDATE) ||
|
(f->subclass.integer == AST_CONTROL_SRCUPDATE) ||
|
||||||
(f->subclass == AST_CONTROL_REDIRECTING)) {
|
(f->subclass.integer == AST_CONTROL_REDIRECTING)) {
|
||||||
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
|
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass.integer, outgoing->chan->name);
|
||||||
ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
|
ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
|
||||||
} else if (f->subclass == AST_CONTROL_CONNECTED_LINE) {
|
} else if (f->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
|
||||||
if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
|
if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
|
||||||
ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
|
ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
|
||||||
samples = 0;
|
samples = 0;
|
||||||
while (!done && ((res = ast_waitfor(chan, -1)) > -1) && fs && (f = ast_read(chan))) {
|
while (!done && ((res = ast_waitfor(chan, -1)) > -1) && fs && (f = ast_read(chan))) {
|
||||||
if (digit) {
|
if (digit) {
|
||||||
struct ast_frame fr = {AST_FRAME_DTMF, digit};
|
struct ast_frame fr = {AST_FRAME_DTMF, { .integer = digit } };
|
||||||
ast_queue_frame(chan, &fr);
|
ast_queue_frame(chan, &fr);
|
||||||
digit = 0;
|
digit = 0;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
|
||||||
int got = 1;
|
int got = 1;
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case DMODE_PLAY:
|
case DMODE_PLAY:
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case '1':
|
case '1':
|
||||||
ast_set_flag(&flags, DFLAG_PAUSE);
|
ast_set_flag(&flags, DFLAG_PAUSE);
|
||||||
mode = DMODE_RECORD;
|
mode = DMODE_RECORD;
|
||||||
|
@ -202,7 +202,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DMODE_RECORD:
|
case DMODE_RECORD:
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case '1':
|
case '1':
|
||||||
ast_set_flag(&flags, DFLAG_PAUSE);
|
ast_set_flag(&flags, DFLAG_PAUSE);
|
||||||
mode = DMODE_PLAY;
|
mode = DMODE_PLAY;
|
||||||
|
@ -219,7 +219,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
|
||||||
got = 0;
|
got = 0;
|
||||||
}
|
}
|
||||||
if (!got) {
|
if (!got) {
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case '#':
|
case '#':
|
||||||
done = 1;
|
done = 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -220,7 +220,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
|
||||||
if (f->data.uint32)
|
if (f->data.uint32)
|
||||||
chan->hangupcause = f->data.uint32;
|
chan->hangupcause = f->data.uint32;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -234,7 +234,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
j = f->subclass; /* save digit */
|
j = f->subclass.integer; /* save digit */
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
|
||||||
if (!i) {
|
if (!i) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ static const char app[] = "Echo";
|
||||||
static int echo_exec(struct ast_channel *chan, const char *data)
|
static int echo_exec(struct ast_channel *chan, const char *data)
|
||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
int format;
|
format_t format;
|
||||||
|
|
||||||
format = ast_best_codec(chan->nativeformats);
|
format = ast_best_codec(chan->nativeformats);
|
||||||
ast_set_write_format(chan, format);
|
ast_set_write_format(chan, format);
|
||||||
|
@ -68,7 +68,7 @@ static int echo_exec(struct ast_channel *chan, const char *data)
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
|
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) {
|
||||||
res = 0;
|
res = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
@ -627,7 +627,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
send_eivr_event(eivr_events, f->subclass, NULL, chan);
|
send_eivr_event(eivr_events, f->subclass.integer, NULL, chan);
|
||||||
if (u->option_autoclear) {
|
if (u->option_autoclear) {
|
||||||
if (!u->abort_current_sound && !u->playing_silence)
|
if (!u->abort_current_sound && !u->playing_silence)
|
||||||
send_eivr_event(eivr_events, 'T', NULL, chan);
|
send_eivr_event(eivr_events, 'T', NULL, chan);
|
||||||
|
@ -640,7 +640,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
|
||||||
u->abort_current_sound = 1;
|
u->abort_current_sound = 1;
|
||||||
AST_LIST_UNLOCK(&u->playlist);
|
AST_LIST_UNLOCK(&u->playlist);
|
||||||
}
|
}
|
||||||
} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
|
} else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
|
||||||
ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
|
ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
|
||||||
send_eivr_event(eivr_events, 'H', NULL, chan);
|
send_eivr_event(eivr_events, 'H', NULL, chan);
|
||||||
if (f->data.uint32) {
|
if (f->data.uint32) {
|
||||||
|
|
|
@ -180,7 +180,7 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin
|
||||||
|
|
||||||
struct ast_frame outf = {
|
struct ast_frame outf = {
|
||||||
.frametype = AST_FRAME_MODEM,
|
.frametype = AST_FRAME_MODEM,
|
||||||
.subclass = AST_MODEM_T38,
|
.subclass.integer = AST_MODEM_T38,
|
||||||
.src = __FUNCTION__,
|
.src = __FUNCTION__,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ static int fax_generator_generate(struct ast_channel *chan, void *data, int len,
|
||||||
|
|
||||||
struct ast_frame outf = {
|
struct ast_frame outf = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass.codec = AST_FORMAT_SLINEAR,
|
||||||
.src = __FUNCTION__,
|
.src = __FUNCTION__,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ static int transmit_audio(fax_session *s)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((inf->frametype == AST_FRAME_CONTROL) &&
|
if ((inf->frametype == AST_FRAME_CONTROL) &&
|
||||||
(inf->subclass == AST_CONTROL_T38_PARAMETERS) &&
|
(inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
|
||||||
(inf->datalen == sizeof(t38_parameters))) {
|
(inf->datalen == sizeof(t38_parameters))) {
|
||||||
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
||||||
|
|
||||||
|
@ -517,12 +517,12 @@ static int transmit_audio(fax_session *s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
|
ast_debug(10, "frame %d/%llu, len=%d\n", inf->frametype, (unsigned long long) inf->subclass.codec, inf->datalen);
|
||||||
|
|
||||||
/* Check the frame type. Format also must be checked because there is a chance
|
/* Check the frame type. Format also must be checked because there is a chance
|
||||||
that a frame in old format was already queued before we set channel format
|
that a frame in old format was already queued before we set channel format
|
||||||
to slinear so it will still be received by ast_read */
|
to slinear so it will still be received by ast_read */
|
||||||
if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
|
if (inf->frametype == AST_FRAME_VOICE && inf->subclass.codec == AST_FORMAT_SLINEAR) {
|
||||||
if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
|
if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
|
||||||
/* I know fax_rx never returns errors. The check here is for good style only */
|
/* I know fax_rx never returns errors. The check here is for good style only */
|
||||||
ast_log(LOG_WARNING, "fax_rx returned error\n");
|
ast_log(LOG_WARNING, "fax_rx returned error\n");
|
||||||
|
@ -534,7 +534,7 @@ static int transmit_audio(fax_session *s)
|
||||||
last_state = t30state->state;
|
last_state = t30state->state;
|
||||||
}
|
}
|
||||||
} else if ((inf->frametype == AST_FRAME_CONTROL) &&
|
} else if ((inf->frametype == AST_FRAME_CONTROL) &&
|
||||||
(inf->subclass == AST_CONTROL_T38_PARAMETERS)) {
|
(inf->subclass.integer == AST_CONTROL_T38_PARAMETERS)) {
|
||||||
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
||||||
|
|
||||||
if (parameters->request_response == AST_T38_NEGOTIATED) {
|
if (parameters->request_response == AST_T38_NEGOTIATED) {
|
||||||
|
@ -678,15 +678,15 @@ static int transmit_t38(fax_session *s)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
|
ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass.integer, inf->datalen);
|
||||||
|
|
||||||
if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
|
if (inf->frametype == AST_FRAME_MODEM && inf->subclass.integer == AST_MODEM_T38) {
|
||||||
t38_core_rx_ifp_packet(t38state, inf->data.ptr, inf->datalen, inf->seqno);
|
t38_core_rx_ifp_packet(t38state, inf->data.ptr, inf->datalen, inf->seqno);
|
||||||
if (last_state != t30state->state) {
|
if (last_state != t30state->state) {
|
||||||
state_change = ast_tvnow();
|
state_change = ast_tvnow();
|
||||||
last_state = t30state->state;
|
last_state = t30state->state;
|
||||||
}
|
}
|
||||||
} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38_PARAMETERS) {
|
} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) {
|
||||||
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
||||||
if (parameters->request_response == AST_T38_TERMINATED) {
|
if (parameters->request_response == AST_T38_TERMINATED) {
|
||||||
ast_debug(1, "T38 down, finishing\n");
|
ast_debug(1, "T38 down, finishing\n");
|
||||||
|
@ -733,7 +733,7 @@ disable_t38:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((inf->frametype == AST_FRAME_CONTROL) &&
|
if ((inf->frametype == AST_FRAME_CONTROL) &&
|
||||||
(inf->subclass == AST_CONTROL_T38_PARAMETERS) &&
|
(inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
|
||||||
(inf->datalen == sizeof(t38_parameters))) {
|
(inf->datalen == sizeof(t38_parameters))) {
|
||||||
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
struct ast_control_t38_parameters *parameters = inf->data.ptr;
|
||||||
|
|
||||||
|
|
|
@ -211,8 +211,8 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
ast_debug(1, "User pressed a key\n");
|
ast_debug(1, "User pressed a key\n");
|
||||||
if (intkeys && strchr(intkeys, f->subclass)) {
|
if (intkeys && strchr(intkeys, f->subclass.integer)) {
|
||||||
res = f->subclass;
|
res = f->subclass.integer;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
|
||||||
res = read(fds[0], myf.frdata, needed);
|
res = read(fds[0], myf.frdata, needed);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
myf.f.frametype = AST_FRAME_VOICE;
|
myf.f.frametype = AST_FRAME_VOICE;
|
||||||
myf.f.subclass = AST_FORMAT_SLINEAR;
|
myf.f.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
myf.f.datalen = res;
|
myf.f.datalen = res;
|
||||||
myf.f.samples = res / 2;
|
myf.f.samples = res / 2;
|
||||||
myf.f.offset = AST_FRIENDLY_OFFSET;
|
myf.f.offset = AST_FRIENDLY_OFFSET;
|
||||||
|
|
|
@ -643,7 +643,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
|
||||||
f = ast_read(winner);
|
f = ast_read(winner);
|
||||||
if (f) {
|
if (f) {
|
||||||
if (f->frametype == AST_FRAME_CONTROL) {
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_HANGUP:
|
case AST_CONTROL_HANGUP:
|
||||||
ast_verb(3, "%s received a hangup frame.\n", winner->name);
|
ast_verb(3, "%s received a hangup frame.\n", winner->name);
|
||||||
if (f->data.uint32) {
|
if (f->data.uint32) {
|
||||||
|
@ -718,7 +718,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
|
||||||
ast_verb(3, "%s stopped sounds\n", winner->name);
|
ast_verb(3, "%s stopped sounds\n", winner->name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
|
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -726,8 +726,8 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
|
||||||
if (winner->stream)
|
if (winner->stream)
|
||||||
ast_stopstream(winner);
|
ast_stopstream(winner);
|
||||||
tmpuser->digts = 0;
|
tmpuser->digts = 0;
|
||||||
ast_debug(1, "DTMF received: %c\n",(char) f->subclass);
|
ast_debug(1, "DTMF received: %c\n", (char) f->subclass.integer);
|
||||||
tmpuser->yn[tmpuser->ynidx] = (char) f->subclass;
|
tmpuser->yn[tmpuser->ynidx] = (char) f->subclass.integer;
|
||||||
tmpuser->ynidx++;
|
tmpuser->ynidx++;
|
||||||
ast_debug(1, "DTMF string: %s\n", tmpuser->yn);
|
ast_debug(1, "DTMF string: %s\n", tmpuser->yn);
|
||||||
if (tmpuser->ynidx >= ynlongest) {
|
if (tmpuser->ynidx >= ynlongest) {
|
||||||
|
|
|
@ -604,7 +604,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d
|
||||||
short buf[160];
|
short buf[160];
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass.codec = AST_FORMAT_SLINEAR,
|
||||||
.src = "JACK",
|
.src = "JACK",
|
||||||
.data.ptr = buf,
|
.data.ptr = buf,
|
||||||
.datalen = sizeof(buf),
|
.datalen = sizeof(buf),
|
||||||
|
@ -781,7 +781,7 @@ static int jack_exec(struct ast_channel *chan, const char *data)
|
||||||
|
|
||||||
switch (f->frametype) {
|
switch (f->frametype) {
|
||||||
case AST_FRAME_CONTROL:
|
case AST_FRAME_CONTROL:
|
||||||
if (f->subclass == AST_CONTROL_HANGUP)
|
if (f->subclass.integer == AST_CONTROL_HANGUP)
|
||||||
jack_data->stop = 1;
|
jack_data->stop = 1;
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_VOICE:
|
case AST_FRAME_VOICE:
|
||||||
|
@ -827,9 +827,9 @@ static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channe
|
||||||
if (frame->frametype != AST_FRAME_VOICE)
|
if (frame->frametype != AST_FRAME_VOICE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (frame->subclass != AST_FORMAT_SLINEAR) {
|
if (frame->subclass.codec != AST_FORMAT_SLINEAR) {
|
||||||
ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %d\n",
|
ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %s\n",
|
||||||
frame->subclass);
|
ast_getformatname(frame->subclass.codec));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2931,11 +2931,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
dtmfstr[0] = f->subclass;
|
dtmfstr[0] = f->subclass.integer;
|
||||||
dtmfstr[1] = '\0';
|
dtmfstr[1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
|
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
|
||||||
if (user->talk.actual) {
|
if (user->talk.actual) {
|
||||||
ast_frame_adjust_volume(f, user->talk.actual);
|
ast_frame_adjust_volume(f, user->talk.actual);
|
||||||
}
|
}
|
||||||
|
@ -2987,7 +2987,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
careful_write(fd, f->data.ptr, f->datalen, 0);
|
careful_write(fd, f->data.ptr, f->datalen, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
|
} else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
|
||||||
if (confflags & CONFFLAG_PASS_DTMF) {
|
if (confflags & CONFFLAG_PASS_DTMF) {
|
||||||
conf_queue_dtmf(conf, user, f);
|
conf_queue_dtmf(conf, user, f);
|
||||||
}
|
}
|
||||||
|
@ -3020,7 +3020,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
dtmf = 0;
|
dtmf = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dtmf = f->subclass;
|
dtmf = f->subclass.integer;
|
||||||
}
|
}
|
||||||
if (dtmf) {
|
if (dtmf) {
|
||||||
switch(dtmf) {
|
switch(dtmf) {
|
||||||
|
@ -3121,7 +3121,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
dtmf = 0;
|
dtmf = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dtmf = f->subclass;
|
dtmf = f->subclass.integer;
|
||||||
}
|
}
|
||||||
if (dtmf) {
|
if (dtmf) {
|
||||||
switch (dtmf) {
|
switch (dtmf) {
|
||||||
|
@ -3211,7 +3211,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
} else {
|
} else {
|
||||||
ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", dtmfstr, exitcontext);
|
ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", dtmfstr, exitcontext);
|
||||||
}
|
}
|
||||||
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass))) {
|
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass.integer))) {
|
||||||
pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr);
|
pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr);
|
||||||
|
|
||||||
if (confflags & CONFFLAG_PASS_DTMF) {
|
if (confflags & CONFFLAG_PASS_DTMF) {
|
||||||
|
@ -3224,7 +3224,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
&& confflags & CONFFLAG_PASS_DTMF) {
|
&& confflags & CONFFLAG_PASS_DTMF) {
|
||||||
conf_queue_dtmf(conf, user, f);
|
conf_queue_dtmf(conf, user, f);
|
||||||
} else if ((confflags & CONFFLAG_SLA_STATION) && f->frametype == AST_FRAME_CONTROL) {
|
} else if ((confflags & CONFFLAG_SLA_STATION) && f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch (f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_HOLD:
|
case AST_CONTROL_HOLD:
|
||||||
sla_queue_event_conf(SLA_EVENT_HOLD, chan, conf);
|
sla_queue_event_conf(SLA_EVENT_HOLD, chan, conf);
|
||||||
break;
|
break;
|
||||||
|
@ -3236,7 +3236,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
} else {
|
} else {
|
||||||
ast_debug(1,
|
ast_debug(1,
|
||||||
"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
|
"Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
|
||||||
chan->name, f->frametype, f->subclass);
|
chan->name, f->frametype, f->subclass.integer);
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
} else if (outfd > -1) {
|
} else if (outfd > -1) {
|
||||||
|
@ -3244,7 +3244,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_VOICE;
|
fr.frametype = AST_FRAME_VOICE;
|
||||||
fr.subclass = AST_FORMAT_SLINEAR;
|
fr.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
fr.datalen = res;
|
fr.datalen = res;
|
||||||
fr.samples = res / 2;
|
fr.samples = res / 2;
|
||||||
fr.data.ptr = buf;
|
fr.data.ptr = buf;
|
||||||
|
|
|
@ -78,7 +78,7 @@ static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int
|
||||||
int i, *indexp = (int *) data;
|
int i, *indexp = (int *) data;
|
||||||
struct ast_frame wf = {
|
struct ast_frame wf = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_ULAW,
|
.subclass.codec = AST_FORMAT_ULAW,
|
||||||
.offset = AST_FRIENDLY_OFFSET,
|
.offset = AST_FRIENDLY_OFFSET,
|
||||||
.src = __FUNCTION__,
|
.src = __FUNCTION__,
|
||||||
};
|
};
|
||||||
|
|
|
@ -169,7 +169,7 @@ static int mp3_exec(struct ast_channel *chan, const char *data)
|
||||||
res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata), timeout);
|
res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata), timeout);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
myf.f.frametype = AST_FRAME_VOICE;
|
myf.f.frametype = AST_FRAME_VOICE;
|
||||||
myf.f.subclass = AST_FORMAT_SLINEAR;
|
myf.f.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
myf.f.datalen = res;
|
myf.f.datalen = res;
|
||||||
myf.f.samples = res / 2;
|
myf.f.samples = res / 2;
|
||||||
myf.f.mallocd = 0;
|
myf.f.mallocd = 0;
|
||||||
|
|
|
@ -148,7 +148,7 @@ static int NBScat_exec(struct ast_channel *chan, const char *data)
|
||||||
res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata));
|
res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata));
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
myf.f.frametype = AST_FRAME_VOICE;
|
myf.f.frametype = AST_FRAME_VOICE;
|
||||||
myf.f.subclass = AST_FORMAT_SLINEAR;
|
myf.f.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
myf.f.datalen = res;
|
myf.f.datalen = res;
|
||||||
myf.f.samples = res / 2;
|
myf.f.samples = res / 2;
|
||||||
myf.f.mallocd = 0;
|
myf.f.mallocd = 0;
|
||||||
|
|
|
@ -3299,7 +3299,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
|
||||||
f = ast_read(winner);
|
f = ast_read(winner);
|
||||||
if (f) {
|
if (f) {
|
||||||
if (f->frametype == AST_FRAME_CONTROL) {
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch (f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_ANSWER:
|
case AST_CONTROL_ANSWER:
|
||||||
/* This is our guy if someone answered. */
|
/* This is our guy if someone answered. */
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
|
@ -3389,7 +3389,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
|
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3413,7 +3413,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
|
||||||
/* If we received an event from the caller, deal with it. */
|
/* If we received an event from the caller, deal with it. */
|
||||||
if (winner == in) {
|
if (winner == in) {
|
||||||
f = ast_read(in);
|
f = ast_read(in);
|
||||||
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
|
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
|
||||||
/* Got hung up */
|
/* Got hung up */
|
||||||
*to = -1;
|
*to = -1;
|
||||||
if (f) {
|
if (f) {
|
||||||
|
@ -3424,16 +3424,16 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass == '*')) {
|
if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
|
||||||
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass);
|
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
|
||||||
*to = 0;
|
*to = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass)) {
|
if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
|
||||||
ast_verb(3, "User pressed digit: %c\n", f->subclass);
|
ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
|
||||||
*to = 0;
|
*to = 0;
|
||||||
*digit = f->subclass;
|
*digit = f->subclass.integer;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ((f->frametype == AST_FRAME_DTMF) &&
|
} else if ((f->frametype == AST_FRAME_DTMF) &&
|
||||||
(f->subclass == terminator)) {
|
(f->subclass.integer == terminator)) {
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "DTMF");
|
pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "DTMF");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1603,7 +1603,7 @@ static int sms_generate(struct ast_channel *chan, void *data, int len, int sampl
|
||||||
buf = alloca(len);
|
buf = alloca(len);
|
||||||
|
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
f.subclass = __OUT_FMT;
|
f.subclass.codec = __OUT_FMT;
|
||||||
f.datalen = samples * sizeof(*buf);
|
f.datalen = samples * sizeof(*buf);
|
||||||
f.offset = AST_FRIENDLY_OFFSET;
|
f.offset = AST_FRIENDLY_OFFSET;
|
||||||
f.mallocd = 0;
|
f.mallocd = 0;
|
||||||
|
|
|
@ -824,7 +824,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
||||||
/* Free the frame we received */
|
/* Free the frame we received */
|
||||||
switch (f->frametype) {
|
switch (f->frametype) {
|
||||||
case AST_FRAME_DTMF:
|
case AST_FRAME_DTMF:
|
||||||
if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
|
if (dtmf_terminator != '\0' && f->subclass.integer == dtmf_terminator) {
|
||||||
done = 1;
|
done = 1;
|
||||||
} else {
|
} else {
|
||||||
if (chan->stream != NULL) {
|
if (chan->stream != NULL) {
|
||||||
|
@ -836,7 +836,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
||||||
started = 1;
|
started = 1;
|
||||||
}
|
}
|
||||||
start = ast_tvnow();
|
start = ast_tvnow();
|
||||||
snprintf(tmp, sizeof(tmp), "%c", f->subclass);
|
snprintf(tmp, sizeof(tmp), "%c", f->subclass.integer);
|
||||||
strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
|
strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
|
||||||
/* If the maximum length of the DTMF has been reached, stop now */
|
/* If the maximum length of the DTMF has been reached, stop now */
|
||||||
if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
|
if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
|
||||||
|
@ -844,7 +844,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_CONTROL:
|
case AST_FRAME_CONTROL:
|
||||||
switch (f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_HANGUP:
|
case AST_CONTROL_HANGUP:
|
||||||
/* Since they hung up we should destroy the speech structure */
|
/* Since they hung up we should destroy the speech structure */
|
||||||
done = 3;
|
done = 3;
|
||||||
|
|
|
@ -173,15 +173,15 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
|
||||||
break;
|
break;
|
||||||
} else if (fr->frametype == AST_FRAME_DTMF) {
|
} else if (fr->frametype == AST_FRAME_DTMF) {
|
||||||
char t[2];
|
char t[2];
|
||||||
t[0] = fr->subclass;
|
t[0] = fr->subclass.integer;
|
||||||
t[1] = '\0';
|
t[1] = '\0';
|
||||||
if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
|
if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
|
||||||
/* They entered a valid extension, or might be anyhow */
|
/* They entered a valid extension, or might be anyhow */
|
||||||
res = fr->subclass;
|
res = fr->subclass.integer;
|
||||||
ast_frfree(fr);
|
ast_frfree(fr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass == AST_FORMAT_SLINEAR) && continue_analysis) {
|
} else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass.codec == AST_FORMAT_SLINEAR) && continue_analysis) {
|
||||||
int totalsilence;
|
int totalsilence;
|
||||||
int ms;
|
int ms;
|
||||||
res = ast_dsp_silence(dsp, fr, &totalsilence);
|
res = ast_dsp_silence(dsp, fr, &totalsilence);
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who)
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
|
if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
|
||||||
foo = (short *)f->data.ptr;
|
foo = (short *)f->data.ptr;
|
||||||
for (x=0;x<f->samples;x++) {
|
for (x=0;x<f->samples;x++) {
|
||||||
noise += abs(foo[x]);
|
noise += abs(foo[x]);
|
||||||
|
|
|
@ -139,7 +139,7 @@ static int sendurl_exec(struct ast_channel *chan, const char *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_HTML) {
|
if (f->frametype == AST_FRAME_HTML) {
|
||||||
switch(f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_HTML_LDCOMPLETE:
|
case AST_HTML_LDCOMPLETE:
|
||||||
res = 0;
|
res = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -154,7 +154,7 @@ static int sendurl_exec(struct ast_channel *chan, const char *data)
|
||||||
goto out;
|
goto out;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass);
|
ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass.integer);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
|
|
@ -78,7 +78,7 @@ static int waitforring_exec(struct ast_channel *chan, const char *data)
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_RING)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_RING)) {
|
||||||
ast_verb(3, "Got a ring but still waiting for timeout\n");
|
ast_verb(3, "Got a ring but still waiting for timeout\n");
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -99,7 +99,7 @@ static int waitforring_exec(struct ast_channel *chan, const char *data)
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_RING)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_RING)) {
|
||||||
ast_verb(3, "Got a ring after the timeout\n");
|
ast_verb(3, "Got a ring after the timeout\n");
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -123,9 +123,9 @@ static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chan
|
||||||
/* Setup frame parameters */
|
/* Setup frame parameters */
|
||||||
sc->frame.frametype = AST_FRAME_VOICE;
|
sc->frame.frametype = AST_FRAME_VOICE;
|
||||||
#ifdef SOFTMIX_16_SUPPORT
|
#ifdef SOFTMIX_16_SUPPORT
|
||||||
sc->frame.subclass = AST_FORMAT_SLINEAR16;
|
sc->frame.subclass.codec = AST_FORMAT_SLINEAR16;
|
||||||
#else
|
#else
|
||||||
sc->frame.subclass = AST_FORMAT_SLINEAR;
|
sc->frame.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
#endif
|
#endif
|
||||||
sc->frame.data.ptr = sc->final_buf;
|
sc->frame.data.ptr = sc->final_buf;
|
||||||
sc->frame.datalen = SOFTMIX_DATALEN;
|
sc->frame.datalen = SOFTMIX_DATALEN;
|
||||||
|
@ -168,9 +168,9 @@ static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *brid
|
||||||
|
|
||||||
/* If a frame was provided add it to the smoother */
|
/* If a frame was provided add it to the smoother */
|
||||||
#ifdef SOFTMIX_16_SUPPORT
|
#ifdef SOFTMIX_16_SUPPORT
|
||||||
if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR16) {
|
if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR16) {
|
||||||
#else
|
#else
|
||||||
if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR) {
|
if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR) {
|
||||||
#endif
|
#endif
|
||||||
ast_slinfactory_feed(&sc->factory, frame);
|
ast_slinfactory_feed(&sc->factory, frame);
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,10 +280,11 @@ static AST_LIST_HEAD_STATIC(agents, agent_pvt); /*!< Holds the list of agents (l
|
||||||
#define CHECK_FORMATS(ast, p) do { \
|
#define CHECK_FORMATS(ast, p) do { \
|
||||||
if (p->chan) {\
|
if (p->chan) {\
|
||||||
if (ast->nativeformats != p->chan->nativeformats) { \
|
if (ast->nativeformats != p->chan->nativeformats) { \
|
||||||
ast_debug(1, "Native formats changing from %d to %d\n", ast->nativeformats, p->chan->nativeformats); \
|
char tmp1[256], tmp2[256]; \
|
||||||
|
ast_debug(1, "Native formats changing from '%s' to '%s'\n", ast_getformatname_multiple(tmp1, sizeof(tmp1), ast->nativeformats), ast_getformatname_multiple(tmp2, sizeof(tmp2), p->chan->nativeformats)); \
|
||||||
/* Native formats changed, reset things */ \
|
/* Native formats changed, reset things */ \
|
||||||
ast->nativeformats = p->chan->nativeformats; \
|
ast->nativeformats = p->chan->nativeformats; \
|
||||||
ast_debug(1, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\
|
ast_debug(1, "Resetting read to '%s' and write to '%s'\n", ast_getformatname_multiple(tmp1, sizeof(tmp1), ast->readformat), ast_getformatname_multiple(tmp2, sizeof(tmp2), ast->writeformat));\
|
||||||
ast_set_read_format(ast, ast->readformat); \
|
ast_set_read_format(ast, ast->readformat); \
|
||||||
ast_set_write_format(ast, ast->writeformat); \
|
ast_set_write_format(ast, ast->writeformat); \
|
||||||
} \
|
} \
|
||||||
|
@ -310,7 +311,7 @@ static AST_LIST_HEAD_STATIC(agents, agent_pvt); /*!< Holds the list of agents (l
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/*--- Forward declarations */
|
/*--- Forward declarations */
|
||||||
static struct ast_channel *agent_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *agent_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int agent_devicestate(void *data);
|
static int agent_devicestate(void *data);
|
||||||
static int agent_digit_begin(struct ast_channel *ast, char digit);
|
static int agent_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int agent_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
|
@ -529,7 +530,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
||||||
{
|
{
|
||||||
struct agent_pvt *p = ast->tech_pvt;
|
struct agent_pvt *p = ast->tech_pvt;
|
||||||
struct ast_frame *f = NULL;
|
struct ast_frame *f = NULL;
|
||||||
static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
static struct ast_frame answer_frame = { AST_FRAME_CONTROL, { AST_CONTROL_ANSWER } };
|
||||||
int cur_time = time(NULL);
|
int cur_time = time(NULL);
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
CHECK_FORMATS(ast, p);
|
CHECK_FORMATS(ast, p);
|
||||||
|
@ -566,7 +567,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
switch (f->frametype) {
|
switch (f->frametype) {
|
||||||
case AST_FRAME_CONTROL:
|
case AST_FRAME_CONTROL:
|
||||||
if (f->subclass == AST_CONTROL_ANSWER) {
|
if (f->subclass.integer == AST_CONTROL_ANSWER) {
|
||||||
if (p->ackcall) {
|
if (p->ackcall) {
|
||||||
ast_verb(3, "%s answered, waiting for '%c' to acknowledge\n", p->chan->name, p->acceptdtmf);
|
ast_verb(3, "%s answered, waiting for '%c' to acknowledge\n", p->chan->name, p->acceptdtmf);
|
||||||
/* Don't pass answer along */
|
/* Don't pass answer along */
|
||||||
|
@ -583,18 +584,18 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_DTMF_BEGIN:
|
case AST_FRAME_DTMF_BEGIN:
|
||||||
/*ignore DTMF begin's as it can cause issues with queue announce files*/
|
/*ignore DTMF begin's as it can cause issues with queue announce files*/
|
||||||
if((!p->acknowledged && f->subclass == p->acceptdtmf) || (f->subclass == p->enddtmf && endcall)){
|
if((!p->acknowledged && f->subclass.integer == p->acceptdtmf) || (f->subclass.integer == p->enddtmf && endcall)){
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
f = &ast_null_frame;
|
f = &ast_null_frame;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AST_FRAME_DTMF_END:
|
case AST_FRAME_DTMF_END:
|
||||||
if (!p->acknowledged && (f->subclass == p->acceptdtmf)) {
|
if (!p->acknowledged && (f->subclass.integer == p->acceptdtmf)) {
|
||||||
ast_verb(3, "%s acknowledged\n", p->chan->name);
|
ast_verb(3, "%s acknowledged\n", p->chan->name);
|
||||||
p->acknowledged = 1;
|
p->acknowledged = 1;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
f = &answer_frame;
|
f = &answer_frame;
|
||||||
} else if (f->subclass == p->enddtmf && endcall) {
|
} else if (f->subclass.integer == p->enddtmf && endcall) {
|
||||||
/* terminates call */
|
/* terminates call */
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
|
@ -660,7 +661,7 @@ static int agent_write(struct ast_channel *ast, struct ast_frame *f)
|
||||||
else {
|
else {
|
||||||
if ((f->frametype != AST_FRAME_VOICE) ||
|
if ((f->frametype != AST_FRAME_VOICE) ||
|
||||||
(f->frametype != AST_FRAME_VIDEO) ||
|
(f->frametype != AST_FRAME_VIDEO) ||
|
||||||
(f->subclass == p->chan->writeformat)) {
|
(f->subclass.codec == p->chan->writeformat)) {
|
||||||
res = ast_write(p->chan, f);
|
res = ast_write(p->chan, f);
|
||||||
} else {
|
} else {
|
||||||
ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n",
|
ast_debug(1, "Dropping one incompatible %s frame on '%s' to '%s'\n",
|
||||||
|
@ -951,7 +952,7 @@ static int agent_ack_sleep(void *data)
|
||||||
if (!f)
|
if (!f)
|
||||||
return -1;
|
return -1;
|
||||||
if (f->frametype == AST_FRAME_DTMF)
|
if (f->frametype == AST_FRAME_DTMF)
|
||||||
res = f->subclass;
|
res = f->subclass.integer;
|
||||||
else
|
else
|
||||||
res = 0;
|
res = 0;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -1334,7 +1335,7 @@ static int check_beep(struct agent_pvt *newlyavailable, int needlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Part of the Asterisk PBX interface */
|
/*! \brief Part of the Asterisk PBX interface */
|
||||||
static struct ast_channel *agent_request(const char *type, int format, const struct ast_channel* requestor, void *data, int *cause)
|
static struct ast_channel *agent_request(const char *type, format_t format, const struct ast_channel* requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct agent_pvt *p;
|
struct agent_pvt *p;
|
||||||
struct ast_channel *chan = NULL;
|
struct ast_channel *chan = NULL;
|
||||||
|
@ -1958,12 +1959,12 @@ static int login_exec(struct ast_channel *chan, const char *data)
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
|
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
|
||||||
if (res)
|
if (res)
|
||||||
ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
|
ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(chan->nativeformats)));
|
||||||
}
|
}
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
|
res = ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
|
||||||
if (res)
|
if (res)
|
||||||
ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
|
ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(chan->nativeformats)));
|
||||||
}
|
}
|
||||||
/* Check once more just in case */
|
/* Check once more just in case */
|
||||||
if (p->chan)
|
if (p->chan)
|
||||||
|
|
|
@ -130,7 +130,7 @@ static int writedev = -1;
|
||||||
|
|
||||||
static int autoanswer = 1;
|
static int autoanswer = 1;
|
||||||
|
|
||||||
static struct ast_channel *alsa_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *alsa_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);
|
static int alsa_digit(struct ast_channel *c, char digit, unsigned int duration);
|
||||||
static int alsa_text(struct ast_channel *c, const char *text);
|
static int alsa_text(struct ast_channel *c, const char *text);
|
||||||
static int alsa_hangup(struct ast_channel *c);
|
static int alsa_hangup(struct ast_channel *c);
|
||||||
|
@ -312,7 +312,7 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
ast_verbose(" << Auto-answered >> \n");
|
ast_verbose(" << Auto-answered >> \n");
|
||||||
grab_owner();
|
grab_owner();
|
||||||
if (alsa.owner) {
|
if (alsa.owner) {
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
ast_queue_frame(alsa.owner, &f);
|
ast_queue_frame(alsa.owner, &f);
|
||||||
ast_channel_unlock(alsa.owner);
|
ast_channel_unlock(alsa.owner);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ static int alsa_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
ast_verbose(" << Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
|
ast_verbose(" << Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
|
||||||
grab_owner();
|
grab_owner();
|
||||||
if (alsa.owner) {
|
if (alsa.owner) {
|
||||||
f.subclass = AST_CONTROL_RINGING;
|
f.subclass.integer = AST_CONTROL_RINGING;
|
||||||
ast_queue_frame(alsa.owner, &f);
|
ast_queue_frame(alsa.owner, &f);
|
||||||
ast_channel_unlock(alsa.owner);
|
ast_channel_unlock(alsa.owner);
|
||||||
ast_indicate(alsa.owner, AST_CONTROL_RINGING);
|
ast_indicate(alsa.owner, AST_CONTROL_RINGING);
|
||||||
|
@ -426,7 +426,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
||||||
|
|
||||||
ast_mutex_lock(&alsalock);
|
ast_mutex_lock(&alsalock);
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
f.subclass = 0;
|
f.subclass.integer = 0;
|
||||||
f.samples = 0;
|
f.samples = 0;
|
||||||
f.datalen = 0;
|
f.datalen = 0;
|
||||||
f.data.ptr = NULL;
|
f.data.ptr = NULL;
|
||||||
|
@ -471,7 +471,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
|
||||||
return &f;
|
return &f;
|
||||||
}
|
}
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
f.subclass = AST_FORMAT_SLINEAR;
|
f.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
f.samples = FRAME_SIZE;
|
f.samples = FRAME_SIZE;
|
||||||
f.datalen = FRAME_SIZE * 2;
|
f.datalen = FRAME_SIZE * 2;
|
||||||
f.data.ptr = buf;
|
f.data.ptr = buf;
|
||||||
|
@ -565,13 +565,14 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state, const ch
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *alsa_request(const char *type, int fmt, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *alsa_request(const char *type, format_t fmt, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat = fmt;
|
format_t oldformat = fmt;
|
||||||
|
char buf[256];
|
||||||
struct ast_channel *tmp = NULL;
|
struct ast_channel *tmp = NULL;
|
||||||
|
|
||||||
if (!(fmt &= AST_FORMAT_SLINEAR)) {
|
if (!(fmt &= AST_FORMAT_SLINEAR)) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
|
ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,9 +670,7 @@ static char *console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
|
||||||
hookstate = 1;
|
hookstate = 1;
|
||||||
grab_owner();
|
grab_owner();
|
||||||
if (alsa.owner) {
|
if (alsa.owner) {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);
|
||||||
|
|
||||||
ast_queue_frame(alsa.owner, &f);
|
|
||||||
ast_channel_unlock(alsa.owner);
|
ast_channel_unlock(alsa.owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +708,7 @@ static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
ast_cli(a->fd, "No channel active\n");
|
ast_cli(a->fd, "No channel active\n");
|
||||||
res = CLI_FAILURE;
|
res = CLI_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
struct ast_frame f = { AST_FRAME_TEXT, 0 };
|
struct ast_frame f = { AST_FRAME_TEXT };
|
||||||
char text2send[256] = "";
|
char text2send[256] = "";
|
||||||
|
|
||||||
while (tmparg < a->argc) {
|
while (tmparg < a->argc) {
|
||||||
|
@ -723,11 +722,7 @@ static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
grab_owner();
|
grab_owner();
|
||||||
if (alsa.owner) {
|
if (alsa.owner) {
|
||||||
ast_queue_frame(alsa.owner, &f);
|
ast_queue_frame(alsa.owner, &f);
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
|
||||||
f.data.ptr = NULL;
|
|
||||||
f.datalen = 0;
|
|
||||||
ast_queue_frame(alsa.owner, &f);
|
|
||||||
ast_channel_unlock(alsa.owner);
|
ast_channel_unlock(alsa.owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -802,7 +797,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args
|
||||||
if (a->argc == 3) {
|
if (a->argc == 3) {
|
||||||
if (alsa.owner) {
|
if (alsa.owner) {
|
||||||
for (d = a->argv[2]; *d; d++) {
|
for (d = a->argv[2]; *d; d++) {
|
||||||
struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass = *d };
|
struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass.integer = *d };
|
||||||
|
|
||||||
ast_queue_frame(alsa.owner, &f);
|
ast_queue_frame(alsa.owner, &f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
#include "asterisk/app.h"
|
#include "asterisk/app.h"
|
||||||
#include "asterisk/bridging.h"
|
#include "asterisk/bridging.h"
|
||||||
|
|
||||||
static struct ast_channel *bridge_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *bridge_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int bridge_call(struct ast_channel *ast, char *dest, int timeout);
|
static int bridge_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
static int bridge_hangup(struct ast_channel *ast);
|
static int bridge_hangup(struct ast_channel *ast);
|
||||||
static struct ast_frame *bridge_read(struct ast_channel *ast);
|
static struct ast_frame *bridge_read(struct ast_channel *ast);
|
||||||
|
@ -189,7 +189,7 @@ static int bridge_hangup(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Called when we want to place a call somewhere, but not actually call it... yet */
|
/*! \brief Called when we want to place a call somewhere, but not actually call it... yet */
|
||||||
static struct ast_channel *bridge_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *bridge_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct bridge_pvt *p = NULL;
|
struct bridge_pvt *p = NULL;
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ static struct ast_jb_conf default_jbconf = {
|
||||||
static struct ast_jb_conf global_jbconf;
|
static struct ast_jb_conf global_jbconf;
|
||||||
|
|
||||||
/*! Channel Technology Callbacks @{ */
|
/*! Channel Technology Callbacks @{ */
|
||||||
static struct ast_channel *console_request(const char *type, int format,
|
static struct ast_channel *console_request(const char *type, format_t format,
|
||||||
const struct ast_channel *requestor, void *data, int *cause);
|
const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int console_digit_begin(struct ast_channel *c, char digit);
|
static int console_digit_begin(struct ast_channel *c, char digit);
|
||||||
static int console_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
static int console_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
||||||
|
@ -264,7 +264,7 @@ static void *stream_monitor(void *data)
|
||||||
PaError res;
|
PaError res;
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR16,
|
.subclass.codec = AST_FORMAT_SLINEAR16,
|
||||||
.src = "console_stream_monitor",
|
.src = "console_stream_monitor",
|
||||||
.data.ptr = buf,
|
.data.ptr = buf,
|
||||||
.datalen = sizeof(buf),
|
.datalen = sizeof(buf),
|
||||||
|
@ -440,11 +440,12 @@ static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext,
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *console_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *console_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat = format;
|
format_t oldformat = format;
|
||||||
struct ast_channel *chan = NULL;
|
struct ast_channel *chan = NULL;
|
||||||
struct console_pvt *pvt;
|
struct console_pvt *pvt;
|
||||||
|
char buf[512];
|
||||||
|
|
||||||
if (!(pvt = find_pvt(data))) {
|
if (!(pvt = find_pvt(data))) {
|
||||||
ast_log(LOG_ERROR, "Console device '%s' not found\n", (char *) data);
|
ast_log(LOG_ERROR, "Console device '%s' not found\n", (char *) data);
|
||||||
|
@ -453,7 +454,7 @@ static struct ast_channel *console_request(const char *type, int format, const s
|
||||||
|
|
||||||
format &= SUPPORTED_FORMATS;
|
format &= SUPPORTED_FORMATS;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%d'\n", oldformat);
|
ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
|
||||||
goto return_unref;
|
goto return_unref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,8 +554,8 @@ static struct ast_frame *console_read(struct ast_channel *chan)
|
||||||
|
|
||||||
static int console_call(struct ast_channel *c, char *dest, int timeout)
|
static int console_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { 0, };
|
|
||||||
struct console_pvt *pvt = c->tech_pvt;
|
struct console_pvt *pvt = c->tech_pvt;
|
||||||
|
enum ast_control_frame_type ctrl;
|
||||||
|
|
||||||
ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END,
|
ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END,
|
||||||
dest, c->cid.cid_name, c->cid.cid_num);
|
dest, c->cid.cid_name, c->cid.cid_num);
|
||||||
|
@ -565,18 +566,16 @@ static int console_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
pvt->hookstate = 1;
|
pvt->hookstate = 1;
|
||||||
console_pvt_unlock(pvt);
|
console_pvt_unlock(pvt);
|
||||||
ast_verb(1, V_BEGIN "Auto-answered" V_END);
|
ast_verb(1, V_BEGIN "Auto-answered" V_END);
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
ctrl = AST_CONTROL_ANSWER;
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
|
||||||
} else {
|
} else {
|
||||||
console_pvt_unlock(pvt);
|
console_pvt_unlock(pvt);
|
||||||
ast_verb(1, V_BEGIN "Type 'console answer' to answer, or use the 'autoanswer' option "
|
ast_verb(1, V_BEGIN "Type 'console answer' to answer, or use the 'autoanswer' option "
|
||||||
"for future calls" V_END);
|
"for future calls" V_END);
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
ctrl = AST_CONTROL_RINGING;
|
||||||
f.subclass = AST_CONTROL_RINGING;
|
|
||||||
ast_indicate(c, AST_CONTROL_RINGING);
|
ast_indicate(c, AST_CONTROL_RINGING);
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_queue_frame(c, &f);
|
ast_queue_control(c, ctrl);
|
||||||
|
|
||||||
return start_stream(pvt);
|
return start_stream(pvt);
|
||||||
}
|
}
|
||||||
|
@ -729,7 +728,6 @@ static char *cli_console_autoanswer(struct ast_cli_entry *e, int cmd,
|
||||||
|
|
||||||
static char *cli_console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *cli_console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
|
|
||||||
struct console_pvt *pvt = get_active_pvt();
|
struct console_pvt *pvt = get_active_pvt();
|
||||||
|
|
||||||
if (cmd == CLI_INIT) {
|
if (cmd == CLI_INIT) {
|
||||||
|
@ -757,7 +755,7 @@ static char *cli_console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||||
|
|
||||||
pvt->hookstate = 0;
|
pvt->hookstate = 0;
|
||||||
|
|
||||||
ast_queue_frame(pvt->owner, &f);
|
ast_queue_control(pvt->owner, AST_CONTROL_FLASH);
|
||||||
|
|
||||||
unref_pvt(pvt);
|
unref_pvt(pvt);
|
||||||
|
|
||||||
|
@ -789,7 +787,7 @@ static char *cli_console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
|
|
||||||
if (pvt->owner) { /* already in a call */
|
if (pvt->owner) { /* already in a call */
|
||||||
int i;
|
int i;
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, 0 };
|
struct ast_frame f = { AST_FRAME_DTMF };
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (a->argc == e->args) { /* argument is mandatory here */
|
if (a->argc == e->args) { /* argument is mandatory here */
|
||||||
|
@ -800,7 +798,7 @@ static char *cli_console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
s = a->argv[e->args];
|
s = a->argv[e->args];
|
||||||
/* send the string one char at a time */
|
/* send the string one char at a time */
|
||||||
for (i = 0; i < strlen(s); i++) {
|
for (i = 0; i < strlen(s); i++) {
|
||||||
f.subclass = s[i];
|
f.subclass.integer = s[i];
|
||||||
ast_queue_frame(pvt->owner, &f);
|
ast_queue_frame(pvt->owner, &f);
|
||||||
}
|
}
|
||||||
unref_pvt(pvt);
|
unref_pvt(pvt);
|
||||||
|
@ -1024,7 +1022,6 @@ static char *cli_list_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
*/
|
*/
|
||||||
static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
|
||||||
struct console_pvt *pvt = get_active_pvt();
|
struct console_pvt *pvt = get_active_pvt();
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -1059,7 +1056,7 @@ static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||||
|
|
||||||
ast_indicate(pvt->owner, -1);
|
ast_indicate(pvt->owner, -1);
|
||||||
|
|
||||||
ast_queue_frame(pvt->owner, &f);
|
ast_queue_control(pvt->owner, AST_CONTROL_ANSWER);
|
||||||
|
|
||||||
unref_pvt(pvt);
|
unref_pvt(pvt);
|
||||||
|
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ast_channel *dahdi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *dahdi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int dahdi_digit_begin(struct ast_channel *ast, char digit);
|
static int dahdi_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
static int dahdi_sendtext(struct ast_channel *c, const char *text);
|
static int dahdi_sendtext(struct ast_channel *c, const char *text);
|
||||||
|
@ -1936,9 +1936,9 @@ static void my_handle_dtmfup(void *pvt, struct ast_channel *ast, enum analog_sub
|
||||||
struct dahdi_pvt *p = pvt;
|
struct dahdi_pvt *p = pvt;
|
||||||
int idx = analogsub_to_dahdisub(analog_index);
|
int idx = analogsub_to_dahdisub(analog_index);
|
||||||
|
|
||||||
ast_debug(1, "DTMF digit: %c on %s\n", f->subclass, ast->name);
|
ast_debug(1, "DTMF digit: %c on %s\n", f->subclass.integer, ast->name);
|
||||||
|
|
||||||
if (f->subclass == 'f') {
|
if (f->subclass.integer == 'f') {
|
||||||
/* Fax tone -- Handle and return NULL */
|
/* Fax tone -- Handle and return NULL */
|
||||||
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
|
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
|
||||||
/* If faxbuffers are configured, use them for the fax transmission */
|
/* If faxbuffers are configured, use them for the fax transmission */
|
||||||
|
@ -1987,7 +1987,7 @@ static void my_handle_dtmfup(void *pvt, struct ast_channel *ast, enum analog_sub
|
||||||
}
|
}
|
||||||
dahdi_confmute(p, 0);
|
dahdi_confmute(p, 0);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
*dest = &p->subs[idx].f;
|
*dest = &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5327,7 +5327,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
|
||||||
res = -1;
|
res = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_CONTROL && f->subclass == AST_CONTROL_HANGUP) {
|
if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
|
||||||
ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
|
ast_log(LOG_DEBUG, "Got HANGUP frame on channel %s, going out ...\n", chan->name);
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
res = -1;
|
res = -1;
|
||||||
|
@ -6856,19 +6856,19 @@ static void dahdi_handle_dtmfup(struct ast_channel *ast, int idx, struct ast_fra
|
||||||
struct dahdi_pvt *p = ast->tech_pvt;
|
struct dahdi_pvt *p = ast->tech_pvt;
|
||||||
struct ast_frame *f = *dest;
|
struct ast_frame *f = *dest;
|
||||||
|
|
||||||
ast_debug(1, "DTMF digit: %c on %s\n", f->subclass, ast->name);
|
ast_debug(1, "DTMF digit: %c on %s\n", (int) f->subclass.integer, ast->name);
|
||||||
|
|
||||||
if (p->confirmanswer) {
|
if (p->confirmanswer) {
|
||||||
ast_debug(1, "Confirm answer on %s!\n", ast->name);
|
ast_debug(1, "Confirm answer on %s!\n", ast->name);
|
||||||
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
|
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
|
||||||
of a DTMF digit */
|
of a DTMF digit */
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
*dest = &p->subs[idx].f;
|
*dest = &p->subs[idx].f;
|
||||||
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
|
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
|
||||||
p->confirmanswer = 0;
|
p->confirmanswer = 0;
|
||||||
} else if (p->callwaitcas) {
|
} else if (p->callwaitcas) {
|
||||||
if ((f->subclass == 'A') || (f->subclass == 'D')) {
|
if ((f->subclass.integer == 'A') || (f->subclass.integer == 'D')) {
|
||||||
ast_debug(1, "Got some DTMF, but it's for the CAS\n");
|
ast_debug(1, "Got some DTMF, but it's for the CAS\n");
|
||||||
if (p->cidspill)
|
if (p->cidspill)
|
||||||
ast_free(p->cidspill);
|
ast_free(p->cidspill);
|
||||||
|
@ -6876,9 +6876,9 @@ static void dahdi_handle_dtmfup(struct ast_channel *ast, int idx, struct ast_fra
|
||||||
}
|
}
|
||||||
p->callwaitcas = 0;
|
p->callwaitcas = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
*dest = &p->subs[idx].f;
|
*dest = &p->subs[idx].f;
|
||||||
} else if (f->subclass == 'f') {
|
} else if (f->subclass.integer == 'f') {
|
||||||
/* Fax tone -- Handle and return NULL */
|
/* Fax tone -- Handle and return NULL */
|
||||||
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
|
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
|
||||||
/* If faxbuffers are configured, use them for the fax transmission */
|
/* If faxbuffers are configured, use them for the fax transmission */
|
||||||
|
@ -6931,7 +6931,7 @@ static void dahdi_handle_dtmfup(struct ast_channel *ast, int idx, struct ast_fra
|
||||||
}
|
}
|
||||||
dahdi_confmute(p, 0);
|
dahdi_confmute(p, 0);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
*dest = &p->subs[idx].f;
|
*dest = &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6962,7 +6962,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
if (p->outsigmod > -1)
|
if (p->outsigmod > -1)
|
||||||
mysig = p->outsigmod;
|
mysig = p->outsigmod;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->subs[idx].f.datalen = 0;
|
p->subs[idx].f.datalen = 0;
|
||||||
p->subs[idx].f.samples = 0;
|
p->subs[idx].f.samples = 0;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
|
@ -6994,7 +6994,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
#endif
|
#endif
|
||||||
dahdi_confmute(p, 0);
|
dahdi_confmute(p, 0);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_DTMF_END;
|
p->subs[idx].f.frametype = AST_FRAME_DTMF_END;
|
||||||
p->subs[idx].f.subclass = res & 0xff;
|
p->subs[idx].f.subclass.integer = res & 0xff;
|
||||||
#ifdef HAVE_PRI
|
#ifdef HAVE_PRI
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -7007,7 +7007,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
/* Mute conference */
|
/* Mute conference */
|
||||||
dahdi_confmute(p, 1);
|
dahdi_confmute(p, 1);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_DTMF_BEGIN;
|
p->subs[idx].f.frametype = AST_FRAME_DTMF_BEGIN;
|
||||||
p->subs[idx].f.subclass = res & 0xff;
|
p->subs[idx].f.subclass.integer = res & 0xff;
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7075,7 +7075,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
|
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
break;
|
break;
|
||||||
} else { /* if to state wait for offhook to dial rest */
|
} else { /* if to state wait for offhook to dial rest */
|
||||||
/* we now wait for off hook */
|
/* we now wait for off hook */
|
||||||
|
@ -7098,7 +7098,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
} else if (!p->answeronpolarityswitch) {
|
} else if (!p->answeronpolarityswitch) {
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
/* If aops=0 and hops=1, this is necessary */
|
/* If aops=0 and hops=1, this is necessary */
|
||||||
p->polarity = POLARITY_REV;
|
p->polarity = POLARITY_REV;
|
||||||
} else {
|
} else {
|
||||||
|
@ -7140,7 +7140,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
case DAHDI_EVENT_ONHOOK:
|
case DAHDI_EVENT_ONHOOK:
|
||||||
if (p->radio) {
|
if (p->radio) {
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RADIO_UNKEY;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_UNKEY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p->oprmode < 0)
|
if (p->oprmode < 0)
|
||||||
|
@ -7274,7 +7274,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
if (p->radio)
|
if (p->radio)
|
||||||
{
|
{
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RADIO_KEY;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_KEY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* for E911, its supposed to wait for offhook then dial
|
/* for E911, its supposed to wait for offhook then dial
|
||||||
|
@ -7315,7 +7315,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
dahdi_enable_ec(p);
|
dahdi_enable_ec(p);
|
||||||
dahdi_train_ec(p);
|
dahdi_train_ec(p);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
/* Make sure it stops ringing */
|
/* Make sure it stops ringing */
|
||||||
dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
|
dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
|
||||||
ast_debug(1, "channel %d answered\n", p->channel);
|
ast_debug(1, "channel %d answered\n", p->channel);
|
||||||
|
@ -7329,7 +7329,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
if (p->confirmanswer) {
|
if (p->confirmanswer) {
|
||||||
/* Ignore answer if "confirm answer" is enabled */
|
/* Ignore answer if "confirm answer" is enabled */
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
} else if (!ast_strlen_zero(p->dop.dialstr)) {
|
} else if (!ast_strlen_zero(p->dop.dialstr)) {
|
||||||
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
|
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
|
||||||
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
|
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_DIAL, &p->dop);
|
||||||
|
@ -7340,7 +7340,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
} else {
|
} else {
|
||||||
ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
|
ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->dialing = 1;
|
p->dialing = 1;
|
||||||
}
|
}
|
||||||
p->dop.dialstr[0] = '\0';
|
p->dop.dialstr[0] = '\0';
|
||||||
|
@ -7352,7 +7352,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
ast_setstate(ast, AST_STATE_RING);
|
ast_setstate(ast, AST_STATE_RING);
|
||||||
ast->rings = 1;
|
ast->rings = 1;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_OFFHOOK;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_OFFHOOK;
|
||||||
ast_debug(1, "channel %d picked up\n", p->channel);
|
ast_debug(1, "channel %d picked up\n", p->channel);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
case AST_STATE_UP:
|
case AST_STATE_UP:
|
||||||
|
@ -7409,15 +7409,15 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
|
||||||
if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) {
|
if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) {
|
||||||
ast_debug(1, "Ring detected\n");
|
ast_debug(1, "Ring detected\n");
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RING;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RING;
|
||||||
} else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) {
|
} else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) {
|
||||||
ast_debug(1, "Line answered\n");
|
ast_debug(1, "Line answered\n");
|
||||||
if (p->confirmanswer) {
|
if (p->confirmanswer) {
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
} else {
|
} else {
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
}
|
}
|
||||||
} else if (ast->_state != AST_STATE_RING)
|
} else if (ast->_state != AST_STATE_RING)
|
||||||
|
@ -7815,7 +7815,7 @@ static struct ast_frame *__dahdi_exception(struct ast_channel *ast)
|
||||||
p->subs[idx].f.samples = 0;
|
p->subs[idx].f.samples = 0;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
p->subs[idx].f.offset = 0;
|
p->subs[idx].f.offset = 0;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->subs[idx].f.delivery = ast_tv(0,0);
|
p->subs[idx].f.delivery = ast_tv(0,0);
|
||||||
p->subs[idx].f.src = "dahdi_exception";
|
p->subs[idx].f.src = "dahdi_exception";
|
||||||
p->subs[idx].f.data.ptr = NULL;
|
p->subs[idx].f.data.ptr = NULL;
|
||||||
|
@ -7957,7 +7957,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
p->subs[idx].f.samples = 0;
|
p->subs[idx].f.samples = 0;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
p->subs[idx].f.offset = 0;
|
p->subs[idx].f.offset = 0;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->subs[idx].f.delivery = ast_tv(0,0);
|
p->subs[idx].f.delivery = ast_tv(0,0);
|
||||||
p->subs[idx].f.src = "dahdi_read";
|
p->subs[idx].f.src = "dahdi_read";
|
||||||
p->subs[idx].f.data.ptr = NULL;
|
p->subs[idx].f.data.ptr = NULL;
|
||||||
|
@ -7977,11 +7977,11 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
if (ps.rxisoffhook)
|
if (ps.rxisoffhook)
|
||||||
{
|
{
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RADIO_KEY;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_KEY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RADIO_UNKEY;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_UNKEY;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
|
@ -8003,7 +8003,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send ringing frame if requested */
|
/* Send ringing frame if requested */
|
||||||
p->subs[idx].needringing = 0;
|
p->subs[idx].needringing = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_RINGING;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_RINGING;
|
||||||
ast_setstate(ast, AST_STATE_RINGING);
|
ast_setstate(ast, AST_STATE_RINGING);
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
|
@ -8013,7 +8013,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send busy frame if requested */
|
/* Send busy frame if requested */
|
||||||
p->subs[idx].needbusy = 0;
|
p->subs[idx].needbusy = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_BUSY;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_BUSY;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
|
@ -8022,7 +8022,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send congestion frame if requested */
|
/* Send congestion frame if requested */
|
||||||
p->subs[idx].needcongestion = 0;
|
p->subs[idx].needcongestion = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_CONGESTION;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_CONGESTION;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
|
@ -8031,7 +8031,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send answer frame if requested */
|
/* Send answer frame if requested */
|
||||||
p->subs[idx].needanswer = 0;
|
p->subs[idx].needanswer = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
|
@ -8050,7 +8050,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send answer frame if requested */
|
/* Send answer frame if requested */
|
||||||
p->subs[idx].needflash = 0;
|
p->subs[idx].needflash = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_FLASH;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_FLASH;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
}
|
}
|
||||||
|
@ -8059,7 +8059,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send answer frame if requested */
|
/* Send answer frame if requested */
|
||||||
p->subs[idx].needhold = 0;
|
p->subs[idx].needhold = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_HOLD;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_HOLD;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
ast_debug(1, "Sending hold on '%s'\n", ast->name);
|
ast_debug(1, "Sending hold on '%s'\n", ast->name);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
|
@ -8069,7 +8069,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Send answer frame if requested */
|
/* Send answer frame if requested */
|
||||||
p->subs[idx].needunhold = 0;
|
p->subs[idx].needunhold = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
p->subs[idx].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[idx].f.subclass = AST_CONTROL_UNHOLD;
|
p->subs[idx].f.subclass.integer = AST_CONTROL_UNHOLD;
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
ast_debug(1, "Sending unhold on '%s'\n", ast->name);
|
ast_debug(1, "Sending unhold on '%s'\n", ast->name);
|
||||||
return &p->subs[idx].f;
|
return &p->subs[idx].f;
|
||||||
|
@ -8141,7 +8141,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (c) { /* if a char to return */
|
if (c) { /* if a char to return */
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->subs[idx].f.frametype = AST_FRAME_TEXT;
|
p->subs[idx].f.frametype = AST_FRAME_TEXT;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
|
p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
|
||||||
|
@ -8179,7 +8179,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
p->subs[idx].f.frametype = AST_FRAME_VOICE;
|
p->subs[idx].f.frametype = AST_FRAME_VOICE;
|
||||||
p->subs[idx].f.subclass = ast->rawreadformat;
|
p->subs[idx].f.subclass.codec = ast->rawreadformat;
|
||||||
p->subs[idx].f.samples = READ_SIZE;
|
p->subs[idx].f.samples = READ_SIZE;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
|
p->subs[idx].f.offset = AST_FRIENDLY_OFFSET;
|
||||||
|
@ -8194,7 +8194,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
/* Whoops, we're still dialing, or in a state where we shouldn't transmit....
|
/* Whoops, we're still dialing, or in a state where we shouldn't transmit....
|
||||||
don't send anything */
|
don't send anything */
|
||||||
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
p->subs[idx].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[idx].f.subclass = 0;
|
p->subs[idx].f.subclass.integer = 0;
|
||||||
p->subs[idx].f.samples = 0;
|
p->subs[idx].f.samples = 0;
|
||||||
p->subs[idx].f.mallocd = 0;
|
p->subs[idx].f.mallocd = 0;
|
||||||
p->subs[idx].f.offset = 0;
|
p->subs[idx].f.offset = 0;
|
||||||
|
@ -8215,7 +8215,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_BUSY)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_BUSY)) {
|
||||||
if ((ast->_state == AST_STATE_UP) && !p->outgoing) {
|
if ((ast->_state == AST_STATE_UP) && !p->outgoing) {
|
||||||
/* Treat this as a "hangup" instead of a "busy" on the assumption that
|
/* Treat this as a "hangup" instead of a "busy" on the assumption that
|
||||||
a busy */
|
a busy */
|
||||||
|
@ -8230,7 +8230,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
|| (p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)))) {
|
|| (p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)))) {
|
||||||
/* Don't accept in-band DTMF when in overlap dial mode */
|
/* Don't accept in-band DTMF when in overlap dial mode */
|
||||||
f->frametype = AST_FRAME_NULL;
|
f->frametype = AST_FRAME_NULL;
|
||||||
f->subclass = 0;
|
f->subclass.integer = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* DSP clears us of being pulse */
|
/* DSP clears us of being pulse */
|
||||||
|
@ -8242,7 +8242,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|
||||||
f=NULL;
|
f=NULL;
|
||||||
} else if (f->frametype == AST_FRAME_VOICE) {
|
} else if (f->frametype == AST_FRAME_VOICE) {
|
||||||
f->frametype = AST_FRAME_NULL;
|
f->frametype = AST_FRAME_NULL;
|
||||||
f->subclass = 0;
|
f->subclass.integer = 0;
|
||||||
if ((ast_dsp_get_tstate(p->dsp) == DSP_TONE_STATE_DIALTONE || ast_dsp_get_tstate(p->dsp) == DSP_TONE_STATE_RINGING) && ast_dsp_get_tcount(p->dsp) > 9) {
|
if ((ast_dsp_get_tstate(p->dsp) == DSP_TONE_STATE_DIALTONE || ast_dsp_get_tstate(p->dsp) == DSP_TONE_STATE_RINGING) && ast_dsp_get_tcount(p->dsp) > 9) {
|
||||||
p->waitingfordt.tv_sec = 0;
|
p->waitingfordt.tv_sec = 0;
|
||||||
p->dsp_features &= ~DSP_FEATURE_WAITDIALTONE;
|
p->dsp_features &= ~DSP_FEATURE_WAITDIALTONE;
|
||||||
|
@ -8324,10 +8324,10 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
|
ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((frame->subclass != AST_FORMAT_SLINEAR) &&
|
if ((frame->subclass.codec != AST_FORMAT_SLINEAR) &&
|
||||||
(frame->subclass != AST_FORMAT_ULAW) &&
|
(frame->subclass.codec != AST_FORMAT_ULAW) &&
|
||||||
(frame->subclass != AST_FORMAT_ALAW)) {
|
(frame->subclass.codec != AST_FORMAT_ALAW)) {
|
||||||
ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
|
ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_getformatname(frame->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (p->dialing) {
|
if (p->dialing) {
|
||||||
|
@ -8346,7 +8346,7 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
if (!frame->data.ptr || !frame->datalen)
|
if (!frame->data.ptr || !frame->datalen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (frame->subclass == AST_FORMAT_SLINEAR) {
|
if (frame->subclass.codec == AST_FORMAT_SLINEAR) {
|
||||||
if (!p->subs[idx].linear) {
|
if (!p->subs[idx].linear) {
|
||||||
p->subs[idx].linear = 1;
|
p->subs[idx].linear = 1;
|
||||||
res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
|
res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
|
||||||
|
@ -9410,8 +9410,8 @@ static void *analog_ss_thread(void *data)
|
||||||
if (!f)
|
if (!f)
|
||||||
break;
|
break;
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
dtmfbuf[k++] = f->subclass;
|
dtmfbuf[k++] = f->subclass.integer;
|
||||||
ast_debug(1, "CID got digit '%c'\n", f->subclass);
|
ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
|
||||||
res = 2000;
|
res = 2000;
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -9648,8 +9648,8 @@ static void *analog_ss_thread(void *data)
|
||||||
}
|
}
|
||||||
f = ast_read(chan);
|
f = ast_read(chan);
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
dtmfbuf[k++] = f->subclass;
|
dtmfbuf[k++] = f->subclass.integer;
|
||||||
ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass);
|
ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass.integer);
|
||||||
res = 2000;
|
res = 2000;
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -11991,7 +11991,7 @@ static struct dahdi_pvt *duplicate_pseudo(struct dahdi_pvt *src)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *dahdi_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *dahdi_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
ast_group_t groupmatch = 0;
|
ast_group_t groupmatch = 0;
|
||||||
int channelmatch = -1;
|
int channelmatch = -1;
|
||||||
|
@ -14986,7 +14986,7 @@ static int action_dahdidialoffhook(struct mansession *s, const struct message *m
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < strlen(number); i++) {
|
for (i = 0; i < strlen(number); i++) {
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, number[i] };
|
struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = number[i] };
|
||||||
dahdi_queue_frame(p, &f, NULL);
|
dahdi_queue_frame(p, &f, NULL);
|
||||||
}
|
}
|
||||||
astman_send_ack(s, m, "DAHDIDialOffhook");
|
astman_send_ack(s, m, "DAHDIDialOffhook");
|
||||||
|
|
|
@ -115,8 +115,8 @@ struct gtalk_pvt {
|
||||||
struct ast_channel *owner; /*!< Master Channel */
|
struct ast_channel *owner; /*!< Master Channel */
|
||||||
struct ast_rtp_instance *rtp; /*!< RTP audio session */
|
struct ast_rtp_instance *rtp; /*!< RTP audio session */
|
||||||
struct ast_rtp_instance *vrtp; /*!< RTP video session */
|
struct ast_rtp_instance *vrtp; /*!< RTP video session */
|
||||||
int jointcapability; /*!< Supported capability at both ends (codecs ) */
|
format_t jointcapability; /*!< Supported capability at both ends (codecs ) */
|
||||||
int peercapability;
|
format_t peercapability;
|
||||||
struct gtalk_pvt *next; /* Next entity */
|
struct gtalk_pvt *next; /* Next entity */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ struct gtalk {
|
||||||
char context[AST_MAX_CONTEXT];
|
char context[AST_MAX_CONTEXT];
|
||||||
char parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
|
char parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
|
||||||
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
|
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
|
||||||
int capability;
|
format_t capability;
|
||||||
ast_group_t callgroup; /*!< Call group */
|
ast_group_t callgroup; /*!< Call group */
|
||||||
ast_group_t pickupgroup; /*!< Pickup group */
|
ast_group_t pickupgroup; /*!< Pickup group */
|
||||||
int callingpres; /*!< Calling presentation */
|
int callingpres; /*!< Calling presentation */
|
||||||
|
@ -161,12 +161,12 @@ struct gtalk_container {
|
||||||
|
|
||||||
static const char desc[] = "Gtalk Channel";
|
static const char desc[] = "Gtalk Channel";
|
||||||
|
|
||||||
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
static format_t global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pvt's) */
|
AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pvt's) */
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static struct ast_channel *gtalk_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *gtalk_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration);
|
static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
static int gtalk_sendtext(struct ast_channel *ast, const char *text);
|
static int gtalk_sendtext(struct ast_channel *ast, const char *text);
|
||||||
static int gtalk_digit_begin(struct ast_channel *ast, char digit);
|
static int gtalk_digit_begin(struct ast_channel *ast, char digit);
|
||||||
|
@ -393,7 +393,7 @@ static int gtalk_invite(struct gtalk_pvt *p, char *to, char *from, char *sid, in
|
||||||
iks_insert_attrib(dcodecs, "xmlns", "http://www.google.com/session/phone");
|
iks_insert_attrib(dcodecs, "xmlns", "http://www.google.com/session/phone");
|
||||||
iks_insert_attrib(dcodecs, "xml:lang", "en");
|
iks_insert_attrib(dcodecs, "xml:lang", "en");
|
||||||
|
|
||||||
for (x = 0; x < 32; x++) {
|
for (x = 0; x < 64; x++) {
|
||||||
if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
|
if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
|
||||||
break;
|
break;
|
||||||
if (!(client->capability & pref_codec))
|
if (!(client->capability & pref_codec))
|
||||||
|
@ -532,13 +532,13 @@ static enum ast_rtp_glue_result gtalk_get_rtp_peer(struct ast_channel *chan, str
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gtalk_get_codec(struct ast_channel *chan)
|
static format_t gtalk_get_codec(struct ast_channel *chan)
|
||||||
{
|
{
|
||||||
struct gtalk_pvt *p = chan->tech_pvt;
|
struct gtalk_pvt *p = chan->tech_pvt;
|
||||||
return p->peercapability;
|
return p->peercapability;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
|
static int gtalk_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
struct gtalk_pvt *p;
|
struct gtalk_pvt *p;
|
||||||
|
|
||||||
|
@ -701,19 +701,19 @@ static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
|
||||||
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
|
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
|
||||||
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
|
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
|
} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
|
} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
|
||||||
struct ast_frame f = {AST_FRAME_DTMF, };
|
struct ast_frame f = {AST_FRAME_DTMF, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) {
|
} else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) {
|
||||||
|
@ -721,14 +721,14 @@ static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
|
||||||
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
|
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
|
||||||
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
|
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
|
} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1395,10 +1395,10 @@ static struct ast_frame *gtalk_rtp_read(struct ast_channel *ast, struct gtalk_pv
|
||||||
if (p->owner) {
|
if (p->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
if (f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
||||||
ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
|
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
|
||||||
p->owner->nativeformats =
|
p->owner->nativeformats =
|
||||||
(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass;
|
(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass.codec;
|
||||||
ast_set_read_format(p->owner, p->owner->readformat);
|
ast_set_read_format(p->owner, p->owner->readformat);
|
||||||
ast_set_write_format(p->owner, p->owner->writeformat);
|
ast_set_write_format(p->owner, p->owner->writeformat);
|
||||||
}
|
}
|
||||||
|
@ -1428,14 +1428,17 @@ static int gtalk_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
{
|
{
|
||||||
struct gtalk_pvt *p = ast->tech_pvt;
|
struct gtalk_pvt *p = ast->tech_pvt;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
switch (frame->frametype) {
|
switch (frame->frametype) {
|
||||||
case AST_FRAME_VOICE:
|
case AST_FRAME_VOICE:
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
|
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
|
||||||
frame->subclass, ast->nativeformats, ast->readformat,
|
ast_getformatname(frame->subclass.codec),
|
||||||
ast->writeformat);
|
ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
|
||||||
|
ast_getformatname(ast->readformat),
|
||||||
|
ast_getformatname(ast->writeformat));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -1655,7 +1658,7 @@ static int gtalk_hangup(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Part of PBX interface */
|
/*! \brief Part of PBX interface */
|
||||||
static struct ast_channel *gtalk_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *gtalk_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct gtalk_pvt *p = NULL;
|
struct gtalk_pvt *p = NULL;
|
||||||
struct gtalk *client = NULL;
|
struct gtalk *client = NULL;
|
||||||
|
|
|
@ -172,9 +172,9 @@ static struct oh323_pvt {
|
||||||
int newcontrol; /*!< Pending control to send */
|
int newcontrol; /*!< Pending control to send */
|
||||||
int newdigit; /*!< Pending DTMF digit to send */
|
int newdigit; /*!< Pending DTMF digit to send */
|
||||||
int newduration; /*!< Pending DTMF digit duration to send */
|
int newduration; /*!< Pending DTMF digit duration to send */
|
||||||
int pref_codec; /*!< Preferred codec */
|
format_t pref_codec; /*!< Preferred codec */
|
||||||
int peercapability; /*!< Capabilities learned from peer */
|
format_t peercapability; /*!< Capabilities learned from peer */
|
||||||
int jointcapability; /*!< Common capabilities for local and remote side */
|
format_t jointcapability; /*!< Common capabilities for local and remote side */
|
||||||
struct ast_codec_pref peer_prefs; /*!< Preferenced list of codecs which remote side supports */
|
struct ast_codec_pref peer_prefs; /*!< Preferenced list of codecs which remote side supports */
|
||||||
int dtmf_pt[2]; /*!< Payload code used for RFC2833/CISCO messages */
|
int dtmf_pt[2]; /*!< Payload code used for RFC2833/CISCO messages */
|
||||||
int curDTMF; /*!< DTMF tone being generated to Asterisk side */
|
int curDTMF; /*!< DTMF tone being generated to Asterisk side */
|
||||||
|
@ -230,7 +230,7 @@ static void delete_users(void);
|
||||||
static void delete_aliases(void);
|
static void delete_aliases(void);
|
||||||
static void prune_peers(void);
|
static void prune_peers(void);
|
||||||
|
|
||||||
static struct ast_channel *oh323_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *oh323_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int oh323_digit_begin(struct ast_channel *c, char digit);
|
static int oh323_digit_begin(struct ast_channel *c, char digit);
|
||||||
static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
static int oh323_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
||||||
static int oh323_call(struct ast_channel *c, char *dest, int timeout);
|
static int oh323_call(struct ast_channel *c, char *dest, int timeout);
|
||||||
|
@ -312,7 +312,7 @@ static int oh323_simulate_dtmf_end(const void *data)
|
||||||
if (pvt->owner) {
|
if (pvt->owner) {
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_DTMF_END,
|
.frametype = AST_FRAME_DTMF_END,
|
||||||
.subclass = pvt->curDTMF,
|
.subclass.integer = pvt->curDTMF,
|
||||||
.samples = 0,
|
.samples = 0,
|
||||||
.src = "SIMULATE_DTMF_END",
|
.src = "SIMULATE_DTMF_END",
|
||||||
};
|
};
|
||||||
|
@ -357,13 +357,13 @@ static void __oh323_update_info(struct ast_channel *c, struct oh323_pvt *pvt)
|
||||||
if (pvt->newdigit >= 0) {
|
if (pvt->newdigit >= 0) {
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_DTMF_END,
|
.frametype = AST_FRAME_DTMF_END,
|
||||||
.subclass = pvt->newdigit,
|
.subclass.integer = pvt->newdigit,
|
||||||
.samples = pvt->newduration * 8,
|
.samples = pvt->newduration * 8,
|
||||||
.len = pvt->newduration,
|
.len = pvt->newduration,
|
||||||
.src = "UPDATE_INFO",
|
.src = "UPDATE_INFO",
|
||||||
};
|
};
|
||||||
if (pvt->newdigit == ' ') { /* signalUpdate message */
|
if (pvt->newdigit == ' ') { /* signalUpdate message */
|
||||||
f.subclass = pvt->curDTMF;
|
f.subclass.integer = pvt->curDTMF;
|
||||||
if (pvt->DTMFsched >= 0) {
|
if (pvt->DTMFsched >= 0) {
|
||||||
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
||||||
}
|
}
|
||||||
|
@ -761,16 +761,16 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt)
|
||||||
if (pvt->owner) {
|
if (pvt->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != pvt->owner->nativeformats) {
|
if (f->subclass.codec != pvt->owner->nativeformats) {
|
||||||
/* Try to avoid deadlock */
|
/* Try to avoid deadlock */
|
||||||
if (ast_channel_trylock(pvt->owner)) {
|
if (ast_channel_trylock(pvt->owner)) {
|
||||||
ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n");
|
ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n");
|
||||||
return &ast_null_frame;
|
return &ast_null_frame;
|
||||||
}
|
}
|
||||||
if (h323debug)
|
if (h323debug)
|
||||||
ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
|
ast_debug(1, "Oooh, format changed to '%s'\n", ast_getformatname(f->subclass.codec));
|
||||||
pvt->owner->nativeformats = f->subclass;
|
pvt->owner->nativeformats = f->subclass.codec;
|
||||||
pvt->nativeformats = f->subclass;
|
pvt->nativeformats = f->subclass.codec;
|
||||||
ast_set_read_format(pvt->owner, pvt->owner->readformat);
|
ast_set_read_format(pvt->owner, pvt->owner->readformat);
|
||||||
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
|
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
|
||||||
ast_channel_unlock(pvt->owner);
|
ast_channel_unlock(pvt->owner);
|
||||||
|
@ -785,12 +785,12 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt)
|
||||||
else
|
else
|
||||||
ast_log(LOG_NOTICE, "Unable to process inband DTMF while channel is locked\n");
|
ast_log(LOG_NOTICE, "Unable to process inband DTMF while channel is locked\n");
|
||||||
} else if (pvt->nativeformats && !pvt->noInbandDtmf) {
|
} else if (pvt->nativeformats && !pvt->noInbandDtmf) {
|
||||||
ast_log(LOG_NOTICE, "Inband DTMF is not supported on codec %s. Use RFC2833\n", ast_getformatname(f->subclass));
|
ast_log(LOG_NOTICE, "Inband DTMF is not supported on codec %s. Use RFC2833\n", ast_getformatname(f->subclass.codec));
|
||||||
pvt->noInbandDtmf = 1;
|
pvt->noInbandDtmf = 1;
|
||||||
}
|
}
|
||||||
if (f &&(f->frametype == AST_FRAME_DTMF)) {
|
if (f &&(f->frametype == AST_FRAME_DTMF)) {
|
||||||
if (h323debug)
|
if (h323debug)
|
||||||
ast_log(LOG_DTMF, "Received in-band digit %c.\n", f->subclass);
|
ast_log(LOG_DTMF, "Received in-band digit %c.\n", f->subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -835,9 +835,10 @@ static int oh323_write(struct ast_channel *c, struct ast_frame *frame)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(frame->subclass & c->nativeformats)) {
|
if (!(frame->subclass.codec & c->nativeformats)) {
|
||||||
ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
|
char tmp[256];
|
||||||
frame->subclass, c->nativeformats, c->readformat, c->writeformat);
|
ast_log(LOG_WARNING, "Asked to transmit frame type '%s', while native formats is '%s' (read/write = %s/%s)\n",
|
||||||
|
ast_getformatname(frame->subclass.codec), ast_getformatname_multiple(tmp, sizeof(tmp), c->nativeformats), ast_getformatname(c->readformat), ast_getformatname(c->writeformat));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1717,9 +1718,9 @@ static int create_addr(struct oh323_pvt *pvt, char *opeer)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static struct ast_channel *oh323_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *oh323_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
struct oh323_pvt *pvt;
|
struct oh323_pvt *pvt;
|
||||||
struct ast_channel *tmpc = NULL;
|
struct ast_channel *tmpc = NULL;
|
||||||
char *dest = (char *)data;
|
char *dest = (char *)data;
|
||||||
|
@ -1728,7 +1729,7 @@ static struct ast_channel *oh323_request(const char *type, int format, const str
|
||||||
char tmp[256], tmp1[256];
|
char tmp[256], tmp1[256];
|
||||||
|
|
||||||
if (h323debug)
|
if (h323debug)
|
||||||
ast_debug(1, "type=%s, format=%d, data=%s.\n", type, format, (char *)data);
|
ast_debug(1, "type=%s, format=%s, data=%s.\n", type, ast_getformatname_multiple(tmp, sizeof(tmp), format), (char *)data);
|
||||||
|
|
||||||
pvt = oh323_alloc(0);
|
pvt = oh323_alloc(0);
|
||||||
if (!pvt) {
|
if (!pvt) {
|
||||||
|
@ -1738,7 +1739,7 @@ static struct ast_channel *oh323_request(const char *type, int format, const str
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
format &= AST_FORMAT_AUDIO_MASK;
|
format &= AST_FORMAT_AUDIO_MASK;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
|
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), format));
|
||||||
oh323_destroy(pvt);
|
oh323_destroy(pvt);
|
||||||
if (cause)
|
if (cause)
|
||||||
*cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
|
*cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
|
||||||
|
@ -1841,23 +1842,23 @@ static int receive_digit(unsigned call_reference, char digit, const char *token,
|
||||||
else {
|
else {
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_DTMF_END,
|
.frametype = AST_FRAME_DTMF_END,
|
||||||
.subclass = digit,
|
.subclass.integer = digit,
|
||||||
.samples = duration * 8,
|
.samples = duration * 8,
|
||||||
.len = duration,
|
.len = duration,
|
||||||
.src = "SEND_DIGIT",
|
.src = "SEND_DIGIT",
|
||||||
};
|
};
|
||||||
if (digit == ' ') { /* signalUpdate message */
|
if (digit == ' ') { /* signalUpdate message */
|
||||||
f.subclass = pvt->curDTMF;
|
f.subclass.integer = pvt->curDTMF;
|
||||||
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
||||||
} else { /* Regular input or signal message */
|
} else { /* Regular input or signal message */
|
||||||
if (pvt->DTMFsched >= 0) {
|
if (pvt->DTMFsched >= 0) {
|
||||||
/* We still don't send DTMF END from previous event, send it now */
|
/* We still don't send DTMF END from previous event, send it now */
|
||||||
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
AST_SCHED_DEL(sched, pvt->DTMFsched);
|
||||||
f.subclass = pvt->curDTMF;
|
f.subclass.integer = pvt->curDTMF;
|
||||||
f.samples = f.len = 0;
|
f.samples = f.len = 0;
|
||||||
ast_queue_frame(pvt->owner, &f);
|
ast_queue_frame(pvt->owner, &f);
|
||||||
/* Restore values */
|
/* Restore values */
|
||||||
f.subclass = digit;
|
f.subclass.integer = digit;
|
||||||
f.samples = duration * 8;
|
f.samples = duration * 8;
|
||||||
f.len = duration;
|
f.len = duration;
|
||||||
}
|
}
|
||||||
|
@ -1983,7 +1984,7 @@ static void setup_rtp_connection(unsigned call_reference, const char *remoteIp,
|
||||||
if (pt != 128 && pvt->rtp) { /* Payload type is invalid, so try to use previously decided */
|
if (pt != 128 && pvt->rtp) { /* Payload type is invalid, so try to use previously decided */
|
||||||
struct ast_rtp_payload_type rtptype = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(pvt->rtp), pt);
|
struct ast_rtp_payload_type rtptype = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(pvt->rtp), pt);
|
||||||
if (h323debug)
|
if (h323debug)
|
||||||
ast_debug(1, "Native format is set to %d from %d by RTP payload type %d\n", rtptype.code, pvt->nativeformats, pt);
|
ast_debug(1, "Native format is set to %llu from %d by RTP payload type %d\n", (unsigned long long) rtptype.code, pvt->nativeformats, pt);
|
||||||
if (pvt->nativeformats != rtptype.code) {
|
if (pvt->nativeformats != rtptype.code) {
|
||||||
pvt->nativeformats = rtptype.code;
|
pvt->nativeformats = rtptype.code;
|
||||||
nativeformats_changed = 1;
|
nativeformats_changed = 1;
|
||||||
|
@ -1996,8 +1997,10 @@ static void setup_rtp_connection(unsigned call_reference, const char *remoteIp,
|
||||||
if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
|
if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
|
||||||
/* Re-build translation path only if native format(s) has been changed */
|
/* Re-build translation path only if native format(s) has been changed */
|
||||||
if (pvt->owner->nativeformats != pvt->nativeformats) {
|
if (pvt->owner->nativeformats != pvt->nativeformats) {
|
||||||
if (h323debug)
|
if (h323debug) {
|
||||||
ast_debug(1, "Native format changed to %d from %d, read format is %d, write format is %d\n", pvt->nativeformats, pvt->owner->nativeformats, pvt->owner->readformat, pvt->owner->writeformat);
|
char tmp[256], tmp2[256];
|
||||||
|
ast_debug(1, "Native format changed to '%s' from '%s', read format is %s, write format is %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), pvt->nativeformats), ast_getformatname_multiple(tmp2, sizeof(tmp2), pvt->owner->nativeformats), ast_getformatname(pvt->owner->readformat), ast_getformatname(pvt->owner->writeformat));
|
||||||
|
}
|
||||||
pvt->owner->nativeformats = pvt->nativeformats;
|
pvt->owner->nativeformats = pvt->nativeformats;
|
||||||
ast_set_read_format(pvt->owner, pvt->owner->readformat);
|
ast_set_read_format(pvt->owner, pvt->owner->readformat);
|
||||||
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
|
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
|
||||||
|
@ -3178,7 +3181,7 @@ static char *convertcap(int cap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
|
static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
/* XXX Deal with Video */
|
/* XXX Deal with Video */
|
||||||
struct oh323_pvt *pvt;
|
struct oh323_pvt *pvt;
|
||||||
|
|
|
@ -352,7 +352,7 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL;
|
||||||
static struct io_context *io;
|
static struct io_context *io;
|
||||||
static struct ast_sched_thread *sched;
|
static struct ast_sched_thread *sched;
|
||||||
|
|
||||||
static int iax2_capability = IAX_CAPABILITY_FULLBANDWIDTH;
|
static format_t iax2_capability = IAX_CAPABILITY_FULLBANDWIDTH;
|
||||||
|
|
||||||
static int iaxdebug = 0;
|
static int iaxdebug = 0;
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ struct iax2_user {
|
||||||
int amaflags;
|
int amaflags;
|
||||||
int adsi;
|
int adsi;
|
||||||
uint64_t flags;
|
uint64_t flags;
|
||||||
int capability;
|
format_t capability;
|
||||||
int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
|
int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
|
||||||
int curauthreq; /*!< Current number of outstanding AUTHREQs */
|
int curauthreq; /*!< Current number of outstanding AUTHREQs */
|
||||||
struct ast_codec_pref prefs;
|
struct ast_codec_pref prefs;
|
||||||
|
@ -508,7 +508,7 @@ struct iax2_peer {
|
||||||
|
|
||||||
int expire; /*!< Schedule entry for expiry */
|
int expire; /*!< Schedule entry for expiry */
|
||||||
int expiry; /*!< How soon to expire */
|
int expiry; /*!< How soon to expire */
|
||||||
int capability; /*!< Capability */
|
format_t capability; /*!< Capability */
|
||||||
|
|
||||||
/* Qualification */
|
/* Qualification */
|
||||||
int callno; /*!< Call number of POKE request */
|
int callno; /*!< Call number of POKE request */
|
||||||
|
@ -639,15 +639,15 @@ struct chan_iax2_pvt {
|
||||||
/*! Socket to send/receive on for this call */
|
/*! Socket to send/receive on for this call */
|
||||||
int sockfd;
|
int sockfd;
|
||||||
/*! Last received voice format */
|
/*! Last received voice format */
|
||||||
int voiceformat;
|
format_t voiceformat;
|
||||||
/*! Last received video format */
|
/*! Last received video format */
|
||||||
int videoformat;
|
format_t videoformat;
|
||||||
/*! Last sent voice format */
|
/*! Last sent voice format */
|
||||||
int svoiceformat;
|
format_t svoiceformat;
|
||||||
/*! Last sent video format */
|
/*! Last sent video format */
|
||||||
int svideoformat;
|
format_t svideoformat;
|
||||||
/*! What we are capable of sending */
|
/*! What we are capable of sending */
|
||||||
int capability;
|
format_t capability;
|
||||||
/*! Last received timestamp */
|
/*! Last received timestamp */
|
||||||
unsigned int last;
|
unsigned int last;
|
||||||
/*! Last sent timestamp - never send the same timestamp twice in a single call */
|
/*! Last sent timestamp - never send the same timestamp twice in a single call */
|
||||||
|
@ -681,11 +681,11 @@ struct chan_iax2_pvt {
|
||||||
/*! Negotiated format, this is only used to remember what format was
|
/*! Negotiated format, this is only used to remember what format was
|
||||||
chosen for an unauthenticated call so that the channel can get
|
chosen for an unauthenticated call so that the channel can get
|
||||||
created later using the right format */
|
created later using the right format */
|
||||||
int chosenformat;
|
format_t chosenformat;
|
||||||
/*! Peer selected format */
|
/*! Peer selected format */
|
||||||
int peerformat;
|
format_t peerformat;
|
||||||
/*! Peer capability */
|
/*! Peer capability */
|
||||||
int peercapability;
|
format_t peercapability;
|
||||||
/*! timeval that we base our transmission on */
|
/*! timeval that we base our transmission on */
|
||||||
struct timeval offset;
|
struct timeval offset;
|
||||||
/*! timeval that we base our delivery on */
|
/*! timeval that we base our delivery on */
|
||||||
|
@ -1178,7 +1178,7 @@ static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, c
|
||||||
static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
|
static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
|
||||||
static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int);
|
static int send_command_locked(unsigned short callno, char, int, unsigned int, const unsigned char *, int, int);
|
||||||
static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
|
static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
|
||||||
static struct ast_channel *iax2_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *iax2_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static struct ast_frame *iax2_read(struct ast_channel *c);
|
static struct ast_frame *iax2_read(struct ast_channel *c);
|
||||||
static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
|
static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
|
||||||
static struct iax2_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
|
static struct iax2_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int temponly);
|
||||||
|
@ -1506,18 +1506,18 @@ static int send_lagrq(const void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char compress_subclass(int subclass)
|
static unsigned char compress_subclass(format_t subclass)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int power=-1;
|
int power=-1;
|
||||||
/* If it's 128 or smaller, just return it */
|
/* If it's 64 or smaller, just return it */
|
||||||
if (subclass < IAX_FLAG_SC_LOG)
|
if (subclass < IAX_FLAG_SC_LOG)
|
||||||
return subclass;
|
return subclass;
|
||||||
/* Otherwise find its power */
|
/* Otherwise find its power */
|
||||||
for (x = 0; x < IAX_MAX_SHIFT; x++) {
|
for (x = 0; x < IAX_MAX_SHIFT; x++) {
|
||||||
if (subclass & (1 << x)) {
|
if (subclass & (1LL << x)) {
|
||||||
if (power > -1) {
|
if (power > -1) {
|
||||||
ast_log(LOG_WARNING, "Can't compress subclass %d\n", subclass);
|
ast_log(LOG_WARNING, "Can't compress subclass %Ld\n", subclass);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
power = x;
|
power = x;
|
||||||
|
@ -1526,7 +1526,7 @@ static unsigned char compress_subclass(int subclass)
|
||||||
return power | IAX_FLAG_SC_LOG;
|
return power | IAX_FLAG_SC_LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uncompress_subclass(unsigned char csub)
|
static format_t uncompress_subclass(unsigned char csub)
|
||||||
{
|
{
|
||||||
/* If the SC_LOG flag is set, return 2^csub otherwise csub */
|
/* If the SC_LOG flag is set, return 2^csub otherwise csub */
|
||||||
if (csub & IAX_FLAG_SC_LOG) {
|
if (csub & IAX_FLAG_SC_LOG) {
|
||||||
|
@ -1534,7 +1534,7 @@ static int uncompress_subclass(unsigned char csub)
|
||||||
if (csub == 0xff)
|
if (csub == 0xff)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
|
return 1LL << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return csub;
|
return csub;
|
||||||
|
@ -3370,10 +3370,10 @@ static void __attempt_transmit(const void *data)
|
||||||
iax2_destroy(callno);
|
iax2_destroy(callno);
|
||||||
} else {
|
} else {
|
||||||
if (iaxs[callno]->owner)
|
if (iaxs[callno]->owner)
|
||||||
ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
|
ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %u, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass.integer, f->ts, f->oseqno);
|
||||||
iaxs[callno]->error = ETIMEDOUT;
|
iaxs[callno]->error = ETIMEDOUT;
|
||||||
if (iaxs[callno]->owner) {
|
if (iaxs[callno]->owner) {
|
||||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .data.uint32 = AST_CAUSE_DESTINATION_OUT_OF_ORDER };
|
struct ast_frame fr = { AST_FRAME_CONTROL, { AST_CONTROL_HANGUP }, .data.uint32 = AST_CAUSE_DESTINATION_OUT_OF_ORDER };
|
||||||
/* Hangup the fd */
|
/* Hangup the fd */
|
||||||
iax2_queue_frame(callno, &fr); /* XXX */
|
iax2_queue_frame(callno, &fr); /* XXX */
|
||||||
/* Remember, owner could disappear */
|
/* Remember, owner could disappear */
|
||||||
|
@ -3965,7 +3965,7 @@ static void __get_from_jb(const void *p)
|
||||||
|
|
||||||
/* create an interpolation frame */
|
/* create an interpolation frame */
|
||||||
af.frametype = AST_FRAME_VOICE;
|
af.frametype = AST_FRAME_VOICE;
|
||||||
af.subclass = pvt->voiceformat;
|
af.subclass.codec = pvt->voiceformat;
|
||||||
af.samples = frame.ms * (ast_format_rate(pvt->voiceformat) / 1000);
|
af.samples = frame.ms * (ast_format_rate(pvt->voiceformat) / 1000);
|
||||||
af.src = "IAX2 JB interpolation";
|
af.src = "IAX2 JB interpolation";
|
||||||
af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
|
af.delivery = ast_tvadd(pvt->rxcore, ast_samp2tv(next, 1000));
|
||||||
|
@ -4038,7 +4038,7 @@ static int schedule_delivery(struct iax_frame *fr, int updatehistory, int fromtr
|
||||||
|
|
||||||
if(fr->af.frametype == AST_FRAME_VOICE) {
|
if(fr->af.frametype == AST_FRAME_VOICE) {
|
||||||
type = JB_TYPE_VOICE;
|
type = JB_TYPE_VOICE;
|
||||||
len = ast_codec_get_samples(&fr->af) / (ast_format_rate(fr->af.subclass) / 1000);
|
len = ast_codec_get_samples(&fr->af) / (ast_format_rate(fr->af.subclass.codec) / 1000);
|
||||||
} else if(fr->af.frametype == AST_FRAME_CNG) {
|
} else if(fr->af.frametype == AST_FRAME_CNG) {
|
||||||
type = JB_TYPE_SILENCE;
|
type = JB_TYPE_SILENCE;
|
||||||
}
|
}
|
||||||
|
@ -4149,7 +4149,7 @@ static int iax2_sendtext(struct ast_channel *c, const char *text)
|
||||||
|
|
||||||
static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img)
|
static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img)
|
||||||
{
|
{
|
||||||
return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_IMAGE, img->subclass, 0, img->data.ptr, img->datalen, -1);
|
return send_command_locked(PTR_TO_CALLNO(c->tech_pvt), AST_FRAME_IMAGE, img->subclass.integer, 0, img->data.ptr, img->datalen, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen)
|
static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen)
|
||||||
|
@ -4384,7 +4384,7 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct create_addr_info {
|
struct create_addr_info {
|
||||||
int capability;
|
format_t capability;
|
||||||
uint64_t flags;
|
uint64_t flags;
|
||||||
int maxtime;
|
int maxtime;
|
||||||
int encmethods;
|
int encmethods;
|
||||||
|
@ -4450,7 +4450,7 @@ static int create_addr(const char *peername, struct ast_channel *c, struct socka
|
||||||
memcpy(&ourprefs, &peer->prefs, sizeof(ourprefs));
|
memcpy(&ourprefs, &peer->prefs, sizeof(ourprefs));
|
||||||
/* Move the calling channel's native codec to the top of the preference list */
|
/* Move the calling channel's native codec to the top of the preference list */
|
||||||
if (c) {
|
if (c) {
|
||||||
ast_debug(1, "prepending %x to prefs\n", c->nativeformats);
|
ast_debug(1, "prepending %llx to prefs\n", (unsigned long long) c->nativeformats);
|
||||||
ast_codec_pref_prepend(&ourprefs, c->nativeformats, 1);
|
ast_codec_pref_prepend(&ourprefs, c->nativeformats, 1);
|
||||||
}
|
}
|
||||||
ast_codec_pref_convert(&ourprefs, cai->prefs, sizeof(cai->prefs), 1);
|
ast_codec_pref_convert(&ourprefs, cai->prefs, sizeof(cai->prefs), 1);
|
||||||
|
@ -4498,7 +4498,7 @@ return_unref:
|
||||||
static void __auto_congest(const void *nothing)
|
static void __auto_congest(const void *nothing)
|
||||||
{
|
{
|
||||||
int callno = PTR_TO_CALLNO(nothing);
|
int callno = PTR_TO_CALLNO(nothing);
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_CONGESTION };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_CONGESTION } };
|
||||||
ast_mutex_lock(&iaxsl[callno]);
|
ast_mutex_lock(&iaxsl[callno]);
|
||||||
if (iaxs[callno]) {
|
if (iaxs[callno]) {
|
||||||
iaxs[callno]->initid = -1;
|
iaxs[callno]->initid = -1;
|
||||||
|
@ -4583,7 +4583,7 @@ static void resend_with_token(int callno, struct iax_frame *f, const char *newto
|
||||||
{
|
{
|
||||||
struct chan_iax2_pvt *pvt = iaxs[callno];
|
struct chan_iax2_pvt *pvt = iaxs[callno];
|
||||||
int frametype = f->af.frametype;
|
int frametype = f->af.frametype;
|
||||||
int subclass = f->af.subclass;
|
int subclass = f->af.subclass.integer;
|
||||||
struct {
|
struct {
|
||||||
struct ast_iax2_full_hdr fh;
|
struct ast_iax2_full_hdr fh;
|
||||||
struct iax_ie_data ied;
|
struct iax_ie_data ied;
|
||||||
|
@ -4917,6 +4917,7 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
iax_ie_append(&ied, IAX_IE_AUTOANSWER);
|
iax_ie_append(&ied, IAX_IE_AUTOANSWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* WARNING: this breaks down at 190 bits! */
|
||||||
iax_ie_append_str(&ied, IAX_IE_CODEC_PREFS, cai.prefs);
|
iax_ie_append_str(&ied, IAX_IE_CODEC_PREFS, cai.prefs);
|
||||||
|
|
||||||
if (l) {
|
if (l) {
|
||||||
|
@ -4973,8 +4974,10 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
if (pds.password)
|
if (pds.password)
|
||||||
ast_string_field_set(iaxs[callno], secret, pds.password);
|
ast_string_field_set(iaxs[callno], secret, pds.password);
|
||||||
|
|
||||||
iax_ie_append_int(&ied, IAX_IE_FORMAT, c->nativeformats);
|
iax_ie_append_int(&ied, IAX_IE_FORMAT, (int) c->nativeformats);
|
||||||
iax_ie_append_int(&ied, IAX_IE_CAPABILITY, iaxs[callno]->capability);
|
iax_ie_append_versioned_uint64(&ied, IAX_IE_FORMAT2, 0, c->nativeformats);
|
||||||
|
iax_ie_append_int(&ied, IAX_IE_CAPABILITY, (int) iaxs[callno]->capability);
|
||||||
|
iax_ie_append_versioned_uint64(&ied, IAX_IE_CAPABILITY2, 0, iaxs[callno]->capability);
|
||||||
iax_ie_append_short(&ied, IAX_IE_ADSICPE, c->adsicpe);
|
iax_ie_append_short(&ied, IAX_IE_ADSICPE, c->adsicpe);
|
||||||
iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime(cai.timezone));
|
iax_ie_append_int(&ied, IAX_IE_DATETIME, iax2_datetime(cai.timezone));
|
||||||
|
|
||||||
|
@ -5293,11 +5296,11 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha
|
||||||
return AST_BRIDGE_FAILED_NOWARN;
|
return AST_BRIDGE_FAILED_NOWARN;
|
||||||
}
|
}
|
||||||
if (c0->nativeformats != c1->nativeformats) {
|
if (c0->nativeformats != c1->nativeformats) {
|
||||||
char buf0[255];
|
char buf0[256];
|
||||||
char buf1[255];
|
char buf1[256];
|
||||||
ast_getformatname_multiple(buf0, sizeof(buf0) -1, c0->nativeformats);
|
ast_getformatname_multiple(buf0, sizeof(buf0), c0->nativeformats);
|
||||||
ast_getformatname_multiple(buf1, sizeof(buf1) -1, c1->nativeformats);
|
ast_getformatname_multiple(buf1, sizeof(buf1), c1->nativeformats);
|
||||||
ast_verb(3, "Operating with different codecs %d[%s] %d[%s] , can't native bridge...\n", c0->nativeformats, buf0, c1->nativeformats, buf1);
|
ast_verb(3, "Operating with different codecs [%s] [%s] , can't native bridge...\n", buf0, buf1);
|
||||||
/* Remove from native mode */
|
/* Remove from native mode */
|
||||||
lock_both(callno0, callno1);
|
lock_both(callno0, callno1);
|
||||||
if (iaxs[callno0])
|
if (iaxs[callno0])
|
||||||
|
@ -5354,7 +5357,7 @@ static enum ast_bridge_result iax2_bridge(struct ast_channel *c0, struct ast_cha
|
||||||
res = AST_BRIDGE_COMPLETE;
|
res = AST_BRIDGE_COMPLETE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((f->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS) && (f->subclass != AST_CONTROL_SRCUPDATE)) {
|
if ((f->frametype == AST_FRAME_CONTROL) && !(flags & AST_BRIDGE_IGNORE_SIGS) && (f->subclass.integer != AST_CONTROL_SRCUPDATE)) {
|
||||||
*fo = f;
|
*fo = f;
|
||||||
*rc = who;
|
*rc = who;
|
||||||
res = AST_BRIDGE_COMPLETE;
|
res = AST_BRIDGE_COMPLETE;
|
||||||
|
@ -5493,7 +5496,7 @@ static int iax2_getpeertrunk(struct sockaddr_in sin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Create new call, interface with the PBX core */
|
/*! \brief Create new call, interface with the PBX core */
|
||||||
static struct ast_channel *ast_iax2_new(int callno, int state, int capability, const char *linkedid)
|
static struct ast_channel *ast_iax2_new(int callno, int state, format_t capability, const char *linkedid)
|
||||||
{
|
{
|
||||||
struct ast_channel *tmp;
|
struct ast_channel *tmp;
|
||||||
struct chan_iax2_pvt *i;
|
struct chan_iax2_pvt *i;
|
||||||
|
@ -5660,7 +5663,7 @@ static unsigned int calc_timestamp(struct chan_iax2_pvt *p, unsigned int ts, str
|
||||||
int voice = 0;
|
int voice = 0;
|
||||||
int genuine = 0;
|
int genuine = 0;
|
||||||
int adjust;
|
int adjust;
|
||||||
int rate = ast_format_rate(f->subclass) / 1000;
|
int rate = ast_format_rate(f->subclass.codec) / 1000;
|
||||||
struct timeval *delivery = NULL;
|
struct timeval *delivery = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -6033,9 +6036,11 @@ static int decode_frame(ast_aes_decrypt_key *dcx, struct ast_iax2_full_hdr *fh,
|
||||||
memcpy(efh->encdata, workspace + padding, *datalen - sizeof(struct ast_iax2_full_enc_hdr));
|
memcpy(efh->encdata, workspace + padding, *datalen - sizeof(struct ast_iax2_full_enc_hdr));
|
||||||
f->frametype = fh->type;
|
f->frametype = fh->type;
|
||||||
if (f->frametype == AST_FRAME_VIDEO) {
|
if (f->frametype == AST_FRAME_VIDEO) {
|
||||||
f->subclass = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1);
|
f->subclass.codec = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1);
|
||||||
|
} else if (f->frametype == AST_FRAME_VOICE) {
|
||||||
|
f->subclass.codec = uncompress_subclass(fh->csub);
|
||||||
} else {
|
} else {
|
||||||
f->subclass = uncompress_subclass(fh->csub);
|
f->subclass.integer = uncompress_subclass(fh->csub);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct ast_iax2_mini_enc_hdr *efh = (struct ast_iax2_mini_enc_hdr *)fh;
|
struct ast_iax2_mini_enc_hdr *efh = (struct ast_iax2_mini_enc_hdr *)fh;
|
||||||
|
@ -6176,7 +6181,7 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
/* High two bytes are the same on timestamp, or sending on a trunk */ &&
|
/* High two bytes are the same on timestamp, or sending on a trunk */ &&
|
||||||
(f->frametype == AST_FRAME_VOICE)
|
(f->frametype == AST_FRAME_VOICE)
|
||||||
/* is a voice frame */ &&
|
/* is a voice frame */ &&
|
||||||
(f->subclass == pvt->svoiceformat)
|
(f->subclass.codec == pvt->svoiceformat)
|
||||||
/* is the same type */ ) {
|
/* is the same type */ ) {
|
||||||
/* Force immediate rather than delayed transmission */
|
/* Force immediate rather than delayed transmission */
|
||||||
now = 1;
|
now = 1;
|
||||||
|
@ -6190,7 +6195,7 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
* Otherwise send a mini video frame
|
* Otherwise send a mini video frame
|
||||||
*/
|
*/
|
||||||
if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) &&
|
if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) &&
|
||||||
((f->subclass & ~0x1) == pvt->svideoformat)
|
((f->subclass.codec & ~0x1LL) == pvt->svideoformat)
|
||||||
) {
|
) {
|
||||||
now = 1;
|
now = 1;
|
||||||
sendmini = 1;
|
sendmini = 1;
|
||||||
|
@ -6202,7 +6207,7 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_IAX) {
|
if (f->frametype == AST_FRAME_IAX) {
|
||||||
/* 0x8000 marks this message as TX:, this bit will be stripped later */
|
/* 0x8000 marks this message as TX:, this bit will be stripped later */
|
||||||
pvt->last_iax_message = f->subclass | MARK_IAX_SUBCLASS_TX;
|
pvt->last_iax_message = f->subclass.integer | MARK_IAX_SUBCLASS_TX;
|
||||||
if (!pvt->first_iax_message) {
|
if (!pvt->first_iax_message) {
|
||||||
pvt->first_iax_message = pvt->last_iax_message;
|
pvt->first_iax_message = pvt->last_iax_message;
|
||||||
}
|
}
|
||||||
|
@ -6244,9 +6249,9 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
pvt->aseqno = fr->iseqno;
|
pvt->aseqno = fr->iseqno;
|
||||||
fh->type = fr->af.frametype & 0xFF;
|
fh->type = fr->af.frametype & 0xFF;
|
||||||
if (fr->af.frametype == AST_FRAME_VIDEO)
|
if (fr->af.frametype == AST_FRAME_VIDEO)
|
||||||
fh->csub = compress_subclass(fr->af.subclass & ~0x1) | ((fr->af.subclass & 0x1) << 6);
|
fh->csub = compress_subclass(fr->af.subclass.codec & ~0x1LL) | ((fr->af.subclass.codec & 0x1LL) << 6);
|
||||||
else
|
else
|
||||||
fh->csub = compress_subclass(fr->af.subclass);
|
fh->csub = compress_subclass(fr->af.subclass.codec);
|
||||||
if (transfer) {
|
if (transfer) {
|
||||||
fr->dcallno = pvt->transfercallno;
|
fr->dcallno = pvt->transfercallno;
|
||||||
} else
|
} else
|
||||||
|
@ -6262,12 +6267,12 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
if (fr->retrytime > MAX_RETRY_TIME)
|
if (fr->retrytime > MAX_RETRY_TIME)
|
||||||
fr->retrytime = MAX_RETRY_TIME;
|
fr->retrytime = MAX_RETRY_TIME;
|
||||||
/* Acks' don't get retried */
|
/* Acks' don't get retried */
|
||||||
if ((f->frametype == AST_FRAME_IAX) && (f->subclass == IAX_COMMAND_ACK))
|
if ((f->frametype == AST_FRAME_IAX) && (f->subclass.integer == IAX_COMMAND_ACK))
|
||||||
fr->retries = -1;
|
fr->retries = -1;
|
||||||
else if (f->frametype == AST_FRAME_VOICE)
|
else if (f->frametype == AST_FRAME_VOICE)
|
||||||
pvt->svoiceformat = f->subclass;
|
pvt->svoiceformat = f->subclass.codec;
|
||||||
else if (f->frametype == AST_FRAME_VIDEO)
|
else if (f->frametype == AST_FRAME_VIDEO)
|
||||||
pvt->svideoformat = f->subclass & ~0x1;
|
pvt->svideoformat = f->subclass.codec & ~0x1LL;
|
||||||
if (ast_test_flag64(pvt, IAX_ENCRYPTED)) {
|
if (ast_test_flag64(pvt, IAX_ENCRYPTED)) {
|
||||||
if (ast_test_flag64(pvt, IAX_KEYPOPULATED)) {
|
if (ast_test_flag64(pvt, IAX_KEYPOPULATED)) {
|
||||||
if (fr->transfer)
|
if (fr->transfer)
|
||||||
|
@ -6298,7 +6303,7 @@ static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned in
|
||||||
vh = (struct ast_iax2_video_hdr *)(fr->af.data.ptr - sizeof(struct ast_iax2_video_hdr));
|
vh = (struct ast_iax2_video_hdr *)(fr->af.data.ptr - sizeof(struct ast_iax2_video_hdr));
|
||||||
vh->zeros = 0;
|
vh->zeros = 0;
|
||||||
vh->callno = htons(0x8000 | fr->callno);
|
vh->callno = htons(0x8000 | fr->callno);
|
||||||
vh->ts = htons((fr->ts & 0x7FFF) | (fr->af.subclass & 0x1 ? 0x8000 : 0));
|
vh->ts = htons((fr->ts & 0x7FFF) | (fr->af.subclass.codec & 0x1LL ? 0x8000 : 0));
|
||||||
fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_video_hdr);
|
fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_video_hdr);
|
||||||
fr->data = vh;
|
fr->data = vh;
|
||||||
fr->retries = -1;
|
fr->retries = -1;
|
||||||
|
@ -7213,7 +7218,7 @@ static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsig
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
f.frametype = type;
|
f.frametype = type;
|
||||||
f.subclass = command;
|
f.subclass.integer = command;
|
||||||
f.datalen = datalen;
|
f.datalen = datalen;
|
||||||
f.src = __FUNCTION__;
|
f.src = __FUNCTION__;
|
||||||
f.data.ptr = (void *) data;
|
f.data.ptr = (void *) data;
|
||||||
|
@ -7328,7 +7333,7 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
|
||||||
version = ies->version;
|
version = ies->version;
|
||||||
|
|
||||||
/* Use provided preferences until told otherwise for actual preferences */
|
/* Use provided preferences until told otherwise for actual preferences */
|
||||||
if(ies->codec_prefs) {
|
if (ies->codec_prefs) {
|
||||||
ast_codec_pref_convert(&iaxs[callno]->rprefs, ies->codec_prefs, 32, 0);
|
ast_codec_pref_convert(&iaxs[callno]->rprefs, ies->codec_prefs, 32, 0);
|
||||||
ast_codec_pref_convert(&iaxs[callno]->prefs, ies->codec_prefs, 32, 0);
|
ast_codec_pref_convert(&iaxs[callno]->prefs, ies->codec_prefs, 32, 0);
|
||||||
}
|
}
|
||||||
|
@ -9407,7 +9412,7 @@ static int socket_process_meta(int packet_len, struct ast_iax2_meta_hdr *meta, s
|
||||||
ast_log(LOG_WARNING, "Received trunked frame before first full voice frame\n");
|
ast_log(LOG_WARNING, "Received trunked frame before first full voice frame\n");
|
||||||
iax2_vnak(fr->callno);
|
iax2_vnak(fr->callno);
|
||||||
} else {
|
} else {
|
||||||
f.subclass = iaxs[fr->callno]->voiceformat;
|
f.subclass.codec = iaxs[fr->callno]->voiceformat;
|
||||||
f.datalen = len;
|
f.datalen = len;
|
||||||
if (f.datalen >= 0) {
|
if (f.datalen >= 0) {
|
||||||
if (f.datalen)
|
if (f.datalen)
|
||||||
|
@ -9568,7 +9573,7 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
struct iax2_peer *peer;
|
struct iax2_peer *peer;
|
||||||
struct iax_ies ies;
|
struct iax_ies ies;
|
||||||
struct iax_ie_data ied0, ied1;
|
struct iax_ie_data ied0, ied1;
|
||||||
int format;
|
format_t format;
|
||||||
int fd;
|
int fd;
|
||||||
int exists;
|
int exists;
|
||||||
int minivid = 0;
|
int minivid = 0;
|
||||||
|
@ -9639,17 +9644,19 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
/* Retrieve the type and subclass */
|
/* Retrieve the type and subclass */
|
||||||
f.frametype = fh->type;
|
f.frametype = fh->type;
|
||||||
if (f.frametype == AST_FRAME_VIDEO) {
|
if (f.frametype == AST_FRAME_VIDEO) {
|
||||||
f.subclass = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1);
|
f.subclass.codec = uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1);
|
||||||
|
} else if (f.frametype == AST_FRAME_VOICE) {
|
||||||
|
f.subclass.codec = uncompress_subclass(fh->csub);
|
||||||
} else {
|
} else {
|
||||||
f.subclass = uncompress_subclass(fh->csub);
|
f.subclass.integer = uncompress_subclass(fh->csub);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deal with POKE/PONG without allocating a callno */
|
/* Deal with POKE/PONG without allocating a callno */
|
||||||
if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_POKE) {
|
if (f.frametype == AST_FRAME_IAX && f.subclass.integer == IAX_COMMAND_POKE) {
|
||||||
/* Reply back with a PONG, but don't care about the result. */
|
/* Reply back with a PONG, but don't care about the result. */
|
||||||
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_ACK && dcallno == 1) {
|
} else if (f.frametype == AST_FRAME_IAX && f.subclass.integer == IAX_COMMAND_ACK && dcallno == 1) {
|
||||||
/* Ignore */
|
/* Ignore */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -9675,7 +9682,7 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
memset(&ies, 0, sizeof(ies));
|
memset(&ies, 0, sizeof(ies));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcallno && iax2_allow_new(f.frametype, f.subclass, 1)) {
|
if (!dcallno && iax2_allow_new(f.frametype, f.subclass.integer, 1)) {
|
||||||
/* only set NEW_ALLOW if calltoken checks out */
|
/* only set NEW_ALLOW if calltoken checks out */
|
||||||
if (handle_call_token(fh, &ies, &sin, fd)) {
|
if (handle_call_token(fh, &ies, &sin, fd)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -9694,7 +9701,7 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
} else {
|
} else {
|
||||||
/* Don't know anything about it yet */
|
/* Don't know anything about it yet */
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
f.subclass = 0;
|
f.subclass.integer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fr->callno) {
|
if (!fr->callno) {
|
||||||
|
@ -9708,14 +9715,14 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
* http://lists.digium.com/pipermail/asterisk-dev/2008-May/033217.html
|
* http://lists.digium.com/pipermail/asterisk-dev/2008-May/033217.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((ntohs(mh->callno) & IAX_FLAG_FULL) && ((f.frametype == AST_FRAME_IAX) && (f.subclass == IAX_COMMAND_ACK))) {
|
if ((ntohs(mh->callno) & IAX_FLAG_FULL) && ((f.frametype == AST_FRAME_IAX) && (f.subclass.integer == IAX_COMMAND_ACK))) {
|
||||||
check_dcallno = 1;
|
check_dcallno = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fr->callno = find_callno(ntohs(mh->callno) & ~IAX_FLAG_FULL, dcallno, &sin, new, fd, check_dcallno))) {
|
if (!(fr->callno = find_callno(ntohs(mh->callno) & ~IAX_FLAG_FULL, dcallno, &sin, new, fd, check_dcallno))) {
|
||||||
if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_NEW) {
|
if (f.frametype == AST_FRAME_IAX && f.subclass.integer == IAX_COMMAND_NEW) {
|
||||||
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_REJECT, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_REJECT, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
||||||
} else if (f.frametype == AST_FRAME_IAX && (f.subclass == IAX_COMMAND_REGREQ || f.subclass == IAX_COMMAND_REGREL)) {
|
} else if (f.frametype == AST_FRAME_IAX && (f.subclass.integer == IAX_COMMAND_REGREQ || f.subclass.integer == IAX_COMMAND_REGREL)) {
|
||||||
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_REGREJ, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_REGREJ, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -9730,10 +9737,10 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
frame, reply with an inval */
|
frame, reply with an inval */
|
||||||
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
|
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
|
||||||
/* We can only raw hangup control frames */
|
/* We can only raw hangup control frames */
|
||||||
if (((f.subclass != IAX_COMMAND_INVAL) &&
|
if (((f.subclass.integer != IAX_COMMAND_INVAL) &&
|
||||||
(f.subclass != IAX_COMMAND_TXCNT) &&
|
(f.subclass.integer != IAX_COMMAND_TXCNT) &&
|
||||||
(f.subclass != IAX_COMMAND_TXACC) &&
|
(f.subclass.integer != IAX_COMMAND_TXACC) &&
|
||||||
(f.subclass != IAX_COMMAND_FWDOWNL))||
|
(f.subclass.integer != IAX_COMMAND_FWDOWNL))||
|
||||||
(f.frametype != AST_FRAME_IAX))
|
(f.frametype != AST_FRAME_IAX))
|
||||||
raw_hangup(&sin, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, ntohs(mh->callno) & ~IAX_FLAG_FULL,
|
raw_hangup(&sin, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, ntohs(mh->callno) & ~IAX_FLAG_FULL,
|
||||||
fd);
|
fd);
|
||||||
|
@ -9762,8 +9769,8 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
iaxs[fr->callno]->frames_received++;
|
iaxs[fr->callno]->frames_received++;
|
||||||
|
|
||||||
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && !minivid &&
|
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && !minivid &&
|
||||||
f.subclass != IAX_COMMAND_TXCNT && /* for attended transfer */
|
f.subclass.integer != IAX_COMMAND_TXCNT && /* for attended transfer */
|
||||||
f.subclass != IAX_COMMAND_TXACC) { /* for attended transfer */
|
f.subclass.integer != IAX_COMMAND_TXACC) { /* for attended transfer */
|
||||||
unsigned short new_peercallno;
|
unsigned short new_peercallno;
|
||||||
|
|
||||||
new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
|
new_peercallno = (unsigned short) (ntohs(mh->callno) & ~IAX_FLAG_FULL);
|
||||||
|
@ -9777,7 +9784,7 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
}
|
}
|
||||||
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
|
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
|
||||||
if (iaxdebug)
|
if (iaxdebug)
|
||||||
ast_debug(1, "Received packet %d, (%d, %d)\n", fh->oseqno, f.frametype, f.subclass);
|
ast_debug(1, "Received packet %d, (%d, %u)\n", fh->oseqno, f.frametype, f.subclass.integer);
|
||||||
/* Check if it's out of order (and not an ACK or INVAL) */
|
/* Check if it's out of order (and not an ACK or INVAL) */
|
||||||
fr->oseqno = fh->oseqno;
|
fr->oseqno = fh->oseqno;
|
||||||
fr->iseqno = fh->iseqno;
|
fr->iseqno = fh->iseqno;
|
||||||
|
@ -9800,31 +9807,31 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
updatehistory = 0;
|
updatehistory = 0;
|
||||||
if ((iaxs[fr->callno]->iseqno != fr->oseqno) &&
|
if ((iaxs[fr->callno]->iseqno != fr->oseqno) &&
|
||||||
(iaxs[fr->callno]->iseqno ||
|
(iaxs[fr->callno]->iseqno ||
|
||||||
((f.subclass != IAX_COMMAND_TXCNT) &&
|
((f.subclass.integer != IAX_COMMAND_TXCNT) &&
|
||||||
(f.subclass != IAX_COMMAND_TXREADY) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_TXREADY) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_TXREL) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_TXREL) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_TXACC)) ||
|
(f.subclass.integer != IAX_COMMAND_TXACC)) ||
|
||||||
(f.frametype != AST_FRAME_IAX))) {
|
(f.frametype != AST_FRAME_IAX))) {
|
||||||
if (
|
if (
|
||||||
((f.subclass != IAX_COMMAND_ACK) &&
|
((f.subclass.integer != IAX_COMMAND_ACK) &&
|
||||||
(f.subclass != IAX_COMMAND_INVAL) &&
|
(f.subclass.integer != IAX_COMMAND_INVAL) &&
|
||||||
(f.subclass != IAX_COMMAND_TXCNT) &&
|
(f.subclass.integer != IAX_COMMAND_TXCNT) &&
|
||||||
(f.subclass != IAX_COMMAND_TXREADY) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_TXREADY) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_TXREL) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_TXREL) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
|
(f.subclass.integer != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
|
||||||
(f.subclass != IAX_COMMAND_TXACC) &&
|
(f.subclass.integer != IAX_COMMAND_TXACC) &&
|
||||||
(f.subclass != IAX_COMMAND_VNAK)) ||
|
(f.subclass.integer != IAX_COMMAND_VNAK)) ||
|
||||||
(f.frametype != AST_FRAME_IAX)) {
|
(f.frametype != AST_FRAME_IAX)) {
|
||||||
/* If it's not an ACK packet, it's out of order. */
|
/* If it's not an ACK packet, it's out of order. */
|
||||||
ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
|
ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
|
||||||
iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass);
|
iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, f.subclass.integer);
|
||||||
/* Check to see if we need to request retransmission,
|
/* Check to see if we need to request retransmission,
|
||||||
* and take sequence number wraparound into account */
|
* and take sequence number wraparound into account */
|
||||||
if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) {
|
if ((unsigned char) (iaxs[fr->callno]->iseqno - fr->oseqno) < 128) {
|
||||||
/* If we've already seen it, ack it XXX There's a border condition here XXX */
|
/* If we've already seen it, ack it XXX There's a border condition here XXX */
|
||||||
if ((f.frametype != AST_FRAME_IAX) ||
|
if ((f.frametype != AST_FRAME_IAX) ||
|
||||||
((f.subclass != IAX_COMMAND_ACK) && (f.subclass != IAX_COMMAND_INVAL))) {
|
((f.subclass.integer != IAX_COMMAND_ACK) && (f.subclass.integer != IAX_COMMAND_INVAL))) {
|
||||||
ast_debug(1, "Acking anyway\n");
|
ast_debug(1, "Acking anyway\n");
|
||||||
/* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
|
/* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
|
||||||
we have anything to send, we'll retransmit and get an ACK back anyway XXX */
|
we have anything to send, we'll retransmit and get an ACK back anyway XXX */
|
||||||
|
@ -9839,11 +9846,11 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Increment unless it's an ACK or VNAK */
|
/* Increment unless it's an ACK or VNAK */
|
||||||
if (((f.subclass != IAX_COMMAND_ACK) &&
|
if (((f.subclass.integer != IAX_COMMAND_ACK) &&
|
||||||
(f.subclass != IAX_COMMAND_INVAL) &&
|
(f.subclass.integer != IAX_COMMAND_INVAL) &&
|
||||||
(f.subclass != IAX_COMMAND_TXCNT) &&
|
(f.subclass.integer != IAX_COMMAND_TXCNT) &&
|
||||||
(f.subclass != IAX_COMMAND_TXACC) &&
|
(f.subclass.integer != IAX_COMMAND_TXACC) &&
|
||||||
(f.subclass != IAX_COMMAND_VNAK)) ||
|
(f.subclass.integer != IAX_COMMAND_VNAK)) ||
|
||||||
(f.frametype != AST_FRAME_IAX))
|
(f.frametype != AST_FRAME_IAX))
|
||||||
iaxs[fr->callno]->iseqno++;
|
iaxs[fr->callno]->iseqno++;
|
||||||
}
|
}
|
||||||
|
@ -9858,7 +9865,7 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
/* Handle implicit ACKing unless this is an INVAL, and only if this is
|
/* Handle implicit ACKing unless this is an INVAL, and only if this is
|
||||||
from the real peer, not the transfer peer */
|
from the real peer, not the transfer peer */
|
||||||
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
|
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
|
||||||
((f.subclass != IAX_COMMAND_INVAL) ||
|
((f.subclass.integer != IAX_COMMAND_INVAL) ||
|
||||||
(f.frametype != AST_FRAME_IAX))) {
|
(f.frametype != AST_FRAME_IAX))) {
|
||||||
unsigned char x;
|
unsigned char x;
|
||||||
int call_to_destroy;
|
int call_to_destroy;
|
||||||
|
@ -9906,8 +9913,8 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
}
|
}
|
||||||
if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
|
if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
|
||||||
((f.frametype != AST_FRAME_IAX) ||
|
((f.frametype != AST_FRAME_IAX) ||
|
||||||
((f.subclass != IAX_COMMAND_TXACC) &&
|
((f.subclass.integer != IAX_COMMAND_TXACC) &&
|
||||||
(f.subclass != IAX_COMMAND_TXCNT)))) {
|
(f.subclass.integer != IAX_COMMAND_TXCNT)))) {
|
||||||
/* Only messages we accept from a transfer host are TXACC and TXCNT */
|
/* Only messages we accept from a transfer host are TXACC and TXCNT */
|
||||||
ast_mutex_unlock(&iaxsl[fr->callno]);
|
ast_mutex_unlock(&iaxsl[fr->callno]);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -9987,16 +9994,16 @@ static int socket_process(struct iax2_thread *thread)
|
||||||
|
|
||||||
/* once we receive our first IAX Full Frame that is not CallToken related, send all
|
/* once we receive our first IAX Full Frame that is not CallToken related, send all
|
||||||
* queued signaling frames that were being held. */
|
* queued signaling frames that were being held. */
|
||||||
if ((f.frametype == AST_FRAME_IAX) && (f.subclass != IAX_COMMAND_CALLTOKEN) && iaxs[fr->callno]->hold_signaling) {
|
if ((f.frametype == AST_FRAME_IAX) && (f.subclass.integer != IAX_COMMAND_CALLTOKEN) && iaxs[fr->callno]->hold_signaling) {
|
||||||
send_signaling(iaxs[fr->callno]);
|
send_signaling(iaxs[fr->callno]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f.frametype == AST_FRAME_VOICE) {
|
if (f.frametype == AST_FRAME_VOICE) {
|
||||||
if (f.subclass != iaxs[fr->callno]->voiceformat) {
|
if (f.subclass.codec != iaxs[fr->callno]->voiceformat) {
|
||||||
iaxs[fr->callno]->voiceformat = f.subclass;
|
iaxs[fr->callno]->voiceformat = f.subclass.codec;
|
||||||
ast_debug(1, "Ooh, voice format changed to %d\n", f.subclass);
|
ast_debug(1, "Ooh, voice format changed to '%s'\n", ast_getformatname(f.subclass.codec));
|
||||||
if (iaxs[fr->callno]->owner) {
|
if (iaxs[fr->callno]->owner) {
|
||||||
int orignative;
|
format_t orignative;
|
||||||
retryowner:
|
retryowner:
|
||||||
if (ast_channel_trylock(iaxs[fr->callno]->owner)) {
|
if (ast_channel_trylock(iaxs[fr->callno]->owner)) {
|
||||||
DEADLOCK_AVOIDANCE(&iaxsl[fr->callno]);
|
DEADLOCK_AVOIDANCE(&iaxsl[fr->callno]);
|
||||||
|
@ -10005,7 +10012,7 @@ retryowner:
|
||||||
if (iaxs[fr->callno]) {
|
if (iaxs[fr->callno]) {
|
||||||
if (iaxs[fr->callno]->owner) {
|
if (iaxs[fr->callno]->owner) {
|
||||||
orignative = iaxs[fr->callno]->owner->nativeformats;
|
orignative = iaxs[fr->callno]->owner->nativeformats;
|
||||||
iaxs[fr->callno]->owner->nativeformats = f.subclass;
|
iaxs[fr->callno]->owner->nativeformats = f.subclass.codec;
|
||||||
if (iaxs[fr->callno]->owner->readformat)
|
if (iaxs[fr->callno]->owner->readformat)
|
||||||
ast_set_read_format(iaxs[fr->callno]->owner, iaxs[fr->callno]->owner->readformat);
|
ast_set_read_format(iaxs[fr->callno]->owner, iaxs[fr->callno]->owner->readformat);
|
||||||
iaxs[fr->callno]->owner->nativeformats = orignative;
|
iaxs[fr->callno]->owner->nativeformats = orignative;
|
||||||
|
@ -10026,15 +10033,15 @@ retryowner:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f.frametype == AST_FRAME_VIDEO) {
|
if (f.frametype == AST_FRAME_VIDEO) {
|
||||||
if (f.subclass != iaxs[fr->callno]->videoformat) {
|
if (f.subclass.codec != iaxs[fr->callno]->videoformat) {
|
||||||
ast_debug(1, "Ooh, video format changed to %d\n", f.subclass & ~0x1);
|
ast_debug(1, "Ooh, video format changed to %s\n", ast_getformatname(f.subclass.codec & ~0x1LL));
|
||||||
iaxs[fr->callno]->videoformat = f.subclass & ~0x1;
|
iaxs[fr->callno]->videoformat = f.subclass.codec & ~0x1LL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (f.frametype == AST_FRAME_CONTROL && iaxs[fr->callno]->owner) {
|
if (f.frametype == AST_FRAME_CONTROL && iaxs[fr->callno]->owner) {
|
||||||
if (f.subclass == AST_CONTROL_BUSY) {
|
if (f.subclass.integer == AST_CONTROL_BUSY) {
|
||||||
iaxs[fr->callno]->owner->hangupcause = AST_CAUSE_BUSY;
|
iaxs[fr->callno]->owner->hangupcause = AST_CAUSE_BUSY;
|
||||||
} else if (f.subclass == AST_CONTROL_CONGESTION) {
|
} else if (f.subclass.integer == AST_CONTROL_CONGESTION) {
|
||||||
iaxs[fr->callno]->owner->hangupcause = AST_CAUSE_CONGESTION;
|
iaxs[fr->callno]->owner->hangupcause = AST_CAUSE_CONGESTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10042,22 +10049,22 @@ retryowner:
|
||||||
ast_sched_thread_del(sched, iaxs[fr->callno]->initid);
|
ast_sched_thread_del(sched, iaxs[fr->callno]->initid);
|
||||||
/* Handle the IAX pseudo frame itself */
|
/* Handle the IAX pseudo frame itself */
|
||||||
if (iaxdebug)
|
if (iaxdebug)
|
||||||
ast_debug(1, "IAX subclass %d received\n", f.subclass);
|
ast_debug(1, "IAX subclass %d received\n", f.subclass.integer);
|
||||||
|
|
||||||
/* Update last ts unless the frame's timestamp originated with us. */
|
/* Update last ts unless the frame's timestamp originated with us. */
|
||||||
if (iaxs[fr->callno]->last < fr->ts &&
|
if (iaxs[fr->callno]->last < fr->ts &&
|
||||||
f.subclass != IAX_COMMAND_ACK &&
|
f.subclass.integer != IAX_COMMAND_ACK &&
|
||||||
f.subclass != IAX_COMMAND_PONG &&
|
f.subclass.integer != IAX_COMMAND_PONG &&
|
||||||
f.subclass != IAX_COMMAND_LAGRP) {
|
f.subclass.integer != IAX_COMMAND_LAGRP) {
|
||||||
iaxs[fr->callno]->last = fr->ts;
|
iaxs[fr->callno]->last = fr->ts;
|
||||||
if (iaxdebug)
|
if (iaxdebug)
|
||||||
ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts);
|
ast_debug(1, "For call=%d, set last=%d\n", fr->callno, fr->ts);
|
||||||
}
|
}
|
||||||
iaxs[fr->callno]->last_iax_message = f.subclass;
|
iaxs[fr->callno]->last_iax_message = f.subclass.integer;
|
||||||
if (!iaxs[fr->callno]->first_iax_message) {
|
if (!iaxs[fr->callno]->first_iax_message) {
|
||||||
iaxs[fr->callno]->first_iax_message = f.subclass;
|
iaxs[fr->callno]->first_iax_message = f.subclass.integer;
|
||||||
}
|
}
|
||||||
switch(f.subclass) {
|
switch(f.subclass.integer) {
|
||||||
case IAX_COMMAND_ACK:
|
case IAX_COMMAND_ACK:
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
break;
|
break;
|
||||||
|
@ -10237,10 +10244,19 @@ retryowner:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (authdebug) {
|
if (authdebug) {
|
||||||
if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP))
|
char tmp[256], tmp2[256], tmp3[256];
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested 0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->capability);
|
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||||
else
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability 0x%x/0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->peercapability, iaxs[fr->callno]->capability);
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp, sizeof(tmp), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->capability));
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp, sizeof(tmp), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->peercapability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), iaxs[fr->callno]->capability));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Pick one... */
|
/* Pick one... */
|
||||||
|
@ -10271,17 +10287,23 @@ retryowner:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!format) {
|
if (!format) {
|
||||||
|
char tmp[256], tmp2[256], tmp3[256];
|
||||||
memset(&ied0, 0, sizeof(ied0));
|
memset(&ied0, 0, sizeof(ied0));
|
||||||
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
||||||
iax_ie_append_byte(&ied0, IAX_IE_CAUSECODE, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
|
iax_ie_append_byte(&ied0, IAX_IE_CAUSECODE, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL);
|
||||||
ast_log(LOG_ERROR, "No best format in 0x%x???\n", iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability);
|
ast_log(LOG_ERROR, "No best format in '%s'???\n", ast_getformatname_multiple(tmp, sizeof(tmp), iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability));
|
||||||
send_command_final(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied0.buf, ied0.pos, -1);
|
send_command_final(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied0.buf, ied0.pos, -1);
|
||||||
if (!iaxs[fr->callno]) {
|
if (!iaxs[fr->callno]) {
|
||||||
ast_mutex_unlock(&iaxsl[fr->callno]);
|
ast_mutex_unlock(&iaxsl[fr->callno]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (authdebug)
|
if (authdebug) {
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability 0x%x/0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->peercapability, iaxs[fr->callno]->capability);
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp, sizeof(tmp), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->peercapability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), iaxs[fr->callno]->capability));
|
||||||
|
}
|
||||||
ast_set_flag64(iaxs[fr->callno], IAX_ALREADYGONE);
|
ast_set_flag64(iaxs[fr->callno], IAX_ALREADYGONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -10456,8 +10478,13 @@ retryowner:
|
||||||
ast_mutex_unlock(&iaxsl[fr->callno]);
|
ast_mutex_unlock(&iaxsl[fr->callno]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (authdebug)
|
if (authdebug) {
|
||||||
ast_log(LOG_NOTICE, "Rejected call to %s, format 0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->capability);
|
char tmp1[256], tmp2[256];
|
||||||
|
ast_log(LOG_NOTICE, "Rejected call to %s, format %s incompatible with our capability %s.\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->capability));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
||||||
if (iaxs[fr->callno]->owner) {
|
if (iaxs[fr->callno]->owner) {
|
||||||
|
@ -10565,9 +10592,9 @@ retryowner2:
|
||||||
f.offset = 0;
|
f.offset = 0;
|
||||||
f.samples = 0;
|
f.samples = 0;
|
||||||
iax_frame_wrap(fr, &f);
|
iax_frame_wrap(fr, &f);
|
||||||
if(f.subclass == IAX_COMMAND_LAGRQ) {
|
if (f.subclass.integer == IAX_COMMAND_LAGRQ) {
|
||||||
/* Received a LAGRQ - echo back a LAGRP */
|
/* Received a LAGRQ - echo back a LAGRP */
|
||||||
fr->af.subclass = IAX_COMMAND_LAGRP;
|
fr->af.subclass.integer = IAX_COMMAND_LAGRP;
|
||||||
iax2_send(iaxs[fr->callno], &fr->af, fr->ts, -1, 0, 0, 0);
|
iax2_send(iaxs[fr->callno], &fr->af, fr->ts, -1, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
/* Received LAGRP in response to our LAGRQ */
|
/* Received LAGRP in response to our LAGRQ */
|
||||||
|
@ -10587,7 +10614,7 @@ retryowner2:
|
||||||
}
|
}
|
||||||
if (authenticate_reply(iaxs[fr->callno], &iaxs[fr->callno]->addr, &ies, iaxs[fr->callno]->secret, iaxs[fr->callno]->outkey)) {
|
if (authenticate_reply(iaxs[fr->callno], &iaxs[fr->callno]->addr, &ies, iaxs[fr->callno]->secret, iaxs[fr->callno]->outkey)) {
|
||||||
struct ast_frame hangup_fr = { .frametype = AST_FRAME_CONTROL,
|
struct ast_frame hangup_fr = { .frametype = AST_FRAME_CONTROL,
|
||||||
.subclass = AST_CONTROL_HANGUP,
|
.subclass.integer = AST_CONTROL_HANGUP,
|
||||||
};
|
};
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"I don't know how to authenticate %s to %s\n",
|
"I don't know how to authenticate %s to %s\n",
|
||||||
|
@ -10661,16 +10688,26 @@ retryowner2:
|
||||||
ast_codec_pref_string(&iaxs[fr->callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1);
|
ast_codec_pref_string(&iaxs[fr->callno]->prefs, host_pref_buf, sizeof(host_pref_buf) - 1);
|
||||||
}
|
}
|
||||||
if (!format) {
|
if (!format) {
|
||||||
|
char tmp1[256], tmp2[256], tmp3[256];
|
||||||
if(!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
if(!ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||||
ast_debug(1, "We don't do requested format %s, falling back to peer capability %d\n", ast_getformatname(iaxs[fr->callno]->peerformat), iaxs[fr->callno]->peercapability);
|
ast_debug(1, "We don't do requested format %s, falling back to peer capability '%s'\n",
|
||||||
|
ast_getformatname(iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peercapability));
|
||||||
format = iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability;
|
format = iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability;
|
||||||
}
|
}
|
||||||
if (!format) {
|
if (!format) {
|
||||||
if (authdebug) {
|
if (authdebug) {
|
||||||
if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP))
|
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested 0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->capability);
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n", ast_inet_ntoa(sin.sin_addr),
|
||||||
else
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peerformat),
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability 0x%x/0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->peercapability, iaxs[fr->callno]->capability);
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->capability));
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->peercapability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), iaxs[fr->callno]->capability));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memset(&ied0, 0, sizeof(ied0));
|
memset(&ied0, 0, sizeof(ied0));
|
||||||
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
||||||
|
@ -10709,12 +10746,22 @@ retryowner2:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_ERROR, "No best format in 0x%x???\n", iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability);
|
char tmp1[256], tmp2[256], tmp3[256];
|
||||||
|
ast_log(LOG_ERROR, "No best format in %s???\n",
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peercapability & iaxs[fr->callno]->capability));
|
||||||
if (authdebug) {
|
if (authdebug) {
|
||||||
if(ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP))
|
if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested 0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->capability);
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%s' incompatible with our capability '%s'.\n",
|
||||||
else
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability 0x%x/0x%x incompatible with our capability 0x%x.\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat, iaxs[fr->callno]->peercapability, iaxs[fr->callno]->capability);
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->capability));
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested/capability '%s'/'%s' incompatible with our capability '%s'.\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), iaxs[fr->callno]->peerformat),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), iaxs[fr->callno]->peercapability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), iaxs[fr->callno]->capability));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memset(&ied0, 0, sizeof(ied0));
|
memset(&ied0, 0, sizeof(ied0));
|
||||||
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
|
||||||
|
@ -10818,8 +10865,11 @@ immediatedial:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
char tmp[256];
|
||||||
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
||||||
ast_verb(3, "Accepting DIAL from %s, formats = 0x%x\n", ast_inet_ntoa(sin.sin_addr), iaxs[fr->callno]->peerformat);
|
ast_verb(3, "Accepting DIAL from %s, formats = %s\n",
|
||||||
|
ast_inet_ntoa(sin.sin_addr),
|
||||||
|
ast_getformatname_multiple(tmp, sizeof(tmp), iaxs[fr->callno]->peerformat));
|
||||||
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
|
||||||
send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1);
|
send_command(iaxs[fr->callno], AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, 0, NULL, 0, -1);
|
||||||
if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat, NULL)))
|
if (!(c = ast_iax2_new(fr->callno, AST_STATE_RING, iaxs[fr->callno]->peerformat, NULL)))
|
||||||
|
@ -10894,7 +10944,7 @@ immediatedial:
|
||||||
if ((ast_strlen_zero(iaxs[fr->callno]->secret) && ast_strlen_zero(iaxs[fr->callno]->inkeys)) ||
|
if ((ast_strlen_zero(iaxs[fr->callno]->secret) && ast_strlen_zero(iaxs[fr->callno]->inkeys)) ||
|
||||||
ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED)) {
|
ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_AUTHENTICATED)) {
|
||||||
|
|
||||||
if (f.subclass == IAX_COMMAND_REGREL)
|
if (f.subclass.integer == IAX_COMMAND_REGREL)
|
||||||
memset(&sin, 0, sizeof(sin));
|
memset(&sin, 0, sizeof(sin));
|
||||||
if (update_registry(&sin, fr->callno, ies.devicetype, fd, ies.refresh))
|
if (update_registry(&sin, fr->callno, ies.devicetype, fd, ies.refresh))
|
||||||
ast_log(LOG_WARNING, "Registry error\n");
|
ast_log(LOG_WARNING, "Registry error\n");
|
||||||
|
@ -11085,9 +11135,9 @@ immediatedial:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ast_debug(1, "Unknown IAX command %d on %d/%d\n", f.subclass, fr->callno, iaxs[fr->callno]->peercallno);
|
ast_debug(1, "Unknown IAX command %d on %d/%d\n", f.subclass.integer, fr->callno, iaxs[fr->callno]->peercallno);
|
||||||
memset(&ied0, 0, sizeof(ied0));
|
memset(&ied0, 0, sizeof(ied0));
|
||||||
iax_ie_append_byte(&ied0, IAX_IE_IAX_UNKNOWN, f.subclass);
|
iax_ie_append_byte(&ied0, IAX_IE_IAX_UNKNOWN, f.subclass.integer);
|
||||||
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, ied0.buf, ied0.pos, -1);
|
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, ied0.buf, ied0.pos, -1);
|
||||||
}
|
}
|
||||||
/* Free remote variables (if any) */
|
/* Free remote variables (if any) */
|
||||||
|
@ -11098,11 +11148,11 @@ immediatedial:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't actually pass these frames along */
|
/* Don't actually pass these frames along */
|
||||||
if ((f.subclass != IAX_COMMAND_ACK) &&
|
if ((f.subclass.integer != IAX_COMMAND_ACK) &&
|
||||||
(f.subclass != IAX_COMMAND_TXCNT) &&
|
(f.subclass.integer != IAX_COMMAND_TXCNT) &&
|
||||||
(f.subclass != IAX_COMMAND_TXACC) &&
|
(f.subclass.integer != IAX_COMMAND_TXACC) &&
|
||||||
(f.subclass != IAX_COMMAND_INVAL) &&
|
(f.subclass.integer != IAX_COMMAND_INVAL) &&
|
||||||
(f.subclass != IAX_COMMAND_VNAK)) {
|
(f.subclass.integer != IAX_COMMAND_VNAK)) {
|
||||||
if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
|
if (iaxs[fr->callno] && iaxs[fr->callno]->aseqno != iaxs[fr->callno]->iseqno)
|
||||||
send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
|
send_command_immediate(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr->ts, NULL, 0,fr->iseqno);
|
||||||
}
|
}
|
||||||
|
@ -11115,7 +11165,7 @@ immediatedial:
|
||||||
} else if (minivid) {
|
} else if (minivid) {
|
||||||
f.frametype = AST_FRAME_VIDEO;
|
f.frametype = AST_FRAME_VIDEO;
|
||||||
if (iaxs[fr->callno]->videoformat > 0)
|
if (iaxs[fr->callno]->videoformat > 0)
|
||||||
f.subclass = iaxs[fr->callno]->videoformat | (ntohs(vh->ts) & 0x8000 ? 1 : 0);
|
f.subclass.codec = iaxs[fr->callno]->videoformat | (ntohs(vh->ts) & 0x8000LL ? 1 : 0);
|
||||||
else {
|
else {
|
||||||
ast_log(LOG_WARNING, "Received mini frame before first full video frame\n");
|
ast_log(LOG_WARNING, "Received mini frame before first full video frame\n");
|
||||||
iax2_vnak(fr->callno);
|
iax2_vnak(fr->callno);
|
||||||
|
@ -11137,7 +11187,7 @@ immediatedial:
|
||||||
/* A mini frame */
|
/* A mini frame */
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
if (iaxs[fr->callno]->voiceformat > 0)
|
if (iaxs[fr->callno]->voiceformat > 0)
|
||||||
f.subclass = iaxs[fr->callno]->voiceformat;
|
f.subclass.codec = iaxs[fr->callno]->voiceformat;
|
||||||
else {
|
else {
|
||||||
ast_debug(1, "Received mini frame before first full voice frame\n");
|
ast_debug(1, "Received mini frame before first full voice frame\n");
|
||||||
iax2_vnak(fr->callno);
|
iax2_vnak(fr->callno);
|
||||||
|
@ -11168,7 +11218,7 @@ immediatedial:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Don't allow connected line updates unless we are configured to */
|
/* Don't allow connected line updates unless we are configured to */
|
||||||
if (f.frametype == AST_FRAME_CONTROL && f.subclass == AST_CONTROL_CONNECTED_LINE) {
|
if (f.frametype == AST_FRAME_CONTROL && f.subclass.integer == AST_CONTROL_CONNECTED_LINE) {
|
||||||
struct ast_party_connected_line connected;
|
struct ast_party_connected_line connected;
|
||||||
|
|
||||||
if (!ast_test_flag64(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) {
|
if (!ast_test_flag64(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) {
|
||||||
|
@ -11200,7 +11250,7 @@ immediatedial:
|
||||||
if (f.datalen && (f.frametype == AST_FRAME_VOICE)) {
|
if (f.datalen && (f.frametype == AST_FRAME_VOICE)) {
|
||||||
f.samples = ast_codec_get_samples(&f);
|
f.samples = ast_codec_get_samples(&f);
|
||||||
/* We need to byteswap incoming slinear samples from network byte order */
|
/* We need to byteswap incoming slinear samples from network byte order */
|
||||||
if (f.subclass == AST_FORMAT_SLINEAR)
|
if (f.subclass.codec == AST_FORMAT_SLINEAR)
|
||||||
ast_frame_byteswap_be(&f);
|
ast_frame_byteswap_be(&f);
|
||||||
} else
|
} else
|
||||||
f.samples = 0;
|
f.samples = 0;
|
||||||
|
@ -11212,7 +11262,7 @@ immediatedial:
|
||||||
fr->outoforder = 0;
|
fr->outoforder = 0;
|
||||||
} else {
|
} else {
|
||||||
if (iaxdebug && iaxs[fr->callno])
|
if (iaxdebug && iaxs[fr->callno])
|
||||||
ast_debug(1, "Received out of order packet... (type=%d, subclass %d, ts = %d, last = %d)\n", f.frametype, f.subclass, fr->ts, iaxs[fr->callno]->last);
|
ast_debug(1, "Received out of order packet... (type=%d, subclass %d, ts = %d, last = %d)\n", f.frametype, f.subclass.integer, fr->ts, iaxs[fr->callno]->last);
|
||||||
fr->outoforder = -1;
|
fr->outoforder = -1;
|
||||||
}
|
}
|
||||||
fr->cacheable = ((f.frametype == AST_FRAME_VOICE) || (f.frametype == AST_FRAME_VIDEO));
|
fr->cacheable = ((f.frametype == AST_FRAME_VOICE) || (f.frametype == AST_FRAME_VIDEO));
|
||||||
|
@ -11670,11 +11720,11 @@ static void free_context(struct iax2_context *con)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *iax2_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *iax2_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int callno;
|
int callno;
|
||||||
int res;
|
int res;
|
||||||
int fmt, native;
|
format_t fmt, native;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
struct ast_channel *c;
|
struct ast_channel *c;
|
||||||
struct parsed_dial_string pds;
|
struct parsed_dial_string pds;
|
||||||
|
@ -12579,7 +12629,7 @@ static void set_config_destroy(void)
|
||||||
static int set_config(const char *config_file, int reload)
|
static int set_config(const char *config_file, int reload)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg, *ucfg;
|
struct ast_config *cfg, *ucfg;
|
||||||
int capability=iax2_capability;
|
format_t capability = iax2_capability;
|
||||||
struct ast_variable *v;
|
struct ast_variable *v;
|
||||||
char *cat;
|
char *cat;
|
||||||
const char *utype;
|
const char *utype;
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct jingle_pvt {
|
||||||
iksrule *ringrule; /*!< Rule for matching RING request */
|
iksrule *ringrule; /*!< Rule for matching RING request */
|
||||||
int initiator; /*!< If we're the initiator */
|
int initiator; /*!< If we're the initiator */
|
||||||
int alreadygone;
|
int alreadygone;
|
||||||
int capability;
|
format_t capability;
|
||||||
struct ast_codec_pref prefs;
|
struct ast_codec_pref prefs;
|
||||||
struct jingle_candidate *theircandidates;
|
struct jingle_candidate *theircandidates;
|
||||||
struct jingle_candidate *ourcandidates;
|
struct jingle_candidate *ourcandidates;
|
||||||
|
@ -115,8 +115,8 @@ struct jingle_pvt {
|
||||||
struct ast_rtp_instance *rtp; /*!< RTP audio session */
|
struct ast_rtp_instance *rtp; /*!< RTP audio session */
|
||||||
char video_content_name[100]; /*!< name attribute of content tag */
|
char video_content_name[100]; /*!< name attribute of content tag */
|
||||||
struct ast_rtp_instance *vrtp; /*!< RTP video session */
|
struct ast_rtp_instance *vrtp; /*!< RTP video session */
|
||||||
int jointcapability; /*!< Supported capability at both ends (codecs ) */
|
format_t jointcapability; /*!< Supported capability at both ends (codecs ) */
|
||||||
int peercapability;
|
format_t peercapability;
|
||||||
struct jingle_pvt *next; /* Next entity */
|
struct jingle_pvt *next; /* Next entity */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ struct jingle {
|
||||||
char user[100];
|
char user[100];
|
||||||
char context[100];
|
char context[100];
|
||||||
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
|
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
|
||||||
int capability;
|
format_t capability;
|
||||||
ast_group_t callgroup; /*!< Call group */
|
ast_group_t callgroup; /*!< Call group */
|
||||||
ast_group_t pickupgroup; /*!< Pickup group */
|
ast_group_t pickupgroup; /*!< Pickup group */
|
||||||
int callingpres; /*!< Calling presentation */
|
int callingpres; /*!< Calling presentation */
|
||||||
|
@ -163,12 +163,12 @@ struct jingle_container {
|
||||||
static const char desc[] = "Jingle Channel";
|
static const char desc[] = "Jingle Channel";
|
||||||
static const char channel_type[] = "Jingle";
|
static const char channel_type[] = "Jingle";
|
||||||
|
|
||||||
static int global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
static format_t global_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
|
||||||
|
|
||||||
AST_MUTEX_DEFINE_STATIC(jinglelock); /*!< Protect the interface list (of jingle_pvt's) */
|
AST_MUTEX_DEFINE_STATIC(jinglelock); /*!< Protect the interface list (of jingle_pvt's) */
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *jingle_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int jingle_sendtext(struct ast_channel *ast, const char *text);
|
static int jingle_sendtext(struct ast_channel *ast, const char *text);
|
||||||
static int jingle_digit_begin(struct ast_channel *ast, char digit);
|
static int jingle_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
|
@ -300,7 +300,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
|
||||||
struct aji_client *c = client->connection;
|
struct aji_client *c = client->connection;
|
||||||
iks *iq, *jingle, *dcodecs, *payload_red, *payload_audio, *payload_cn;
|
iks *iq, *jingle, *dcodecs, *payload_red, *payload_audio, *payload_cn;
|
||||||
int x;
|
int x;
|
||||||
int pref_codec = 0;
|
format_t pref_codec = 0;
|
||||||
int alreadysent = 0;
|
int alreadysent = 0;
|
||||||
|
|
||||||
if (p->initiator)
|
if (p->initiator)
|
||||||
|
@ -312,7 +312,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
|
||||||
if (iq && jingle && dcodecs) {
|
if (iq && jingle && dcodecs) {
|
||||||
iks_insert_attrib(dcodecs, "xmlns", JINGLE_AUDIO_RTP_NS);
|
iks_insert_attrib(dcodecs, "xmlns", JINGLE_AUDIO_RTP_NS);
|
||||||
|
|
||||||
for (x = 0; x < 32; x++) {
|
for (x = 0; x < 64; x++) {
|
||||||
if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
|
if (!(pref_codec = ast_codec_pref_index(&client->prefs, x)))
|
||||||
break;
|
break;
|
||||||
if (!(client->capability & pref_codec))
|
if (!(client->capability & pref_codec))
|
||||||
|
@ -404,13 +404,13 @@ static enum ast_rtp_glue_result jingle_get_rtp_peer(struct ast_channel *chan, st
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jingle_get_codec(struct ast_channel *chan)
|
static format_t jingle_get_codec(struct ast_channel *chan)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p = chan->tech_pvt;
|
struct jingle_pvt *p = chan->tech_pvt;
|
||||||
return p->peercapability;
|
return p->peercapability;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int jingle_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, int codecs, int nat_active)
|
static int jingle_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p;
|
struct jingle_pvt *p;
|
||||||
|
|
||||||
|
@ -511,19 +511,19 @@ static int jingle_handle_dtmf(struct jingle *client, ikspak *pak)
|
||||||
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
|
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
|
||||||
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
|
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer);
|
||||||
} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
|
} else if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-down")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer);
|
||||||
} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
|
} else if(iks_find_attrib(pak->x, "dtmf")) { /* 250 millasecond default */
|
||||||
struct ast_frame f = {AST_FRAME_DTMF, };
|
struct ast_frame f = {AST_FRAME_DTMF, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((dtmfnode = iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info"))) {
|
} else if ((dtmfnode = iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info"))) {
|
||||||
|
@ -531,14 +531,14 @@ static int jingle_handle_dtmf(struct jingle *client, ikspak *pak)
|
||||||
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
|
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
|
||||||
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
|
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
struct ast_frame f = {AST_FRAME_DTMF_END, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer);
|
||||||
} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
|
} else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
|
||||||
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
|
||||||
f.subclass = dtmf[0];
|
f.subclass.integer = dtmf[0];
|
||||||
ast_queue_frame(tmp->owner, &f);
|
ast_queue_frame(tmp->owner, &f);
|
||||||
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1169,17 +1169,17 @@ static struct ast_frame *jingle_rtp_read(struct ast_channel *ast, struct jingle_
|
||||||
if (p->owner) {
|
if (p->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
if (f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
||||||
ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
|
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
|
||||||
p->owner->nativeformats =
|
p->owner->nativeformats =
|
||||||
(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass;
|
(p->owner->nativeformats & AST_FORMAT_VIDEO_MASK) | f->subclass.codec;
|
||||||
ast_set_read_format(p->owner, p->owner->readformat);
|
ast_set_read_format(p->owner, p->owner->readformat);
|
||||||
ast_set_write_format(p->owner, p->owner->writeformat);
|
ast_set_write_format(p->owner, p->owner->writeformat);
|
||||||
}
|
}
|
||||||
/* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) {
|
/* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) {
|
||||||
f = ast_dsp_process(p->owner, p->vad, f);
|
f = ast_dsp_process(p->owner, p->vad, f);
|
||||||
if (f && (f->frametype == AST_FRAME_DTMF))
|
if (f && (f->frametype == AST_FRAME_DTMF))
|
||||||
ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass);
|
ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.codec);
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1202,14 +1202,17 @@ static int jingle_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p = ast->tech_pvt;
|
struct jingle_pvt *p = ast->tech_pvt;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
switch (frame->frametype) {
|
switch (frame->frametype) {
|
||||||
case AST_FRAME_VOICE:
|
case AST_FRAME_VOICE:
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
|
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
|
||||||
frame->subclass, ast->nativeformats, ast->readformat,
|
ast_getformatname(frame->subclass.codec),
|
||||||
ast->writeformat);
|
ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
|
||||||
|
ast_getformatname(ast->readformat),
|
||||||
|
ast_getformatname(ast->writeformat));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -1479,7 +1482,7 @@ static int jingle_hangup(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Part of PBX interface */
|
/*! \brief Part of PBX interface */
|
||||||
static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *jingle_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p = NULL;
|
struct jingle_pvt *p = NULL;
|
||||||
struct jingle *client = NULL;
|
struct jingle *client = NULL;
|
||||||
|
|
|
@ -60,7 +60,7 @@ static struct ast_jb_conf g_jb_conf = {
|
||||||
.impl = "",
|
.impl = "",
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct ast_channel *local_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *local_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int local_digit_begin(struct ast_channel *ast, char digit);
|
static int local_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int local_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
static int local_call(struct ast_channel *ast, char *dest, int timeout);
|
static int local_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
|
@ -273,7 +273,7 @@ static int local_answer(struct ast_channel *ast)
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
if (isoutbound) {
|
if (isoutbound) {
|
||||||
/* Pass along answer since somebody answered us */
|
/* Pass along answer since somebody answered us */
|
||||||
struct ast_frame answer = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
struct ast_frame answer = { AST_FRAME_CONTROL, { AST_CONTROL_ANSWER } };
|
||||||
res = local_queue_frame(p, isoutbound, &answer, ast, 1);
|
res = local_queue_frame(p, isoutbound, &answer, ast, 1);
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n");
|
ast_log(LOG_WARNING, "Huh? Local is being asked to answer?\n");
|
||||||
|
@ -443,7 +443,7 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
|
||||||
} else {
|
} else {
|
||||||
f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), &this_channel->redirecting);
|
f.datalen = ast_redirecting_build_data(frame_data, sizeof(frame_data), &this_channel->redirecting);
|
||||||
}
|
}
|
||||||
f.subclass = condition;
|
f.subclass.integer = condition;
|
||||||
f.data.ptr = frame_data;
|
f.data.ptr = frame_data;
|
||||||
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) {
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) {
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
@ -455,7 +455,7 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
|
||||||
/* Queue up a frame representing the indication as a control frame */
|
/* Queue up a frame representing the indication as a control frame */
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = condition;
|
f.subclass.integer = condition;
|
||||||
f.data.ptr = (void*)data;
|
f.data.ptr = (void*)data;
|
||||||
f.datalen = datalen;
|
f.datalen = datalen;
|
||||||
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1)))
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1)))
|
||||||
|
@ -477,7 +477,7 @@ static int local_digit_begin(struct ast_channel *ast, char digit)
|
||||||
|
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = digit;
|
f.subclass.integer = digit;
|
||||||
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
|
||||||
|
@ -496,7 +496,7 @@ static int local_digit_end(struct ast_channel *ast, char digit, unsigned int dur
|
||||||
|
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = digit;
|
f.subclass.integer = digit;
|
||||||
f.len = duration;
|
f.len = duration;
|
||||||
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
@ -535,7 +535,7 @@ static int local_sendhtml(struct ast_channel *ast, int subclass, const char *dat
|
||||||
|
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
isoutbound = IS_OUTBOUND(ast, p);
|
isoutbound = IS_OUTBOUND(ast, p);
|
||||||
f.subclass = subclass;
|
f.subclass.integer = subclass;
|
||||||
f.data.ptr = (char *)data;
|
f.data.ptr = (char *)data;
|
||||||
f.datalen = datalen;
|
f.datalen = datalen;
|
||||||
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
|
||||||
|
@ -646,7 +646,7 @@ static int local_hangup(struct ast_channel *ast)
|
||||||
{
|
{
|
||||||
struct local_pvt *p = ast->tech_pvt;
|
struct local_pvt *p = ast->tech_pvt;
|
||||||
int isoutbound;
|
int isoutbound;
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, .data.uint32 = ast->hangupcause };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_HANGUP }, .data.uint32 = ast->hangupcause };
|
||||||
struct ast_channel *ochan = NULL;
|
struct ast_channel *ochan = NULL;
|
||||||
int glaredetect = 0, res = 0;
|
int glaredetect = 0, res = 0;
|
||||||
|
|
||||||
|
@ -857,7 +857,7 @@ static struct ast_channel *local_new(struct local_pvt *p, int state, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Part of PBX interface */
|
/*! \brief Part of PBX interface */
|
||||||
static struct ast_channel *local_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *local_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct local_pvt *p = NULL;
|
struct local_pvt *p = NULL;
|
||||||
struct ast_channel *chan = NULL;
|
struct ast_channel *chan = NULL;
|
||||||
|
|
|
@ -216,7 +216,7 @@ static pthread_t monitor_thread = AST_PTHREADT_NULL;
|
||||||
|
|
||||||
static int restart_monitor(void);
|
static int restart_monitor(void);
|
||||||
|
|
||||||
static int capability = AST_FORMAT_ULAW;
|
static format_t capability = AST_FORMAT_ULAW;
|
||||||
static int nonCodecCapability = AST_RTP_DTMF;
|
static int nonCodecCapability = AST_RTP_DTMF;
|
||||||
|
|
||||||
static char ourhost[MAXHOSTNAMELEN];
|
static char ourhost[MAXHOSTNAMELEN];
|
||||||
|
@ -355,7 +355,7 @@ struct mgcp_endpoint {
|
||||||
int iseq; /*!< Not used? */
|
int iseq; /*!< Not used? */
|
||||||
int lastout; /*!< tracking this on the subchannels. Is it needed here? */
|
int lastout; /*!< tracking this on the subchannels. Is it needed here? */
|
||||||
int needdestroy; /*!< Not used? */
|
int needdestroy; /*!< Not used? */
|
||||||
int capability;
|
format_t capability;
|
||||||
int nonCodecCapability;
|
int nonCodecCapability;
|
||||||
int onhooktime;
|
int onhooktime;
|
||||||
int msgstate; /*!< voicemail message state */
|
int msgstate; /*!< voicemail message state */
|
||||||
|
@ -423,7 +423,7 @@ static int transmit_notify_request(struct mgcp_subchannel *sub, char *tone);
|
||||||
static int transmit_modify_request(struct mgcp_subchannel *sub);
|
static int transmit_modify_request(struct mgcp_subchannel *sub);
|
||||||
static int transmit_connect(struct mgcp_subchannel *sub);
|
static int transmit_connect(struct mgcp_subchannel *sub);
|
||||||
static int transmit_notify_request_with_callerid(struct mgcp_subchannel *sub, char *tone, char *callernum, char *callername);
|
static int transmit_notify_request_with_callerid(struct mgcp_subchannel *sub, char *tone, char *callernum, char *callername);
|
||||||
static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp, int codecs);
|
static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp, format_t codecs);
|
||||||
static int transmit_connection_del(struct mgcp_subchannel *sub);
|
static int transmit_connection_del(struct mgcp_subchannel *sub);
|
||||||
static int transmit_audit_endpoint(struct mgcp_endpoint *p);
|
static int transmit_audit_endpoint(struct mgcp_endpoint *p);
|
||||||
static void start_rtp(struct mgcp_subchannel *sub);
|
static void start_rtp(struct mgcp_subchannel *sub);
|
||||||
|
@ -433,7 +433,7 @@ static void dump_cmd_queues(struct mgcp_endpoint *p, struct mgcp_subchannel *sub
|
||||||
static char *mgcp_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
static char *mgcp_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
|
||||||
static int reload_config(int reload);
|
static int reload_config(int reload);
|
||||||
|
|
||||||
static struct ast_channel *mgcp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *mgcp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int mgcp_call(struct ast_channel *ast, char *dest, int timeout);
|
static int mgcp_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
static int mgcp_hangup(struct ast_channel *ast);
|
static int mgcp_hangup(struct ast_channel *ast);
|
||||||
static int mgcp_answer(struct ast_channel *ast);
|
static int mgcp_answer(struct ast_channel *ast);
|
||||||
|
@ -639,8 +639,7 @@ static void mgcp_queue_hangup(struct mgcp_subchannel *sub)
|
||||||
|
|
||||||
static void mgcp_queue_control(struct mgcp_subchannel *sub, int control)
|
static void mgcp_queue_control(struct mgcp_subchannel *sub, int control)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, };
|
struct ast_frame f = { AST_FRAME_CONTROL, { control } };
|
||||||
f.subclass = control;
|
|
||||||
return mgcp_queue_frame(sub, &f);
|
return mgcp_queue_frame(sub, &f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,9 +1193,9 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
|
||||||
if (sub->owner) {
|
if (sub->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != sub->owner->nativeformats) {
|
if (f->subclass.codec != sub->owner->nativeformats) {
|
||||||
ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
|
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
|
||||||
sub->owner->nativeformats = f->subclass;
|
sub->owner->nativeformats = f->subclass.codec;
|
||||||
ast_set_read_format(sub->owner, sub->owner->readformat);
|
ast_set_read_format(sub->owner, sub->owner->readformat);
|
||||||
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
||||||
}
|
}
|
||||||
|
@ -1227,6 +1226,8 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
{
|
{
|
||||||
struct mgcp_subchannel *sub = ast->tech_pvt;
|
struct mgcp_subchannel *sub = ast->tech_pvt;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
if (frame->frametype != AST_FRAME_VOICE) {
|
if (frame->frametype != AST_FRAME_VOICE) {
|
||||||
if (frame->frametype == AST_FRAME_IMAGE)
|
if (frame->frametype == AST_FRAME_IMAGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1235,9 +1236,12 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
|
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
|
||||||
frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
|
ast_getformatname(frame->subclass.codec),
|
||||||
|
ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
|
||||||
|
ast_getformatname(ast->readformat),
|
||||||
|
ast_getformatname(ast->writeformat));
|
||||||
/* return -1; */
|
/* return -1; */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1911,13 +1915,15 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
|
||||||
char host[258];
|
char host[258];
|
||||||
int len;
|
int len;
|
||||||
int portno;
|
int portno;
|
||||||
int peercapability, peerNonCodecCapability;
|
format_t peercapability;
|
||||||
|
int peerNonCodecCapability;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
char *codecs;
|
char *codecs;
|
||||||
struct ast_hostent ahp; struct hostent *hp;
|
struct ast_hostent ahp; struct hostent *hp;
|
||||||
int codec, codec_count=0;
|
int codec, codec_count=0;
|
||||||
int iterator;
|
int iterator;
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
|
char tmp1[256], tmp2[256], tmp3[256];
|
||||||
|
|
||||||
/* Get codec and RTP info from SDP */
|
/* Get codec and RTP info from SDP */
|
||||||
m = get_sdp(req, "m");
|
m = get_sdp(req, "m");
|
||||||
|
@ -1975,8 +1981,10 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
|
||||||
/* Now gather all of the codecs that were asked for: */
|
/* Now gather all of the codecs that were asked for: */
|
||||||
ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), &peercapability, &peerNonCodecCapability);
|
ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), &peercapability, &peerNonCodecCapability);
|
||||||
p->capability = capability & peercapability;
|
p->capability = capability & peercapability;
|
||||||
ast_debug(1, "Capabilities: us - %d, them - %d, combined - %d\n",
|
ast_debug(1, "Capabilities: us - %s, them - %s, combined - %s\n",
|
||||||
capability, peercapability, p->capability);
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), capability),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), peercapability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), p->capability));
|
||||||
ast_debug(1, "Non-codec capabilities: us - %d, them - %d, combined - %d\n",
|
ast_debug(1, "Non-codec capabilities: us - %d, them - %d, combined - %d\n",
|
||||||
nonCodecCapability, peerNonCodecCapability, p->nonCodecCapability);
|
nonCodecCapability, peerNonCodecCapability, p->nonCodecCapability);
|
||||||
if (!p->capability) {
|
if (!p->capability) {
|
||||||
|
@ -2131,7 +2139,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
|
||||||
char t[256];
|
char t[256];
|
||||||
char m[256] = "";
|
char m[256] = "";
|
||||||
char a[1024] = "";
|
char a[1024] = "";
|
||||||
int x;
|
format_t x;
|
||||||
struct sockaddr_in dest = { 0, };
|
struct sockaddr_in dest = { 0, };
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
/* XXX We break with the "recommendation" and send our IP, in order that our
|
/* XXX We break with the "recommendation" and send our IP, in order that our
|
||||||
|
@ -2162,9 +2170,13 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
|
||||||
snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
|
snprintf(c, sizeof(c), "c=IN IP4 %s\r\n", ast_inet_ntoa(dest.sin_addr));
|
||||||
ast_copy_string(t, "t=0 0\r\n", sizeof(t));
|
ast_copy_string(t, "t=0 0\r\n", sizeof(t));
|
||||||
snprintf(m, sizeof(m), "m=audio %d RTP/AVP", ntohs(dest.sin_port));
|
snprintf(m, sizeof(m), "m=audio %d RTP/AVP", ntohs(dest.sin_port));
|
||||||
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
for (x = 1LL; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
||||||
|
if (!(x & AST_FORMAT_AUDIO_MASK)) {
|
||||||
|
/* Audio is now discontiguous */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (p->capability & x) {
|
if (p->capability & x) {
|
||||||
ast_debug(1, "Answering with capability %d\n", x);
|
ast_debug(1, "Answering with capability %s\n", ast_getformatname(x));
|
||||||
codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, x);
|
codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 1, x);
|
||||||
if (codec > -1) {
|
if (codec > -1) {
|
||||||
snprintf(costr, sizeof(costr), " %d", codec);
|
snprintf(costr, sizeof(costr), " %d", codec);
|
||||||
|
@ -2174,9 +2186,9 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
|
for (x = 1LL; x <= AST_RTP_MAX; x <<= 1) {
|
||||||
if (p->nonCodecCapability & x) {
|
if (p->nonCodecCapability & x) {
|
||||||
ast_debug(1, "Answering with non-codec capability %d\n", x);
|
ast_debug(1, "Answering with non-codec capability %d\n", (int) x);
|
||||||
codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 0, x);
|
codec = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(sub->rtp), 0, x);
|
||||||
if (codec > -1) {
|
if (codec > -1) {
|
||||||
snprintf(costr, sizeof(costr), " %d", codec);
|
snprintf(costr, sizeof(costr), " %d", codec);
|
||||||
|
@ -2205,13 +2217,13 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp, int codecs)
|
static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp_instance *rtp, format_t codecs)
|
||||||
{
|
{
|
||||||
struct mgcp_request resp;
|
struct mgcp_request resp;
|
||||||
char local[256];
|
char local[256];
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
int x;
|
format_t x;
|
||||||
|
|
||||||
if (ast_strlen_zero(sub->cxident) && rtp) {
|
if (ast_strlen_zero(sub->cxident) && rtp) {
|
||||||
/* We don't have a CXident yet, store the destination and
|
/* We don't have a CXident yet, store the destination and
|
||||||
|
@ -2221,6 +2233,10 @@ static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp_
|
||||||
}
|
}
|
||||||
ast_copy_string(local, "e:on, s:off, p:20", sizeof(local));
|
ast_copy_string(local, "e:on, s:off, p:20", sizeof(local));
|
||||||
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
||||||
|
if (!(x & AST_FORMAT_AUDIO_MASK)) {
|
||||||
|
/* No longer contiguous */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (p->capability & x) {
|
if (p->capability & x) {
|
||||||
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
||||||
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
||||||
|
@ -2270,6 +2286,10 @@ static int transmit_connect_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp
|
||||||
ast_copy_string(local, "e:on, s:off, p:20", sizeof(local));
|
ast_copy_string(local, "e:on, s:off, p:20", sizeof(local));
|
||||||
|
|
||||||
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
||||||
|
if (!(x & AST_FORMAT_AUDIO_MASK)) {
|
||||||
|
/* No longer contiguous */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (p->capability & x) {
|
if (p->capability & x) {
|
||||||
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
||||||
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
||||||
|
@ -2352,12 +2372,12 @@ static int transmit_connect(struct mgcp_subchannel *sub)
|
||||||
struct mgcp_request resp;
|
struct mgcp_request resp;
|
||||||
char local[256];
|
char local[256];
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
int x;
|
format_t x;
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
|
|
||||||
ast_copy_string(local, "p:20, s:off, e:on", sizeof(local));
|
ast_copy_string(local, "p:20, s:off, e:on", sizeof(local));
|
||||||
|
|
||||||
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
for (x = 1LL; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
|
||||||
if (p->capability & x) {
|
if (p->capability & x) {
|
||||||
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
|
||||||
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
|
||||||
|
@ -2455,7 +2475,8 @@ static int transmit_modify_request(struct mgcp_subchannel *sub)
|
||||||
{
|
{
|
||||||
struct mgcp_request resp;
|
struct mgcp_request resp;
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
int x, fc;
|
format_t x;
|
||||||
|
int fc = 1;
|
||||||
char local[256];
|
char local[256];
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
|
|
||||||
|
@ -3468,7 +3489,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
|
||||||
(ev[0] == '*') || (ev[0] == '#'))) {
|
(ev[0] == '*') || (ev[0] == '#'))) {
|
||||||
if (sub && sub->owner && (sub->owner->_state >= AST_STATE_UP)) {
|
if (sub && sub->owner && (sub->owner->_state >= AST_STATE_UP)) {
|
||||||
f.frametype = AST_FRAME_DTMF;
|
f.frametype = AST_FRAME_DTMF;
|
||||||
f.subclass = ev[0];
|
f.subclass.integer = ev[0];
|
||||||
f.src = "mgcp";
|
f.src = "mgcp";
|
||||||
/* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
|
/* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
|
||||||
mgcp_queue_frame(sub, &f);
|
mgcp_queue_frame(sub, &f);
|
||||||
|
@ -3825,9 +3846,9 @@ static int restart_monitor(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *mgcp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *mgcp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
struct mgcp_subchannel *sub;
|
struct mgcp_subchannel *sub;
|
||||||
struct ast_channel *tmpc = NULL;
|
struct ast_channel *tmpc = NULL;
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
@ -3836,7 +3857,7 @@ static struct ast_channel *mgcp_request(const char *type, int format, const stru
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
format &= capability;
|
format &= capability;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
|
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), format));
|
||||||
/*return NULL;*/
|
/*return NULL;*/
|
||||||
}
|
}
|
||||||
ast_copy_string(tmp, dest, sizeof(tmp));
|
ast_copy_string(tmp, dest, sizeof(tmp));
|
||||||
|
@ -4315,7 +4336,7 @@ static enum ast_rtp_glue_result mgcp_get_rtp_peer(struct ast_channel *chan, stru
|
||||||
return AST_RTP_GLUE_RESULT_LOCAL;
|
return AST_RTP_GLUE_RESULT_LOCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
|
static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
/* XXX Is there such thing as video support with MGCP? XXX */
|
/* XXX Is there such thing as video support with MGCP? XXX */
|
||||||
struct mgcp_subchannel *sub;
|
struct mgcp_subchannel *sub;
|
||||||
|
@ -4327,7 +4348,7 @@ static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mgcp_get_codec(struct ast_channel *chan)
|
static format_t mgcp_get_codec(struct ast_channel *chan)
|
||||||
{
|
{
|
||||||
struct mgcp_subchannel *sub = chan->tech_pvt;
|
struct mgcp_subchannel *sub = chan->tech_pvt;
|
||||||
struct mgcp_endpoint *p = sub->parent;
|
struct mgcp_endpoint *p = sub->parent;
|
||||||
|
|
|
@ -6977,9 +6977,9 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass);
|
ast_debug(1, "Detected inband DTMF digit: %c\n", f->subclass.integer);
|
||||||
|
|
||||||
if (tmp->faxdetect && (f->subclass == 'f')) {
|
if (tmp->faxdetect && (f->subclass.integer == 'f')) {
|
||||||
/* Fax tone -- Handle and return NULL */
|
/* Fax tone -- Handle and return NULL */
|
||||||
if (!tmp->faxhandled) {
|
if (!tmp->faxhandled) {
|
||||||
struct ast_channel *ast = tmp->ast;
|
struct ast_channel *ast = tmp->ast;
|
||||||
|
@ -7028,8 +7028,8 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp->ast_dsp && (f->subclass != 'f')) {
|
if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
|
||||||
chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass);
|
chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
|
@ -7084,7 +7084,7 @@ static struct ast_frame *misdn_read(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp->frame.frametype = AST_FRAME_VOICE;
|
tmp->frame.frametype = AST_FRAME_VOICE;
|
||||||
tmp->frame.subclass = AST_FORMAT_ALAW;
|
tmp->frame.subclass.codec = AST_FORMAT_ALAW;
|
||||||
tmp->frame.datalen = len;
|
tmp->frame.datalen = len;
|
||||||
tmp->frame.samples = len;
|
tmp->frame.samples = len;
|
||||||
tmp->frame.mallocd = 0;
|
tmp->frame.mallocd = 0;
|
||||||
|
@ -7150,13 +7150,13 @@ static int misdn_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!frame->subclass) {
|
if (!frame->subclass.codec) {
|
||||||
chan_misdn_log(4, ch->bc->port, "misdn_write: * prods us\n");
|
chan_misdn_log(4, ch->bc->port, "misdn_write: * prods us\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(frame->subclass & prefformat)) {
|
if (!(frame->subclass.codec & prefformat)) {
|
||||||
chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%d\n", frame->subclass);
|
chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%s\n", ast_getformatname(frame->subclass.codec));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7301,7 +7301,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
|
||||||
if (!f) {
|
if (!f) {
|
||||||
chan_misdn_log(4, ch1->bc->port, "Read Null Frame\n");
|
chan_misdn_log(4, ch1->bc->port, "Read Null Frame\n");
|
||||||
} else {
|
} else {
|
||||||
chan_misdn_log(4, ch1->bc->port, "Read Frame Control class:%d\n", f->subclass);
|
chan_misdn_log(4, ch1->bc->port, "Read Frame Control class:%d\n", f->subclass.integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
*fo = f;
|
*fo = f;
|
||||||
|
@ -7310,7 +7310,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass, who->exten);
|
chan_misdn_log(1, 0, "Read DTMF %d from %s\n", f->subclass.integer, who->exten);
|
||||||
|
|
||||||
*fo = f;
|
*fo = f;
|
||||||
*rc = who;
|
*rc = who;
|
||||||
|
@ -7437,7 +7437,7 @@ static struct chan_list *init_chan_list(int orig)
|
||||||
return cl;
|
return cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *misdn_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *misdn_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct ast_channel *ast;
|
struct ast_channel *ast;
|
||||||
char group[BUFFERSIZE + 1] = "";
|
char group[BUFFERSIZE + 1] = "";
|
||||||
|
@ -8280,7 +8280,7 @@ static void do_immediate_setup(struct misdn_bchannel *bc, struct chan_list *ch,
|
||||||
|
|
||||||
while (!ast_strlen_zero(predial)) {
|
while (!ast_strlen_zero(predial)) {
|
||||||
fr.frametype = AST_FRAME_DTMF;
|
fr.frametype = AST_FRAME_DTMF;
|
||||||
fr.subclass = *predial;
|
fr.subclass.integer = *predial;
|
||||||
fr.src = NULL;
|
fr.src = NULL;
|
||||||
fr.data.ptr = NULL;
|
fr.data.ptr = NULL;
|
||||||
fr.datalen = 0;
|
fr.datalen = 0;
|
||||||
|
@ -9547,7 +9547,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
|
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_DTMF;
|
fr.frametype = AST_FRAME_DTMF;
|
||||||
fr.subclass = bc->dtmf ;
|
fr.subclass.integer = bc->dtmf ;
|
||||||
fr.src = NULL;
|
fr.src = NULL;
|
||||||
fr.data.ptr = NULL;
|
fr.data.ptr = NULL;
|
||||||
fr.datalen = 0;
|
fr.datalen = 0;
|
||||||
|
@ -9647,7 +9647,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
|
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_DTMF;
|
fr.frametype = AST_FRAME_DTMF;
|
||||||
fr.subclass = bc->info_dad[0] ;
|
fr.subclass.integer = bc->info_dad[0] ;
|
||||||
fr.src = NULL;
|
fr.src = NULL;
|
||||||
fr.data.ptr = NULL;
|
fr.data.ptr = NULL;
|
||||||
fr.datalen = 0;
|
fr.datalen = 0;
|
||||||
|
@ -10304,7 +10304,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
|
||||||
|
|
||||||
/* In Data Modes we queue frames */
|
/* In Data Modes we queue frames */
|
||||||
frame.frametype = AST_FRAME_VOICE; /* we have no data frames yet */
|
frame.frametype = AST_FRAME_VOICE; /* we have no data frames yet */
|
||||||
frame.subclass = AST_FORMAT_ALAW;
|
frame.subclass.codec = AST_FORMAT_ALAW;
|
||||||
frame.datalen = bc->bframe_len;
|
frame.datalen = bc->bframe_len;
|
||||||
frame.samples = bc->bframe_len;
|
frame.samples = bc->bframe_len;
|
||||||
frame.mallocd = 0;
|
frame.mallocd = 0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
static const char tdesc[] = "Multicast RTP Paging Channel Driver";
|
static const char tdesc[] = "Multicast RTP Paging Channel Driver";
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static struct ast_channel *multicast_rtp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int multicast_rtp_call(struct ast_channel *ast, char *dest, int timeout);
|
static int multicast_rtp_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
static int multicast_rtp_hangup(struct ast_channel *ast);
|
static int multicast_rtp_hangup(struct ast_channel *ast);
|
||||||
static struct ast_frame *multicast_rtp_read(struct ast_channel *ast);
|
static struct ast_frame *multicast_rtp_read(struct ast_channel *ast);
|
||||||
|
@ -107,13 +107,13 @@ static int multicast_rtp_hangup(struct ast_channel *ast)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Function called when we should prepare to call the destination */
|
/*! \brief Function called when we should prepare to call the destination */
|
||||||
static struct ast_channel *multicast_rtp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *multicast_rtp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
char *tmp = ast_strdupa(data), *multicast_type = tmp, *destination, *control;
|
char *tmp = ast_strdupa(data), *multicast_type = tmp, *destination, *control;
|
||||||
struct ast_rtp_instance *instance;
|
struct ast_rtp_instance *instance;
|
||||||
struct sockaddr_in control_address = { .sin_family = AF_INET, }, destination_address = { .sin_family = AF_INET, };
|
struct sockaddr_in control_address = { .sin_family = AF_INET, }, destination_address = { .sin_family = AF_INET, };
|
||||||
struct ast_channel *chan;
|
struct ast_channel *chan;
|
||||||
int fmt = ast_best_codec(format);
|
format_t fmt = ast_best_codec(format);
|
||||||
|
|
||||||
/* If no type was given we can't do anything */
|
/* If no type was given we can't do anything */
|
||||||
if (ast_strlen_zero(multicast_type)) {
|
if (ast_strlen_zero(multicast_type)) {
|
||||||
|
|
|
@ -325,7 +325,7 @@ static struct chan_oss_pvt oss_default = {
|
||||||
|
|
||||||
static int setformat(struct chan_oss_pvt *o, int mode);
|
static int setformat(struct chan_oss_pvt *o, int mode);
|
||||||
|
|
||||||
static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor,
|
static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor,
|
||||||
void *data, int *cause);
|
void *data, int *cause);
|
||||||
static int oss_digit_begin(struct ast_channel *c, char digit);
|
static int oss_digit_begin(struct ast_channel *c, char digit);
|
||||||
static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration);
|
||||||
|
@ -591,7 +591,7 @@ static int oss_text(struct ast_channel *c, const char *text)
|
||||||
static int oss_call(struct ast_channel *c, char *dest, int timeout)
|
static int oss_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
{
|
{
|
||||||
struct chan_oss_pvt *o = c->tech_pvt;
|
struct chan_oss_pvt *o = c->tech_pvt;
|
||||||
struct ast_frame f = { 0, };
|
struct ast_frame f = { AST_FRAME_CONTROL, };
|
||||||
AST_DECLARE_APP_ARGS(args,
|
AST_DECLARE_APP_ARGS(args,
|
||||||
AST_APP_ARG(name);
|
AST_APP_ARG(name);
|
||||||
AST_APP_ARG(flags);
|
AST_APP_ARG(flags);
|
||||||
|
@ -602,24 +602,20 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout)
|
||||||
|
|
||||||
ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);
|
ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);
|
||||||
if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) {
|
if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) {
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
|
||||||
ast_queue_frame(c, &f);
|
ast_queue_frame(c, &f);
|
||||||
} else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) {
|
} else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) {
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
f.subclass.integer = AST_CONTROL_RINGING;
|
||||||
f.subclass = AST_CONTROL_RINGING;
|
|
||||||
ast_queue_frame(c, &f);
|
ast_queue_frame(c, &f);
|
||||||
ast_indicate(c, AST_CONTROL_RINGING);
|
ast_indicate(c, AST_CONTROL_RINGING);
|
||||||
} else if (o->autoanswer) {
|
} else if (o->autoanswer) {
|
||||||
ast_verbose(" << Auto-answered >> \n");
|
ast_verbose(" << Auto-answered >> \n");
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
|
||||||
ast_queue_frame(c, &f);
|
ast_queue_frame(c, &f);
|
||||||
o->hookstate = 1;
|
o->hookstate = 1;
|
||||||
} else {
|
} else {
|
||||||
ast_verbose("<< Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
|
ast_verbose("<< Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
|
||||||
f.frametype = AST_FRAME_CONTROL;
|
f.subclass.integer = AST_CONTROL_RINGING;
|
||||||
f.subclass = AST_CONTROL_RINGING;
|
|
||||||
ast_queue_frame(c, &f);
|
ast_queue_frame(c, &f);
|
||||||
ast_indicate(c, AST_CONTROL_RINGING);
|
ast_indicate(c, AST_CONTROL_RINGING);
|
||||||
}
|
}
|
||||||
|
@ -717,7 +713,7 @@ static struct ast_frame *oss_read(struct ast_channel *c)
|
||||||
return f;
|
return f;
|
||||||
/* ok we can build and deliver the frame to the caller */
|
/* ok we can build and deliver the frame to the caller */
|
||||||
f->frametype = AST_FRAME_VOICE;
|
f->frametype = AST_FRAME_VOICE;
|
||||||
f->subclass = AST_FORMAT_SLINEAR;
|
f->subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
f->samples = FRAME_SIZE;
|
f->samples = FRAME_SIZE;
|
||||||
f->datalen = FRAME_SIZE * 2;
|
f->datalen = FRAME_SIZE * 2;
|
||||||
f->data.ptr = o->oss_read_buf + AST_FRIENDLY_OFFSET;
|
f->data.ptr = o->oss_read_buf + AST_FRIENDLY_OFFSET;
|
||||||
|
@ -824,7 +820,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx,
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *oss_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *oss_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct ast_channel *c;
|
struct ast_channel *c;
|
||||||
struct chan_oss_pvt *o;
|
struct chan_oss_pvt *o;
|
||||||
|
@ -833,6 +829,7 @@ static struct ast_channel *oss_request(const char *type, int format, const struc
|
||||||
AST_APP_ARG(flags);
|
AST_APP_ARG(flags);
|
||||||
);
|
);
|
||||||
char *parse = ast_strdupa(data);
|
char *parse = ast_strdupa(data);
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
AST_NONSTANDARD_APP_ARGS(args, parse, '/');
|
AST_NONSTANDARD_APP_ARGS(args, parse, '/');
|
||||||
o = find_desc(args.name);
|
o = find_desc(args.name);
|
||||||
|
@ -844,7 +841,7 @@ static struct ast_channel *oss_request(const char *type, int format, const struc
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((format & AST_FORMAT_SLINEAR) == 0) {
|
if ((format & AST_FORMAT_SLINEAR) == 0) {
|
||||||
ast_log(LOG_NOTICE, "Format 0x%x unsupported\n", format);
|
ast_log(LOG_NOTICE, "Format %s unsupported\n", ast_getformatname_multiple(buf, sizeof(buf), format));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (o->owner) {
|
if (o->owner) {
|
||||||
|
@ -942,7 +939,7 @@ static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||||
/*! \brief helper function for the answer key/cli command */
|
/*! \brief helper function for the answer key/cli command */
|
||||||
static char *console_do_answer(int fd)
|
static char *console_do_answer(int fd)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_ANSWER } };
|
||||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||||
if (!o->owner) {
|
if (!o->owner) {
|
||||||
if (fd > -1)
|
if (fd > -1)
|
||||||
|
@ -1007,7 +1004,7 @@ static char *console_sendtext(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
int i = strlen(buf);
|
int i = strlen(buf);
|
||||||
buf[i] = '\n';
|
buf[i] = '\n';
|
||||||
f.frametype = AST_FRAME_TEXT;
|
f.frametype = AST_FRAME_TEXT;
|
||||||
f.subclass = 0;
|
f.subclass.integer = 0;
|
||||||
f.data.ptr = buf;
|
f.data.ptr = buf;
|
||||||
f.datalen = i + 1;
|
f.datalen = i + 1;
|
||||||
ast_queue_frame(o->owner, &f);
|
ast_queue_frame(o->owner, &f);
|
||||||
|
@ -1043,7 +1040,7 @@ static char *console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
|
||||||
|
|
||||||
static char *console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
static char *console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH } };
|
||||||
struct chan_oss_pvt *o = find_desc(oss_active);
|
struct chan_oss_pvt *o = find_desc(oss_active);
|
||||||
|
|
||||||
if (cmd == CLI_INIT) {
|
if (cmd == CLI_INIT) {
|
||||||
|
@ -1086,7 +1083,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
if (o->owner) { /* already in a call */
|
if (o->owner) { /* already in a call */
|
||||||
int i;
|
int i;
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, 0 };
|
struct ast_frame f = { AST_FRAME_DTMF, { 0 } };
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (a->argc == e->args) { /* argument is mandatory here */
|
if (a->argc == e->args) { /* argument is mandatory here */
|
||||||
|
@ -1096,7 +1093,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args
|
||||||
s = a->argv[e->args];
|
s = a->argv[e->args];
|
||||||
/* send the string one char at a time */
|
/* send the string one char at a time */
|
||||||
for (i = 0; i < strlen(s); i++) {
|
for (i = 0; i < strlen(s); i++) {
|
||||||
f.subclass = s[i];
|
f.subclass.integer = s[i];
|
||||||
ast_queue_frame(o->owner, &f);
|
ast_queue_frame(o->owner, &f);
|
||||||
}
|
}
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
|
|
|
@ -125,8 +125,8 @@ static struct phone_pvt {
|
||||||
int fd; /* Raw file descriptor for this device */
|
int fd; /* Raw file descriptor for this device */
|
||||||
struct ast_channel *owner; /* Channel we belong to, possibly NULL */
|
struct ast_channel *owner; /* Channel we belong to, possibly NULL */
|
||||||
int mode; /* Is this in the */
|
int mode; /* Is this in the */
|
||||||
int lastformat; /* Last output format */
|
format_t lastformat; /* Last output format */
|
||||||
int lastinput; /* Last input format */
|
format_t lastinput; /* Last input format */
|
||||||
int ministate; /* Miniature state, for dialtone mode */
|
int ministate; /* Miniature state, for dialtone mode */
|
||||||
char dev[256]; /* Device name */
|
char dev[256]; /* Device name */
|
||||||
struct phone_pvt *next; /* Next channel in list */
|
struct phone_pvt *next; /* Next channel in list */
|
||||||
|
@ -150,7 +150,7 @@ static struct phone_pvt {
|
||||||
static char cid_num[AST_MAX_EXTENSION];
|
static char cid_num[AST_MAX_EXTENSION];
|
||||||
static char cid_name[AST_MAX_EXTENSION];
|
static char cid_name[AST_MAX_EXTENSION];
|
||||||
|
|
||||||
static struct ast_channel *phone_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *phone_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int phone_digit_begin(struct ast_channel *ast, char digit);
|
static int phone_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int phone_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int phone_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
static int phone_call(struct ast_channel *ast, char *dest, int timeout);
|
static int phone_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
|
@ -433,8 +433,8 @@ static int phone_setup(struct ast_channel *ast)
|
||||||
if (p->lastinput != ast->rawreadformat) {
|
if (p->lastinput != ast->rawreadformat) {
|
||||||
p->lastinput = ast->rawreadformat;
|
p->lastinput = ast->rawreadformat;
|
||||||
if (ioctl(p->fd, PHONE_REC_CODEC, ast->rawreadformat)) {
|
if (ioctl(p->fd, PHONE_REC_CODEC, ast->rawreadformat)) {
|
||||||
ast_log(LOG_WARNING, "Failed to set codec to %d\n",
|
ast_log(LOG_WARNING, "Failed to set codec to %s\n",
|
||||||
ast->rawreadformat);
|
ast_getformatname(ast->rawreadformat));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
|
||||||
|
|
||||||
/* We've got a digit -- Just handle this nicely and easily */
|
/* We've got a digit -- Just handle this nicely and easily */
|
||||||
digit = ioctl(p->fd, PHONE_GET_DTMF_ASCII);
|
digit = ioctl(p->fd, PHONE_GET_DTMF_ASCII);
|
||||||
p->fr.subclass = digit;
|
p->fr.subclass.integer = digit;
|
||||||
p->fr.frametype = AST_FRAME_DTMF;
|
p->fr.frametype = AST_FRAME_DTMF;
|
||||||
return &p->fr;
|
return &p->fr;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
|
||||||
if (ast->_state == AST_STATE_RINGING) {
|
if (ast->_state == AST_STATE_RINGING) {
|
||||||
/* They've picked up the phone */
|
/* They've picked up the phone */
|
||||||
p->fr.frametype = AST_FRAME_CONTROL;
|
p->fr.frametype = AST_FRAME_CONTROL;
|
||||||
p->fr.subclass = AST_CONTROL_ANSWER;
|
p->fr.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
phone_setup(ast);
|
phone_setup(ast);
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
return &p->fr;
|
return &p->fr;
|
||||||
|
@ -540,7 +540,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
|
||||||
#endif
|
#endif
|
||||||
/* Strange -- nothing there.. */
|
/* Strange -- nothing there.. */
|
||||||
p->fr.frametype = AST_FRAME_NULL;
|
p->fr.frametype = AST_FRAME_NULL;
|
||||||
p->fr.subclass = 0;
|
p->fr.subclass.integer = 0;
|
||||||
return &p->fr;
|
return &p->fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,10 +594,10 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
|
||||||
AST_FRAME_VOICE :
|
AST_FRAME_VOICE :
|
||||||
p->lastinput <= AST_FORMAT_PNG ? AST_FRAME_IMAGE
|
p->lastinput <= AST_FORMAT_PNG ? AST_FRAME_IMAGE
|
||||||
: AST_FRAME_VIDEO;
|
: AST_FRAME_VIDEO;
|
||||||
p->fr.subclass = p->lastinput;
|
p->fr.subclass.codec = p->lastinput;
|
||||||
p->fr.offset = AST_FRIENDLY_OFFSET;
|
p->fr.offset = AST_FRIENDLY_OFFSET;
|
||||||
/* Byteswap from little-endian to native-endian */
|
/* Byteswap from little-endian to native-endian */
|
||||||
if (p->fr.subclass == AST_FORMAT_SLINEAR)
|
if (p->fr.subclass.codec == AST_FORMAT_SLINEAR)
|
||||||
ast_frame_byteswap_le(&p->fr);
|
ast_frame_byteswap_le(&p->fr);
|
||||||
return &p->fr;
|
return &p->fr;
|
||||||
}
|
}
|
||||||
|
@ -659,10 +659,10 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
|
ast_log(LOG_WARNING, "Don't know what to do with frame type '%d'\n", frame->frametype);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(frame->subclass &
|
if (!(frame->subclass.codec &
|
||||||
(AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A)) &&
|
(AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A)) &&
|
||||||
p->mode != MODE_FXS) {
|
p->mode != MODE_FXS) {
|
||||||
ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
|
ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_getformatname(frame->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -677,7 +677,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (frame->subclass == AST_FORMAT_G729A) {
|
if (frame->subclass.codec == AST_FORMAT_G729A) {
|
||||||
if (p->lastformat != AST_FORMAT_G729A) {
|
if (p->lastformat != AST_FORMAT_G729A) {
|
||||||
ioctl(p->fd, PHONE_PLAY_STOP);
|
ioctl(p->fd, PHONE_PLAY_STOP);
|
||||||
ioctl(p->fd, PHONE_REC_STOP);
|
ioctl(p->fd, PHONE_REC_STOP);
|
||||||
|
@ -700,7 +700,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
maxfr = 80;
|
maxfr = 80;
|
||||||
} else if (frame->subclass == AST_FORMAT_G723_1) {
|
} else if (frame->subclass.codec == AST_FORMAT_G723_1) {
|
||||||
if (p->lastformat != AST_FORMAT_G723_1) {
|
if (p->lastformat != AST_FORMAT_G723_1) {
|
||||||
ioctl(p->fd, PHONE_PLAY_STOP);
|
ioctl(p->fd, PHONE_PLAY_STOP);
|
||||||
ioctl(p->fd, PHONE_REC_STOP);
|
ioctl(p->fd, PHONE_REC_STOP);
|
||||||
|
@ -723,7 +723,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
maxfr = 24;
|
maxfr = 24;
|
||||||
} else if (frame->subclass == AST_FORMAT_SLINEAR) {
|
} else if (frame->subclass.codec == AST_FORMAT_SLINEAR) {
|
||||||
if (p->lastformat != AST_FORMAT_SLINEAR) {
|
if (p->lastformat != AST_FORMAT_SLINEAR) {
|
||||||
ioctl(p->fd, PHONE_PLAY_STOP);
|
ioctl(p->fd, PHONE_PLAY_STOP);
|
||||||
ioctl(p->fd, PHONE_REC_STOP);
|
ioctl(p->fd, PHONE_REC_STOP);
|
||||||
|
@ -742,7 +742,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
p->obuflen = 0;
|
p->obuflen = 0;
|
||||||
}
|
}
|
||||||
maxfr = 480;
|
maxfr = 480;
|
||||||
} else if (frame->subclass == AST_FORMAT_ULAW) {
|
} else if (frame->subclass.codec == AST_FORMAT_ULAW) {
|
||||||
if (p->lastformat != AST_FORMAT_ULAW) {
|
if (p->lastformat != AST_FORMAT_ULAW) {
|
||||||
ioctl(p->fd, PHONE_PLAY_STOP);
|
ioctl(p->fd, PHONE_PLAY_STOP);
|
||||||
ioctl(p->fd, PHONE_REC_STOP);
|
ioctl(p->fd, PHONE_REC_STOP);
|
||||||
|
@ -762,21 +762,21 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
}
|
}
|
||||||
maxfr = 240;
|
maxfr = 240;
|
||||||
} else {
|
} else {
|
||||||
if (p->lastformat != frame->subclass) {
|
if (p->lastformat != frame->subclass.codec) {
|
||||||
ioctl(p->fd, PHONE_PLAY_STOP);
|
ioctl(p->fd, PHONE_PLAY_STOP);
|
||||||
ioctl(p->fd, PHONE_REC_STOP);
|
ioctl(p->fd, PHONE_REC_STOP);
|
||||||
if (ioctl(p->fd, PHONE_PLAY_CODEC, frame->subclass)) {
|
if (ioctl(p->fd, PHONE_PLAY_CODEC, (int) frame->subclass.codec)) {
|
||||||
ast_log(LOG_WARNING, "Unable to set %d mode\n",
|
ast_log(LOG_WARNING, "Unable to set %s mode\n",
|
||||||
frame->subclass);
|
ast_getformatname(frame->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ioctl(p->fd, PHONE_REC_CODEC, frame->subclass)) {
|
if (ioctl(p->fd, PHONE_REC_CODEC, (int) frame->subclass.codec)) {
|
||||||
ast_log(LOG_WARNING, "Unable to set %d mode\n",
|
ast_log(LOG_WARNING, "Unable to set %s mode\n",
|
||||||
frame->subclass);
|
ast_getformatname(frame->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
p->lastformat = frame->subclass;
|
p->lastformat = frame->subclass.codec;
|
||||||
p->lastinput = frame->subclass;
|
p->lastinput = frame->subclass.codec;
|
||||||
codecset = 1;
|
codecset = 1;
|
||||||
/* Reset output buffer */
|
/* Reset output buffer */
|
||||||
p->obuflen = 0;
|
p->obuflen = 0;
|
||||||
|
@ -816,7 +816,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
} else {
|
} else {
|
||||||
int swap = 0;
|
int swap = 0;
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
if (frame->subclass == AST_FORMAT_SLINEAR)
|
if (frame->subclass.codec == AST_FORMAT_SLINEAR)
|
||||||
swap = 1; /* Swap big-endian samples to little-endian as we copy */
|
swap = 1; /* Swap big-endian samples to little-endian as we copy */
|
||||||
#endif
|
#endif
|
||||||
res = phone_write_buf(p, pos, expected, maxfr, swap);
|
res = phone_write_buf(p, pos, expected, maxfr, swap);
|
||||||
|
@ -1211,9 +1211,9 @@ static struct phone_pvt *mkif(const char *iface, int mode, int txgain, int rxgai
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *phone_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *phone_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
struct phone_pvt *p;
|
struct phone_pvt *p;
|
||||||
struct ast_channel *tmp = NULL;
|
struct ast_channel *tmp = NULL;
|
||||||
char *name = data;
|
char *name = data;
|
||||||
|
@ -1245,7 +1245,8 @@ static struct ast_channel *phone_request(const char *type, int format, const str
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
format &= (AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW);
|
format &= (AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW);
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
|
char buf[256];
|
||||||
|
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1146,7 +1146,7 @@ static const char *sip_reason_code_to_str(enum AST_REDIRECTING_REASON code)
|
||||||
#define DEFAULT_SDPSESSION "Asterisk PBX" /*!< Default SDP session name, (s=) header unless re-defined in sip.conf */
|
#define DEFAULT_SDPSESSION "Asterisk PBX" /*!< Default SDP session name, (s=) header unless re-defined in sip.conf */
|
||||||
#define DEFAULT_SDPOWNER "root" /*!< Default SDP username field in (o=) header unless re-defined in sip.conf */
|
#define DEFAULT_SDPOWNER "root" /*!< Default SDP username field in (o=) header unless re-defined in sip.conf */
|
||||||
#define DEFAULT_ENGINE "asterisk" /*!< Default RTP engine to use for sessions */
|
#define DEFAULT_ENGINE "asterisk" /*!< Default RTP engine to use for sessions */
|
||||||
#define DEFAULT_CAPABILITY (AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263);
|
#define DEFAULT_CAPABILITY (AST_FORMAT_ULAW | AST_FORMAT_TESTLAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263);
|
||||||
#endif
|
#endif
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ struct sip_settings {
|
||||||
char default_context[AST_MAX_CONTEXT];
|
char default_context[AST_MAX_CONTEXT];
|
||||||
char default_subscribecontext[AST_MAX_CONTEXT];
|
char default_subscribecontext[AST_MAX_CONTEXT];
|
||||||
struct ast_ha *contact_ha; /*! \brief Global list of addresses dynamic peers are not allowed to use */
|
struct ast_ha *contact_ha; /*! \brief Global list of addresses dynamic peers are not allowed to use */
|
||||||
int capability; /*!< Supported codecs */
|
format_t capability; /*!< Supported codecs */
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sip_settings sip_cfg; /*!< SIP configuration data.
|
static struct sip_settings sip_cfg; /*!< SIP configuration data.
|
||||||
|
@ -1767,13 +1767,13 @@ struct sip_pvt {
|
||||||
unsigned int sipoptions; /*!< Supported SIP options on the other end */
|
unsigned int sipoptions; /*!< Supported SIP options on the other end */
|
||||||
unsigned int reqsipoptions; /*!< Required SIP options on the other end */
|
unsigned int reqsipoptions; /*!< Required SIP options on the other end */
|
||||||
struct ast_codec_pref prefs; /*!< codec prefs */
|
struct ast_codec_pref prefs; /*!< codec prefs */
|
||||||
int capability; /*!< Special capability (codec) */
|
format_t capability; /*!< Special capability (codec) */
|
||||||
int jointcapability; /*!< Supported capability at both ends (codecs) */
|
format_t jointcapability; /*!< Supported capability at both ends (codecs) */
|
||||||
int peercapability; /*!< Supported peer capability */
|
format_t peercapability; /*!< Supported peer capability */
|
||||||
int prefcodec; /*!< Preferred codec (outbound only) */
|
format_t prefcodec; /*!< Preferred codec (outbound only) */
|
||||||
int noncodeccapability; /*!< DTMF RFC2833 telephony-event */
|
int noncodeccapability; /*!< DTMF RFC2833 telephony-event */
|
||||||
int jointnoncodeccapability; /*!< Joint Non codec capability */
|
int jointnoncodeccapability; /*!< Joint Non codec capability */
|
||||||
int redircodecs; /*!< Redirect codecs */
|
format_t redircodecs; /*!< Redirect codecs */
|
||||||
int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */
|
int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */
|
||||||
int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */
|
int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */
|
||||||
int request_queue_sched_id; /*!< Scheduler ID of any scheduled action to process queued requests */
|
int request_queue_sched_id; /*!< Scheduler ID of any scheduled action to process queued requests */
|
||||||
|
@ -2038,7 +2038,7 @@ struct sip_peer {
|
||||||
|
|
||||||
int maxcallbitrate; /*!< Maximum Bitrate for a video call */
|
int maxcallbitrate; /*!< Maximum Bitrate for a video call */
|
||||||
int expire; /*!< When to expire this peer registration */
|
int expire; /*!< When to expire this peer registration */
|
||||||
int capability; /*!< Codec capability */
|
format_t capability; /*!< Codec capability */
|
||||||
int rtptimeout; /*!< RTP timeout */
|
int rtptimeout; /*!< RTP timeout */
|
||||||
int rtpholdtimeout; /*!< RTP Hold Timeout */
|
int rtpholdtimeout; /*!< RTP Hold Timeout */
|
||||||
int rtpkeepalive; /*!< Send RTP packets for keepalive */
|
int rtpkeepalive; /*!< Send RTP packets for keepalive */
|
||||||
|
@ -2408,7 +2408,7 @@ enum t38_action_flag {
|
||||||
in coming releases. */
|
in coming releases. */
|
||||||
|
|
||||||
/*--- PBX interface functions */
|
/*--- PBX interface functions */
|
||||||
static struct ast_channel *sip_request_call(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *sip_request_call(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int sip_devicestate(void *data);
|
static int sip_devicestate(void *data);
|
||||||
static int sip_sendtext(struct ast_channel *ast, const char *text);
|
static int sip_sendtext(struct ast_channel *ast, const char *text);
|
||||||
static int sip_call(struct ast_channel *ast, char *dest, int timeout);
|
static int sip_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
|
@ -2501,7 +2501,7 @@ static const char* get_sdp_iterate(int* start, struct sip_request *req, const ch
|
||||||
static const char *get_sdp(struct sip_request *req, const char *name);
|
static const char *get_sdp(struct sip_request *req, const char *name);
|
||||||
static int find_sdp(struct sip_request *req);
|
static int find_sdp(struct sip_request *req);
|
||||||
static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action);
|
static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action);
|
||||||
static void add_codec_to_sdp(const struct sip_pvt *p, int codec,
|
static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
|
||||||
struct ast_str **m_buf, struct ast_str **a_buf,
|
struct ast_str **m_buf, struct ast_str **a_buf,
|
||||||
int debug, int *min_packet_size);
|
int debug, int *min_packet_size);
|
||||||
static void add_noncodec_to_sdp(const struct sip_pvt *p, int format,
|
static void add_noncodec_to_sdp(const struct sip_pvt *p, int format,
|
||||||
|
@ -2769,7 +2769,7 @@ static enum st_mode st_get_mode(struct sip_pvt *);
|
||||||
static struct sip_st_dlg* sip_st_alloc(struct sip_pvt *const p);
|
static struct sip_st_dlg* sip_st_alloc(struct sip_pvt *const p);
|
||||||
|
|
||||||
/*------- RTP Glue functions -------- */
|
/*------- RTP Glue functions -------- */
|
||||||
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, int codecs, int nat_active);
|
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
|
||||||
|
|
||||||
/*!--- SIP MWI Subscription support */
|
/*!--- SIP MWI Subscription support */
|
||||||
static int sip_subscribe_mwi(const char *value, int lineno);
|
static int sip_subscribe_mwi(const char *value, int lineno);
|
||||||
|
@ -6459,7 +6459,7 @@ static int sip_hangup(struct ast_channel *ast)
|
||||||
/*! \brief Try setting codec suggested by the SIP_CODEC channel variable */
|
/*! \brief Try setting codec suggested by the SIP_CODEC channel variable */
|
||||||
static void try_suggested_sip_codec(struct sip_pvt *p)
|
static void try_suggested_sip_codec(struct sip_pvt *p)
|
||||||
{
|
{
|
||||||
int fmt;
|
format_t fmt;
|
||||||
const char *codec;
|
const char *codec;
|
||||||
struct ast_channel* chan;
|
struct ast_channel* chan;
|
||||||
|
|
||||||
|
@ -6526,16 +6526,13 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
|
|
||||||
switch (frame->frametype) {
|
switch (frame->frametype) {
|
||||||
case AST_FRAME_VOICE:
|
case AST_FRAME_VOICE:
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
char s1[512], s2[512], s3[512];
|
char s1[512], s2[512], s3[512];
|
||||||
ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %s(%d) read/write = %s(%d)/%s(%d)\n",
|
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s read/write = %s/%s\n",
|
||||||
frame->subclass,
|
ast_getformatname(frame->subclass.codec),
|
||||||
ast_getformatname_multiple(s1, sizeof(s1) - 1, ast->nativeformats & AST_FORMAT_AUDIO_MASK),
|
ast_getformatname_multiple(s1, sizeof(s1), ast->nativeformats & AST_FORMAT_AUDIO_MASK),
|
||||||
ast->nativeformats & AST_FORMAT_AUDIO_MASK,
|
ast_getformatname_multiple(s2, sizeof(s2), ast->readformat),
|
||||||
ast_getformatname_multiple(s2, sizeof(s2) - 1, ast->readformat),
|
ast_getformatname_multiple(s3, sizeof(s3), ast->writeformat));
|
||||||
ast->readformat,
|
|
||||||
ast_getformatname_multiple(s3, sizeof(s3) - 1, ast->writeformat),
|
|
||||||
ast->writeformat);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -6917,11 +6914,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
|
||||||
{
|
{
|
||||||
struct ast_channel *tmp;
|
struct ast_channel *tmp;
|
||||||
struct ast_variable *v = NULL;
|
struct ast_variable *v = NULL;
|
||||||
int fmt;
|
format_t fmt;
|
||||||
int what;
|
format_t what;
|
||||||
int video;
|
format_t video;
|
||||||
int text;
|
format_t text;
|
||||||
int needvideo = 0;
|
format_t needvideo = 0;
|
||||||
int needtext = 0;
|
int needtext = 0;
|
||||||
char buf[SIPBUFSIZE];
|
char buf[SIPBUFSIZE];
|
||||||
char *decoded_exten;
|
char *decoded_exten;
|
||||||
|
@ -7285,7 +7282,7 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
|
||||||
/* Don't forward RFC2833 if we're not supposed to */
|
/* Don't forward RFC2833 if we're not supposed to */
|
||||||
if (f && (f->frametype == AST_FRAME_DTMF_BEGIN || f->frametype == AST_FRAME_DTMF_END) &&
|
if (f && (f->frametype == AST_FRAME_DTMF_BEGIN || f->frametype == AST_FRAME_DTMF_END) &&
|
||||||
(ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_RFC2833)) {
|
(ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_RFC2833)) {
|
||||||
ast_debug(1, "Ignoring DTMF (%c) RTP frame because dtmfmode is not RFC2833\n", f->subclass);
|
ast_debug(1, "Ignoring DTMF (%c) RTP frame because dtmfmode is not RFC2833\n", f->subclass.integer);
|
||||||
return &ast_null_frame;
|
return &ast_null_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7293,15 +7290,15 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
|
||||||
if (!p->owner || (f && f->frametype != AST_FRAME_VOICE))
|
if (!p->owner || (f && f->frametype != AST_FRAME_VOICE))
|
||||||
return f;
|
return f;
|
||||||
|
|
||||||
if (f && f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
if (f && f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
|
||||||
if (!(f->subclass & p->jointcapability)) {
|
if (!(f->subclass.codec & p->jointcapability)) {
|
||||||
ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n",
|
ast_debug(1, "Bogus frame of format '%s' received from '%s'!\n",
|
||||||
ast_getformatname(f->subclass), p->owner->name);
|
ast_getformatname(f->subclass.codec), p->owner->name);
|
||||||
return &ast_null_frame;
|
return &ast_null_frame;
|
||||||
}
|
}
|
||||||
ast_debug(1, "Oooh, format changed to %d %s\n",
|
ast_debug(1, "Oooh, format changed to %s\n",
|
||||||
f->subclass, ast_getformatname(f->subclass));
|
ast_getformatname(f->subclass.codec));
|
||||||
p->owner->nativeformats = (p->owner->nativeformats & (AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK)) | f->subclass;
|
p->owner->nativeformats = (p->owner->nativeformats & (AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK)) | f->subclass.codec;
|
||||||
ast_set_read_format(p->owner, p->owner->readformat);
|
ast_set_read_format(p->owner, p->owner->readformat);
|
||||||
ast_set_write_format(p->owner, p->owner->writeformat);
|
ast_set_write_format(p->owner, p->owner->writeformat);
|
||||||
}
|
}
|
||||||
|
@ -7309,11 +7306,11 @@ static struct ast_frame *sip_rtp_read(struct ast_channel *ast, struct sip_pvt *p
|
||||||
if (f && p->dsp) {
|
if (f && p->dsp) {
|
||||||
f = ast_dsp_process(p->owner, p->dsp, f);
|
f = ast_dsp_process(p->owner, p->dsp, f);
|
||||||
if (f && f->frametype == AST_FRAME_DTMF) {
|
if (f && f->frametype == AST_FRAME_DTMF) {
|
||||||
if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && f->subclass == 'f') {
|
if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && f->subclass.integer == 'f') {
|
||||||
ast_debug(1, "Fax CNG detected on %s\n", ast->name);
|
ast_debug(1, "Fax CNG detected on %s\n", ast->name);
|
||||||
*faxdetect = 1;
|
*faxdetect = 1;
|
||||||
} else {
|
} else {
|
||||||
ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass);
|
ast_debug(1, "* Detected inband DTMF '%c'\n", f->subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8367,9 +8364,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
|
||||||
int old = 0;
|
int old = 0;
|
||||||
|
|
||||||
/* Peer capability is the capability in the SDP, non codec is RFC2833 DTMF (101) */
|
/* Peer capability is the capability in the SDP, non codec is RFC2833 DTMF (101) */
|
||||||
int peercapability = 0, peernoncodeccapability = 0;
|
format_t peercapability = 0, vpeercapability = 0, tpeercapability = 0;
|
||||||
int vpeercapability = 0, vpeernoncodeccapability = 0;
|
int peernoncodeccapability = 0, vpeernoncodeccapability = 0, tpeernoncodeccapability = 0;
|
||||||
int tpeercapability = 0, tpeernoncodeccapability = 0;
|
|
||||||
struct sockaddr_in sin; /*!< media socket address */
|
struct sockaddr_in sin; /*!< media socket address */
|
||||||
struct sockaddr_in vsin; /*!< Video socket address */
|
struct sockaddr_in vsin; /*!< Video socket address */
|
||||||
struct sockaddr_in tsin; /*!< Text socket address */
|
struct sockaddr_in tsin; /*!< Text socket address */
|
||||||
|
@ -8387,8 +8383,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
|
||||||
int sendonly = -1;
|
int sendonly = -1;
|
||||||
int numberofports;
|
int numberofports;
|
||||||
struct ast_rtp_codecs newaudiortp, newvideortp, newtextrtp;
|
struct ast_rtp_codecs newaudiortp, newvideortp, newtextrtp;
|
||||||
int newjointcapability; /* Negotiated capability */
|
format_t newjointcapability; /* Negotiated capability */
|
||||||
int newpeercapability;
|
format_t newpeercapability;
|
||||||
int newnoncodeccapability;
|
int newnoncodeccapability;
|
||||||
int numberofmediastreams = 0;
|
int numberofmediastreams = 0;
|
||||||
int debug = sip_debug_test_pvt(p);
|
int debug = sip_debug_test_pvt(p);
|
||||||
|
@ -8781,7 +8777,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
|
||||||
if (!format.asterisk_format || !format.code) /* non-codec or not found */
|
if (!format.asterisk_format || !format.code) /* non-codec or not found */
|
||||||
continue;
|
continue;
|
||||||
if (option_debug)
|
if (option_debug)
|
||||||
ast_log(LOG_DEBUG, "Setting framing for %d to %ld\n", format.code, framing);
|
ast_log(LOG_DEBUG, "Setting framing for %s to %ld\n", ast_getformatname(format.code), framing);
|
||||||
ast_codec_pref_setsize(pref, format.code, framing);
|
ast_codec_pref_setsize(pref, format.code, framing);
|
||||||
}
|
}
|
||||||
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, pref);
|
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, pref);
|
||||||
|
@ -10189,7 +10185,7 @@ static int add_vidupdate(struct sip_request *req)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Add codec offer to SDP offer/answer body in INVITE or 200 OK */
|
/*! \brief Add codec offer to SDP offer/answer body in INVITE or 200 OK */
|
||||||
static void add_codec_to_sdp(const struct sip_pvt *p, int codec,
|
static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
|
||||||
struct ast_str **m_buf, struct ast_str **a_buf,
|
struct ast_str **m_buf, struct ast_str **a_buf,
|
||||||
int debug, int *min_packet_size)
|
int debug, int *min_packet_size)
|
||||||
{
|
{
|
||||||
|
@ -10198,7 +10194,7 @@ static void add_codec_to_sdp(const struct sip_pvt *p, int codec,
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
ast_verbose("Adding codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
|
ast_verbose("Adding codec 0x%Lx (%s) to SDP\n", codec, ast_getformatname(codec));
|
||||||
if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 1, codec)) == -1)
|
if ((rtp_code = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(p->rtp), 1, codec)) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -10396,7 +10392,7 @@ static void get_our_media_address(struct sip_pvt *p, int needvideo, int needtext
|
||||||
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int oldsdp, int add_audio, int add_t38)
|
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int oldsdp, int add_audio, int add_t38)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int alreadysent = 0;
|
format_t alreadysent = 0;
|
||||||
|
|
||||||
struct sockaddr_in sin = { 0, };
|
struct sockaddr_in sin = { 0, };
|
||||||
struct sockaddr_in vsin = { 0, };
|
struct sockaddr_in vsin = { 0, };
|
||||||
|
@ -10424,8 +10420,8 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
|
||||||
struct ast_str *a_text = ast_str_alloca(1024); /* Attributes for text */
|
struct ast_str *a_text = ast_str_alloca(1024); /* Attributes for text */
|
||||||
struct ast_str *a_modem = ast_str_alloca(1024); /* Attributes for modem */
|
struct ast_str *a_modem = ast_str_alloca(1024); /* Attributes for modem */
|
||||||
|
|
||||||
int x;
|
format_t x;
|
||||||
int capability = 0;
|
format_t capability = 0;
|
||||||
int needaudio = FALSE;
|
int needaudio = FALSE;
|
||||||
int needvideo = FALSE;
|
int needvideo = FALSE;
|
||||||
int needtext = FALSE;
|
int needtext = FALSE;
|
||||||
|
@ -10547,15 +10543,15 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
|
||||||
Note that p->prefcodec can include video codecs, so mask them out
|
Note that p->prefcodec can include video codecs, so mask them out
|
||||||
*/
|
*/
|
||||||
if (capability & p->prefcodec) {
|
if (capability & p->prefcodec) {
|
||||||
int codec = p->prefcodec & AST_FORMAT_AUDIO_MASK;
|
format_t codec = p->prefcodec & AST_FORMAT_AUDIO_MASK;
|
||||||
|
|
||||||
add_codec_to_sdp(p, codec, &m_audio, &a_audio, debug, &min_audio_packet_size);
|
add_codec_to_sdp(p, codec, &m_audio, &a_audio, debug, &min_audio_packet_size);
|
||||||
alreadysent |= codec;
|
alreadysent |= codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start by sending our preferred audio/video codecs */
|
/* Start by sending our preferred audio/video codecs */
|
||||||
for (x = 0; x < 32; x++) {
|
for (x = 0; x < 64; x++) {
|
||||||
int codec;
|
format_t codec;
|
||||||
|
|
||||||
if (!(codec = ast_codec_pref_index(&p->prefs, x)))
|
if (!(codec = ast_codec_pref_index(&p->prefs, x)))
|
||||||
break;
|
break;
|
||||||
|
@ -10571,7 +10567,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now send any other common audio and video codecs, and non-codec formats: */
|
/* Now send any other common audio and video codecs, and non-codec formats: */
|
||||||
for (x = 1; x <= (needtext ? AST_FORMAT_TEXT_MASK : (needvideo ? AST_FORMAT_VIDEO_MASK : AST_FORMAT_AUDIO_MASK)); x <<= 1) {
|
for (x = 1LL; x <= (needtext ? AST_FORMAT_TEXT_MASK : (needvideo ? AST_FORMAT_VIDEO_MASK : AST_FORMAT_AUDIO_MASK)); x <<= 1) {
|
||||||
if (!(capability & x)) /* Codec not requested */
|
if (!(capability & x)) /* Codec not requested */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -10587,7 +10583,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now add DTMF RFC2833 telephony-event as a codec */
|
/* Now add DTMF RFC2833 telephony-event as a codec */
|
||||||
for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
|
for (x = 1LL; x <= AST_RTP_MAX; x <<= 1) {
|
||||||
if (!(p->jointnoncodeccapability & x))
|
if (!(p->jointnoncodeccapability & x))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -14807,7 +14803,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req)
|
||||||
ast_verbose("SIP Text message received: '%s'\n", buf);
|
ast_verbose("SIP Text message received: '%s'\n", buf);
|
||||||
memset(&f, 0, sizeof(f));
|
memset(&f, 0, sizeof(f));
|
||||||
f.frametype = AST_FRAME_TEXT;
|
f.frametype = AST_FRAME_TEXT;
|
||||||
f.subclass = 0;
|
f.subclass.integer = 0;
|
||||||
f.offset = 0;
|
f.offset = 0;
|
||||||
f.data.ptr = buf;
|
f.data.ptr = buf;
|
||||||
f.datalen = strlen(buf);
|
f.datalen = strlen(buf);
|
||||||
|
@ -15669,9 +15665,10 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli
|
||||||
/*! \brief Print codec list from preference to CLI/manager */
|
/*! \brief Print codec list from preference to CLI/manager */
|
||||||
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
|
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref)
|
||||||
{
|
{
|
||||||
int x, codec;
|
int x;
|
||||||
|
format_t codec;
|
||||||
|
|
||||||
for(x = 0; x < 32 ; x++) {
|
for(x = 0; x < 64 ; x++) {
|
||||||
codec = ast_codec_pref_index(pref, x);
|
codec = ast_codec_pref_index(pref, x);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
break;
|
break;
|
||||||
|
@ -15864,7 +15861,8 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
|
||||||
struct ast_codec_pref *pref;
|
struct ast_codec_pref *pref;
|
||||||
struct ast_variable *v;
|
struct ast_variable *v;
|
||||||
struct sip_auth *auth;
|
struct sip_auth *auth;
|
||||||
int x = 0, codec = 0, load_realtime;
|
int x = 0, load_realtime;
|
||||||
|
format_t codec = 0;
|
||||||
int realtimepeers;
|
int realtimepeers;
|
||||||
|
|
||||||
realtimepeers = ast_check_realtime("sippeers");
|
realtimepeers = ast_check_realtime("sippeers");
|
||||||
|
@ -16071,12 +16069,12 @@ static char *_sip_show_peer(int type, int fd, struct mansession *s, const struct
|
||||||
astman_append(s, "%s\r\n", codec_buf);
|
astman_append(s, "%s\r\n", codec_buf);
|
||||||
astman_append(s, "CodecOrder: ");
|
astman_append(s, "CodecOrder: ");
|
||||||
pref = &peer->prefs;
|
pref = &peer->prefs;
|
||||||
for(x = 0; x < 32 ; x++) {
|
for(x = 0; x < 64 ; x++) {
|
||||||
codec = ast_codec_pref_index(pref, x);
|
codec = ast_codec_pref_index(pref, x);
|
||||||
if (!codec)
|
if (!codec)
|
||||||
break;
|
break;
|
||||||
astman_append(s, "%s", ast_getformatname(codec));
|
astman_append(s, "%s", ast_getformatname(codec));
|
||||||
if (x < 31 && ast_codec_pref_index(pref, x+1))
|
if (x < 63 && ast_codec_pref_index(pref, x+1))
|
||||||
astman_append(s, ",");
|
astman_append(s, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16965,10 +16963,10 @@ static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_a
|
||||||
ast_cli(a->fd, " Curr. trans. direction: %s\n", ast_test_flag(&cur->flags[0], SIP_OUTGOING) ? "Outgoing" : "Incoming");
|
ast_cli(a->fd, " Curr. trans. direction: %s\n", ast_test_flag(&cur->flags[0], SIP_OUTGOING) ? "Outgoing" : "Incoming");
|
||||||
ast_cli(a->fd, " Call-ID: %s\n", cur->callid);
|
ast_cli(a->fd, " Call-ID: %s\n", cur->callid);
|
||||||
ast_cli(a->fd, " Owner channel ID: %s\n", cur->owner ? cur->owner->name : "<none>");
|
ast_cli(a->fd, " Owner channel ID: %s\n", cur->owner ? cur->owner->name : "<none>");
|
||||||
ast_cli(a->fd, " Our Codec Capability: %d\n", cur->capability);
|
ast_cli(a->fd, " Our Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->capability));
|
||||||
ast_cli(a->fd, " Non-Codec Capability (DTMF): %d\n", cur->noncodeccapability);
|
ast_cli(a->fd, " Non-Codec Capability (DTMF): %d\n", cur->noncodeccapability);
|
||||||
ast_cli(a->fd, " Their Codec Capability: %d\n", cur->peercapability);
|
ast_cli(a->fd, " Their Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercapability));
|
||||||
ast_cli(a->fd, " Joint Codec Capability: %d\n", cur->jointcapability);
|
ast_cli(a->fd, " Joint Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->jointcapability));
|
||||||
ast_cli(a->fd, " Format: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
|
ast_cli(a->fd, " Format: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
|
||||||
ast_cli(a->fd, " T.38 support %s\n", cli_yesno(cur->udptl != NULL));
|
ast_cli(a->fd, " T.38 support %s\n", cli_yesno(cur->udptl != NULL));
|
||||||
ast_cli(a->fd, " Video support %s\n", cli_yesno(cur->vrtp != NULL));
|
ast_cli(a->fd, " Video support %s\n", cli_yesno(cur->vrtp != NULL));
|
||||||
|
@ -17178,7 +17176,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||||
event = atoi(buf);
|
event = atoi(buf);
|
||||||
if (event == 16) {
|
if (event == 16) {
|
||||||
/* send a FLASH event */
|
/* send a FLASH event */
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH, };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH, } };
|
||||||
ast_queue_frame(p->owner, &f);
|
ast_queue_frame(p->owner, &f);
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("* DTMF-relay event received: FLASH\n");
|
ast_verbose("* DTMF-relay event received: FLASH\n");
|
||||||
|
@ -17186,18 +17184,18 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||||
/* send a DTMF event */
|
/* send a DTMF event */
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, };
|
struct ast_frame f = { AST_FRAME_DTMF, };
|
||||||
if (event < 10) {
|
if (event < 10) {
|
||||||
f.subclass = '0' + event;
|
f.subclass.integer = '0' + event;
|
||||||
} else if (event < 11) {
|
} else if (event == 10) {
|
||||||
f.subclass = '*';
|
f.subclass.integer = '*';
|
||||||
} else if (event < 12) {
|
} else if (event == 11) {
|
||||||
f.subclass = '#';
|
f.subclass.integer = '#';
|
||||||
} else if (event < 16) {
|
} else if (event < 16) {
|
||||||
f.subclass = 'A' + (event - 12);
|
f.subclass.integer = 'A' + (event - 12);
|
||||||
}
|
}
|
||||||
f.len = duration;
|
f.len = duration;
|
||||||
ast_queue_frame(p->owner, &f);
|
ast_queue_frame(p->owner, &f);
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("* DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
}
|
}
|
||||||
transmit_response(p, "200 OK", req);
|
transmit_response(p, "200 OK", req);
|
||||||
return;
|
return;
|
||||||
|
@ -17221,7 +17219,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||||
event = atoi(buf);
|
event = atoi(buf);
|
||||||
if (event == 16) {
|
if (event == 16) {
|
||||||
/* send a FLASH event */
|
/* send a FLASH event */
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH, };
|
struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_FLASH }, };
|
||||||
ast_queue_frame(p->owner, &f);
|
ast_queue_frame(p->owner, &f);
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("* DTMF-relay event received: FLASH\n");
|
ast_verbose("* DTMF-relay event received: FLASH\n");
|
||||||
|
@ -17229,18 +17227,18 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||||
/* send a DTMF event */
|
/* send a DTMF event */
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, };
|
struct ast_frame f = { AST_FRAME_DTMF, };
|
||||||
if (event < 10) {
|
if (event < 10) {
|
||||||
f.subclass = '0' + event;
|
f.subclass.integer = '0' + event;
|
||||||
} else if (event < 11) {
|
} else if (event == 10) {
|
||||||
f.subclass = '*';
|
f.subclass.integer = '*';
|
||||||
} else if (event < 12) {
|
} else if (event == 11) {
|
||||||
f.subclass = '#';
|
f.subclass.integer = '#';
|
||||||
} else if (event < 16) {
|
} else if (event < 16) {
|
||||||
f.subclass = 'A' + (event - 12);
|
f.subclass.integer = 'A' + (event - 12);
|
||||||
}
|
}
|
||||||
f.len = duration;
|
f.len = duration;
|
||||||
ast_queue_frame(p->owner, &f);
|
ast_queue_frame(p->owner, &f);
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
|
ast_verbose("* DTMF-relay event received: %c\n", (int) f.subclass.integer);
|
||||||
}
|
}
|
||||||
transmit_response(p, "200 OK", req);
|
transmit_response(p, "200 OK", req);
|
||||||
return;
|
return;
|
||||||
|
@ -17287,10 +17285,10 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
|
||||||
/* Send the feature code to the PBX as DTMF, just like the handset had sent it */
|
/* Send the feature code to the PBX as DTMF, just like the handset had sent it */
|
||||||
f.len = 100;
|
f.len = 100;
|
||||||
for (j=0; j < strlen(feat->exten); j++) {
|
for (j=0; j < strlen(feat->exten); j++) {
|
||||||
f.subclass = feat->exten[j];
|
f.subclass.integer = feat->exten[j];
|
||||||
ast_queue_frame(p->owner, &f);
|
ast_queue_frame(p->owner, &f);
|
||||||
if (sipdebug)
|
if (sipdebug)
|
||||||
ast_verbose("* DTMF-relay event faked: %c\n", f.subclass);
|
ast_verbose("* DTMF-relay event faked: %c\n", f.subclass.integer);
|
||||||
}
|
}
|
||||||
ast_unlock_call_features();
|
ast_unlock_call_features();
|
||||||
|
|
||||||
|
@ -17866,7 +17864,7 @@ static int function_sippeer(struct ast_channel *chan, const char *cmd, char *dat
|
||||||
}
|
}
|
||||||
} else if (!strncasecmp(colname, "codec[", 6)) {
|
} else if (!strncasecmp(colname, "codec[", 6)) {
|
||||||
char *codecnum;
|
char *codecnum;
|
||||||
int codec = 0;
|
format_t codec = 0;
|
||||||
|
|
||||||
codecnum = colname + 6; /* move past the '[' */
|
codecnum = colname + 6; /* move past the '[' */
|
||||||
codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */
|
codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */
|
||||||
|
@ -23955,7 +23953,7 @@ static int sip_devicestate(void *data)
|
||||||
* or SIP/host!dnid
|
* or SIP/host!dnid
|
||||||
* \endverbatim
|
* \endverbatim
|
||||||
*/
|
*/
|
||||||
static struct ast_channel *sip_request_call(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *sip_request_call(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
struct sip_pvt *p;
|
struct sip_pvt *p;
|
||||||
struct ast_channel *tmpc = NULL;
|
struct ast_channel *tmpc = NULL;
|
||||||
|
@ -23968,7 +23966,7 @@ static struct ast_channel *sip_request_call(const char *type, int format, const
|
||||||
char *authname = NULL;
|
char *authname = NULL;
|
||||||
char *trans = NULL;
|
char *trans = NULL;
|
||||||
enum sip_transport transport = 0;
|
enum sip_transport transport = 0;
|
||||||
int oldformat = format;
|
format_t oldformat = format;
|
||||||
|
|
||||||
/* mask request with some set of allowed formats.
|
/* mask request with some set of allowed formats.
|
||||||
* XXX this needs to be fixed.
|
* XXX this needs to be fixed.
|
||||||
|
@ -26251,7 +26249,7 @@ static enum ast_rtp_glue_result sip_get_trtp_peer(struct ast_channel *chan, stru
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, int codecs, int nat_active)
|
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
struct sip_pvt *p;
|
struct sip_pvt *p;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
@ -26321,7 +26319,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sip_get_codec(struct ast_channel *chan)
|
static format_t sip_get_codec(struct ast_channel *chan)
|
||||||
{
|
{
|
||||||
struct sip_pvt *p = chan->tech_pvt;
|
struct sip_pvt *p = chan->tech_pvt;
|
||||||
return p->peercapability ? p->peercapability : p->capability;
|
return p->peercapability ? p->peercapability : p->capability;
|
||||||
|
|
|
@ -141,7 +141,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
|
static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
|
||||||
static const char config[] = "skinny.conf";
|
static const char config[] = "skinny.conf";
|
||||||
|
|
||||||
static int default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW;
|
static format_t default_capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW;
|
||||||
static struct ast_codec_pref default_prefs;
|
static struct ast_codec_pref default_prefs;
|
||||||
|
|
||||||
enum skinny_codecs {
|
enum skinny_codecs {
|
||||||
|
@ -1229,9 +1229,9 @@ struct skinny_subchannel {
|
||||||
int instance; \
|
int instance; \
|
||||||
int group; \
|
int group; \
|
||||||
int needdestroy; \
|
int needdestroy; \
|
||||||
int confcapability; \
|
format_t confcapability; \
|
||||||
struct ast_codec_pref confprefs; \
|
struct ast_codec_pref confprefs; \
|
||||||
int capability; \
|
format_t capability; \
|
||||||
struct ast_codec_pref prefs; \
|
struct ast_codec_pref prefs; \
|
||||||
int nonCodecCapability; \
|
int nonCodecCapability; \
|
||||||
int onhooktime; \
|
int onhooktime; \
|
||||||
|
@ -1309,9 +1309,9 @@ struct skinny_addon {
|
||||||
int registered; \
|
int registered; \
|
||||||
int lastlineinstance; \
|
int lastlineinstance; \
|
||||||
int lastcallreference; \
|
int lastcallreference; \
|
||||||
int confcapability; \
|
format_t confcapability; \
|
||||||
struct ast_codec_pref confprefs; \
|
struct ast_codec_pref confprefs; \
|
||||||
int capability; \
|
format_t capability; \
|
||||||
int earlyrtp; \
|
int earlyrtp; \
|
||||||
int transfer; \
|
int transfer; \
|
||||||
int callwaiting; \
|
int callwaiting; \
|
||||||
|
@ -1371,7 +1371,7 @@ struct skinnysession {
|
||||||
AST_LIST_ENTRY(skinnysession) list;
|
AST_LIST_ENTRY(skinnysession) list;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static AST_LIST_HEAD_STATIC(sessions, skinnysession);
|
static AST_LIST_HEAD_STATIC(sessions, skinnysession);
|
||||||
|
|
||||||
static int skinny_devicestate(void *data);
|
static int skinny_devicestate(void *data);
|
||||||
|
@ -2704,7 +2704,7 @@ static enum ast_rtp_glue_result skinny_get_rtp_peer(struct ast_channel *c, struc
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, int codecs, int nat_active)
|
static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active)
|
||||||
{
|
{
|
||||||
struct skinny_subchannel *sub;
|
struct skinny_subchannel *sub;
|
||||||
struct skinny_line *l;
|
struct skinny_line *l;
|
||||||
|
@ -2748,7 +2748,7 @@ static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp_instance *r
|
||||||
fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
|
fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
|
||||||
|
|
||||||
if (skinnydebug)
|
if (skinnydebug)
|
||||||
ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms);
|
ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms);
|
||||||
|
|
||||||
req->data.startmedia.conferenceId = htolel(sub->callid);
|
req->data.startmedia.conferenceId = htolel(sub->callid);
|
||||||
req->data.startmedia.passThruPartyId = htolel(sub->callid);
|
req->data.startmedia.passThruPartyId = htolel(sub->callid);
|
||||||
|
@ -4021,9 +4021,9 @@ static struct ast_frame *skinny_rtp_read(struct skinny_subchannel *sub)
|
||||||
if (ast) {
|
if (ast) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != ast->nativeformats) {
|
if (f->subclass.codec != ast->nativeformats) {
|
||||||
ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
|
ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
|
||||||
ast->nativeformats = f->subclass;
|
ast->nativeformats = f->subclass.codec;
|
||||||
ast_set_read_format(ast, ast->readformat);
|
ast_set_read_format(ast, ast->readformat);
|
||||||
ast_set_write_format(ast, ast->writeformat);
|
ast_set_write_format(ast, ast->writeformat);
|
||||||
}
|
}
|
||||||
|
@ -4054,9 +4054,13 @@ static int skinny_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
|
char buf[256];
|
||||||
frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
|
ast_log(LOG_WARNING, "Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
|
||||||
|
ast_getformatname(frame->subclass.codec),
|
||||||
|
ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
|
||||||
|
ast_getformatname(ast->readformat),
|
||||||
|
ast_getformatname(ast->writeformat));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4400,8 +4404,12 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state, const ch
|
||||||
// Should throw an error
|
// Should throw an error
|
||||||
tmp->nativeformats = default_capability;
|
tmp->nativeformats = default_capability;
|
||||||
fmt = ast_best_codec(tmp->nativeformats);
|
fmt = ast_best_codec(tmp->nativeformats);
|
||||||
if (skinnydebug)
|
if (skinnydebug) {
|
||||||
ast_verb(1, "skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt);
|
char buf[256];
|
||||||
|
ast_verb(1, "skinny_new: tmp->nativeformats=%s fmt=%s\n",
|
||||||
|
ast_getformatname_multiple(buf, sizeof(buf), tmp->nativeformats),
|
||||||
|
ast_getformatname(fmt));
|
||||||
|
}
|
||||||
if (sub->rtp) {
|
if (sub->rtp) {
|
||||||
ast_channel_set_fd(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0));
|
ast_channel_set_fd(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0));
|
||||||
}
|
}
|
||||||
|
@ -4746,7 +4754,7 @@ static int handle_keypad_button_message(struct skinny_req *req, struct skinnyses
|
||||||
ast_log(LOG_WARNING, "Unsupported digit %d\n", digit);
|
ast_log(LOG_WARNING, "Unsupported digit %d\n", digit);
|
||||||
}
|
}
|
||||||
|
|
||||||
f.subclass = dgt;
|
f.subclass.integer = dgt;
|
||||||
|
|
||||||
f.src = "skinny";
|
f.src = "skinny";
|
||||||
|
|
||||||
|
@ -5301,6 +5309,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
int codecs = 0;
|
int codecs = 0;
|
||||||
int i;
|
int i;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
count = letohl(req->data.caps.count);
|
count = letohl(req->data.caps.count);
|
||||||
if (count > SKINNY_MAX_CAPABILITIES) {
|
if (count > SKINNY_MAX_CAPABILITIES) {
|
||||||
|
@ -5319,7 +5328,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny
|
||||||
}
|
}
|
||||||
|
|
||||||
d->capability = d->confcapability & codecs;
|
d->capability = d->confcapability & codecs;
|
||||||
ast_verb(0, "Device capability set to '%d'\n", d->capability);
|
ast_verb(0, "Device capability set to '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), d->capability));
|
||||||
AST_LIST_TRAVERSE(&d->lines, l, list) {
|
AST_LIST_TRAVERSE(&d->lines, l, list) {
|
||||||
ast_mutex_lock(&l->lock);
|
ast_mutex_lock(&l->lock);
|
||||||
l->capability = l->confcapability & d->capability;
|
l->capability = l->confcapability & d->capability;
|
||||||
|
@ -5646,7 +5655,7 @@ static int handle_open_receive_channel_ack_message(struct skinny_req *req, struc
|
||||||
fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
|
fmt = ast_codec_pref_getsize(&l->prefs, ast_best_codec(l->capability));
|
||||||
|
|
||||||
if (skinnydebug)
|
if (skinnydebug)
|
||||||
ast_verb(1, "Setting payloadType to '%d' (%d ms)\n", fmt.bits, fmt.cur_ms);
|
ast_verb(1, "Setting payloadType to '%s' (%d ms)\n", ast_getformatname(fmt.bits), fmt.cur_ms);
|
||||||
|
|
||||||
req->data.startmedia.conferenceId = htolel(sub->callid);
|
req->data.startmedia.conferenceId = htolel(sub->callid);
|
||||||
req->data.startmedia.passThruPartyId = htolel(sub->callid);
|
req->data.startmedia.passThruPartyId = htolel(sub->callid);
|
||||||
|
@ -6576,9 +6585,9 @@ static int skinny_devicestate(void *data)
|
||||||
return get_devicestate(l);
|
return get_devicestate(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *skinny_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
|
static struct ast_channel *skinny_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
|
|
||||||
struct skinny_line *l;
|
struct skinny_line *l;
|
||||||
struct ast_channel *tmpc = NULL;
|
struct ast_channel *tmpc = NULL;
|
||||||
|
@ -6588,7 +6597,7 @@ static struct ast_channel *skinny_request(const char *type, int format, const st
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
|
|
||||||
if (!(format &= AST_FORMAT_AUDIO_MASK)) {
|
if (!(format &= AST_FORMAT_AUDIO_MASK)) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", format);
|
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), format));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ static int reload(void);
|
||||||
static int unload_module(void);
|
static int unload_module(void);
|
||||||
static int reload_config(void);
|
static int reload_config(void);
|
||||||
static void show_main_page(struct unistimsession *pte);
|
static void show_main_page(struct unistimsession *pte);
|
||||||
static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor,
|
static struct ast_channel *unistim_request(const char *type, format_t format, const struct ast_channel *requestor,
|
||||||
void *data, int *cause);
|
void *data, int *cause);
|
||||||
static int unistim_call(struct ast_channel *ast, char *dest, int timeout);
|
static int unistim_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
static int unistim_hangup(struct ast_channel *ast);
|
static int unistim_hangup(struct ast_channel *ast);
|
||||||
|
@ -2035,7 +2035,7 @@ static void start_rtp(struct unistim_subchannel *sub)
|
||||||
struct sockaddr_in us = { 0, };
|
struct sockaddr_in us = { 0, };
|
||||||
struct sockaddr_in public = { 0, };
|
struct sockaddr_in public = { 0, };
|
||||||
struct sockaddr_in sin = { 0, };
|
struct sockaddr_in sin = { 0, };
|
||||||
int codec;
|
format_t codec;
|
||||||
struct sockaddr_in sout = { 0, };
|
struct sockaddr_in sout = { 0, };
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
|
@ -2085,13 +2085,14 @@ static void start_rtp(struct unistim_subchannel *sub)
|
||||||
sin.sin_port = htons(sub->parent->parent->rtp_port);
|
sin.sin_port = htons(sub->parent->parent->rtp_port);
|
||||||
ast_rtp_instance_set_remote_address(sub->rtp, &sin);
|
ast_rtp_instance_set_remote_address(sub->rtp, &sin);
|
||||||
if (!(sub->owner->nativeformats & sub->owner->readformat)) {
|
if (!(sub->owner->nativeformats & sub->owner->readformat)) {
|
||||||
int fmt;
|
format_t fmt;
|
||||||
|
char tmp[256];
|
||||||
fmt = ast_best_codec(sub->owner->nativeformats);
|
fmt = ast_best_codec(sub->owner->nativeformats);
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Our read/writeformat has been changed to something incompatible : %s (%d), using %s (%d) best codec from %d\n",
|
"Our read/writeformat has been changed to something incompatible: %s, using %s best codec from %s\n",
|
||||||
ast_getformatname(sub->owner->readformat),
|
ast_getformatname(sub->owner->readformat),
|
||||||
sub->owner->readformat, ast_getformatname(fmt), fmt,
|
ast_getformatname(fmt),
|
||||||
sub->owner->nativeformats);
|
ast_getformatname_multiple(tmp, sizeof(tmp), sub->owner->nativeformats));
|
||||||
sub->owner->readformat = fmt;
|
sub->owner->readformat = fmt;
|
||||||
sub->owner->writeformat = fmt;
|
sub->owner->writeformat = fmt;
|
||||||
}
|
}
|
||||||
|
@ -2102,20 +2103,19 @@ static void start_rtp(struct unistim_subchannel *sub)
|
||||||
else
|
else
|
||||||
memcpy(&public, &public_ip, sizeof(public)); /* override */
|
memcpy(&public, &public_ip, sizeof(public)); /* override */
|
||||||
if (unistimdebug) {
|
if (unistimdebug) {
|
||||||
ast_verb(0, "RTP started : Our IP/port is : %s:%hd with codec %s (%d)\n",
|
ast_verb(0, "RTP started : Our IP/port is : %s:%hd with codec %s\n",
|
||||||
ast_inet_ntoa(us.sin_addr),
|
ast_inet_ntoa(us.sin_addr),
|
||||||
htons(us.sin_port), ast_getformatname(sub->owner->readformat),
|
htons(us.sin_port), ast_getformatname(sub->owner->readformat));
|
||||||
sub->owner->readformat);
|
|
||||||
ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
|
ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
|
||||||
ast_inet_ntoa(public.sin_addr));
|
ast_inet_ntoa(public.sin_addr));
|
||||||
}
|
}
|
||||||
if ((sub->owner->readformat == AST_FORMAT_ULAW) ||
|
if ((sub->owner->readformat == AST_FORMAT_ULAW) ||
|
||||||
(sub->owner->readformat == AST_FORMAT_ALAW)) {
|
(sub->owner->readformat == AST_FORMAT_ALAW)) {
|
||||||
if (unistimdebug)
|
if (unistimdebug)
|
||||||
ast_verb(0, "Sending packet_send_rtp_packet_size for codec %d\n", codec);
|
ast_verb(0, "Sending packet_send_rtp_packet_size for codec %s\n", ast_getformatname(codec));
|
||||||
memcpy(buffsend + SIZE_HEADER, packet_send_rtp_packet_size,
|
memcpy(buffsend + SIZE_HEADER, packet_send_rtp_packet_size,
|
||||||
sizeof(packet_send_rtp_packet_size));
|
sizeof(packet_send_rtp_packet_size));
|
||||||
buffsend[10] = codec;
|
buffsend[10] = (int) codec & 0xffffffffLL;
|
||||||
send_client(SIZE_HEADER + sizeof(packet_send_rtp_packet_size), buffsend,
|
send_client(SIZE_HEADER + sizeof(packet_send_rtp_packet_size), buffsend,
|
||||||
sub->parent->parent->session);
|
sub->parent->parent->session);
|
||||||
}
|
}
|
||||||
|
@ -2214,8 +2214,8 @@ static void start_rtp(struct unistim_subchannel *sub)
|
||||||
else if (sub->owner->readformat == AST_FORMAT_G729A)
|
else if (sub->owner->readformat == AST_FORMAT_G729A)
|
||||||
buffsend[42] = 2; /* 1 = 10ms (10 bytes), 2 = 20ms (20 bytes) */
|
buffsend[42] = 2; /* 1 = 10ms (10 bytes), 2 = 20ms (20 bytes) */
|
||||||
else
|
else
|
||||||
ast_log(LOG_WARNING, "Unsupported codec %s (%d) !\n",
|
ast_log(LOG_WARNING, "Unsupported codec %s!\n",
|
||||||
ast_getformatname(sub->owner->readformat), sub->owner->readformat);
|
ast_getformatname(sub->owner->readformat));
|
||||||
/* Source port for transmit RTP and Destination port for receiving RTP */
|
/* Source port for transmit RTP and Destination port for receiving RTP */
|
||||||
buffsend[45] = (htons(sin.sin_port) & 0xff00) >> 8;
|
buffsend[45] = (htons(sin.sin_port) & 0xff00) >> 8;
|
||||||
buffsend[46] = (htons(sin.sin_port) & 0x00ff);
|
buffsend[46] = (htons(sin.sin_port) & 0x00ff);
|
||||||
|
@ -2474,7 +2474,7 @@ static void HandleCallIncoming(struct unistimsession *s)
|
||||||
|
|
||||||
static int unistim_do_senddigit(struct unistimsession *pte, char digit)
|
static int unistim_do_senddigit(struct unistimsession *pte, char digit)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass = digit, .src = "unistim" };
|
struct ast_frame f = { .frametype = AST_FRAME_DTMF, .subclass.integer = digit, .src = "unistim" };
|
||||||
struct unistim_subchannel *sub;
|
struct unistim_subchannel *sub;
|
||||||
sub = pte->device->lines->subs[SUB_REAL];
|
sub = pte->device->lines->subs[SUB_REAL];
|
||||||
if (!sub->owner || sub->alreadygone) {
|
if (!sub->owner || sub->alreadygone) {
|
||||||
|
@ -3936,14 +3936,13 @@ static struct ast_frame *unistim_rtp_read(const struct ast_channel *ast,
|
||||||
if (sub->owner) {
|
if (sub->owner) {
|
||||||
/* We already hold the channel lock */
|
/* We already hold the channel lock */
|
||||||
if (f->frametype == AST_FRAME_VOICE) {
|
if (f->frametype == AST_FRAME_VOICE) {
|
||||||
if (f->subclass != sub->owner->nativeformats) {
|
if (f->subclass.codec != sub->owner->nativeformats) {
|
||||||
ast_debug(1,
|
ast_debug(1,
|
||||||
"Oooh, format changed from %s (%d) to %s (%d)\n",
|
"Oooh, format changed from %s to %s\n",
|
||||||
ast_getformatname(sub->owner->nativeformats),
|
ast_getformatname(sub->owner->nativeformats),
|
||||||
sub->owner->nativeformats, ast_getformatname(f->subclass),
|
ast_getformatname(f->subclass.codec));
|
||||||
f->subclass);
|
|
||||||
|
|
||||||
sub->owner->nativeformats = f->subclass;
|
sub->owner->nativeformats = f->subclass.codec;
|
||||||
ast_set_read_format(sub->owner, sub->owner->readformat);
|
ast_set_read_format(sub->owner, sub->owner->readformat);
|
||||||
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
ast_set_write_format(sub->owner, sub->owner->writeformat);
|
||||||
}
|
}
|
||||||
|
@ -3979,13 +3978,14 @@ static int unistim_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(frame->subclass & ast->nativeformats)) {
|
if (!(frame->subclass.codec & ast->nativeformats)) {
|
||||||
|
char tmp[256];
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Asked to transmit frame type %s (%d), while native formats is %s (%d) (read/write = %s (%d)/%d)\n",
|
"Asked to transmit frame type %s, while native formats is %s (read/write = (%s/%s)\n",
|
||||||
ast_getformatname(frame->subclass), frame->subclass,
|
ast_getformatname(frame->subclass.codec),
|
||||||
ast_getformatname(ast->nativeformats), ast->nativeformats,
|
ast_getformatname_multiple(tmp, sizeof(tmp), ast->nativeformats),
|
||||||
ast_getformatname(ast->readformat), ast->readformat,
|
ast_getformatname(ast->readformat),
|
||||||
ast->writeformat);
|
ast_getformatname(ast->writeformat));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4240,7 +4240,7 @@ static int unistim_senddigit_end(struct ast_channel *ast, char digit, unsigned i
|
||||||
|
|
||||||
send_tone(pte, 0, 0);
|
send_tone(pte, 0, 0);
|
||||||
f.frametype = AST_FRAME_DTMF;
|
f.frametype = AST_FRAME_DTMF;
|
||||||
f.subclass = digit;
|
f.subclass.integer = digit;
|
||||||
f.src = "unistim";
|
f.src = "unistim";
|
||||||
ast_queue_frame(sub->owner, &f);
|
ast_queue_frame(sub->owner, &f);
|
||||||
|
|
||||||
|
@ -4450,9 +4450,14 @@ static struct ast_channel *unistim_new(struct unistim_subchannel *sub, int state
|
||||||
if (!tmp->nativeformats)
|
if (!tmp->nativeformats)
|
||||||
tmp->nativeformats = CAPABILITY;
|
tmp->nativeformats = CAPABILITY;
|
||||||
fmt = ast_best_codec(tmp->nativeformats);
|
fmt = ast_best_codec(tmp->nativeformats);
|
||||||
if (unistimdebug)
|
if (unistimdebug) {
|
||||||
ast_verb(0, "Best codec = %d from nativeformats %d (line cap=%d global=%d)\n", fmt,
|
char tmp1[256], tmp2[256], tmp3[256];
|
||||||
tmp->nativeformats, l->capability, CAPABILITY);
|
ast_verb(0, "Best codec = %s from nativeformats %s (line cap=%s global=%s)\n",
|
||||||
|
ast_getformatname(fmt),
|
||||||
|
ast_getformatname_multiple(tmp1, sizeof(tmp1), tmp->nativeformats),
|
||||||
|
ast_getformatname_multiple(tmp2, sizeof(tmp2), l->capability),
|
||||||
|
ast_getformatname_multiple(tmp3, sizeof(tmp3), CAPABILITY));
|
||||||
|
}
|
||||||
if ((sub->rtp) && (sub->subtype == 0)) {
|
if ((sub->rtp) && (sub->subtype == 0)) {
|
||||||
if (unistimdebug)
|
if (unistimdebug)
|
||||||
ast_verb(0, "New unistim channel with a previous rtp handle ?\n");
|
ast_verb(0, "New unistim channel with a previous rtp handle ?\n");
|
||||||
|
@ -4617,10 +4622,10 @@ static int restart_monitor(void)
|
||||||
|
|
||||||
/*--- unistim_request: PBX interface function ---*/
|
/*--- unistim_request: PBX interface function ---*/
|
||||||
/* UNISTIM calls initiated by the PBX arrive here */
|
/* UNISTIM calls initiated by the PBX arrive here */
|
||||||
static struct ast_channel *unistim_request(const char *type, int format, const struct ast_channel *requestor, void *data,
|
static struct ast_channel *unistim_request(const char *type, format_t format, const struct ast_channel *requestor, void *data,
|
||||||
int *cause)
|
int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
struct unistim_subchannel *sub;
|
struct unistim_subchannel *sub;
|
||||||
struct ast_channel *tmpc = NULL;
|
struct ast_channel *tmpc = NULL;
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
@ -4629,12 +4634,14 @@ static struct ast_channel *unistim_request(const char *type, int format, const s
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
format &= CAPABILITY;
|
format &= CAPABILITY;
|
||||||
ast_log(LOG_NOTICE,
|
ast_log(LOG_NOTICE,
|
||||||
"Asked to get a channel of format %s while capability is %d result : %s (%d) \n",
|
"Asked to get a channel of format %s while capability is %s result : %s\n",
|
||||||
ast_getformatname(oldformat), CAPABILITY, ast_getformatname(format), format);
|
ast_getformatname(oldformat),
|
||||||
|
ast_getformatname_multiple(tmp, sizeof(tmp), CAPABILITY),
|
||||||
|
ast_getformatname(format));
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE,
|
ast_log(LOG_NOTICE,
|
||||||
"Asked to get a channel of unsupported format %s while capability is %s\n",
|
"Asked to get a channel of unsupported format %s while capability is %s\n",
|
||||||
ast_getformatname(oldformat), ast_getformatname(CAPABILITY));
|
ast_getformatname(oldformat), ast_getformatname_multiple(tmp, sizeof(tmp), CAPABILITY));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ static struct vpb_pvt {
|
||||||
|
|
||||||
static struct ast_channel *vpb_new(struct vpb_pvt *i, enum ast_channel_state state, const char *context, const char *linkedid);
|
static struct ast_channel *vpb_new(struct vpb_pvt *i, enum ast_channel_state state, const char *context, const char *linkedid);
|
||||||
static void *do_chanreads(void *pvt);
|
static void *do_chanreads(void *pvt);
|
||||||
static struct ast_channel *vpb_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
static struct ast_channel *vpb_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
static int vpb_digit_begin(struct ast_channel *ast, char digit);
|
static int vpb_digit_begin(struct ast_channel *ast, char digit);
|
||||||
static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
static int vpb_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||||
static int vpb_call(struct ast_channel *ast, char *dest, int timeout);
|
static int vpb_call(struct ast_channel *ast, char *dest, int timeout);
|
||||||
|
@ -565,7 +565,7 @@ static enum ast_bridge_result ast_vpb_bridge(struct ast_channel *c0, struct ast_
|
||||||
/* Check if we need to break */
|
/* Check if we need to break */
|
||||||
if (break_for_dtmf) {
|
if (break_for_dtmf) {
|
||||||
break;
|
break;
|
||||||
} else if ((f->frametype == AST_FRAME_DTMF) && ((f->subclass == '#') || (f->subclass == '*'))) {
|
} else if ((f->frametype == AST_FRAME_DTMF) && ((f->subclass.integer == '#') || (f->subclass.integer == '*'))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -838,7 +838,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case VPB_RING:
|
case VPB_RING:
|
||||||
if (p->mode == MODE_FXO) {
|
if (p->mode == MODE_FXO) {
|
||||||
f.subclass = AST_CONTROL_RING;
|
f.subclass.integer = AST_CONTROL_RING;
|
||||||
vpb_timer_stop(p->ring_timer);
|
vpb_timer_stop(p->ring_timer);
|
||||||
vpb_timer_start(p->ring_timer);
|
vpb_timer_start(p->ring_timer);
|
||||||
} else
|
} else
|
||||||
|
@ -866,7 +866,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
if (p->owner->_state != AST_STATE_UP) {
|
if (p->owner->_state != AST_STATE_UP) {
|
||||||
/* Assume caller has hung up */
|
/* Assume caller has hung up */
|
||||||
vpb_timer_stop(p->ring_timer);
|
vpb_timer_stop(p->ring_timer);
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
} else {
|
} else {
|
||||||
vpb_timer_stop(p->ring_timer);
|
vpb_timer_stop(p->ring_timer);
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
|
@ -883,7 +883,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
} else if (p->owner->_state == AST_STATE_UP) {
|
} else if (p->owner->_state == AST_STATE_UP) {
|
||||||
f.frametype = AST_FRAME_DTMF;
|
f.frametype = AST_FRAME_DTMF;
|
||||||
f.subclass = e->data;
|
f.subclass.integer = e->data;
|
||||||
} else
|
} else
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -892,9 +892,9 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
if (e->data == VPB_BUSY || e->data == VPB_BUSY_308 || e->data == VPB_BUSY_AUST ) {
|
if (e->data == VPB_BUSY || e->data == VPB_BUSY_308 || e->data == VPB_BUSY_AUST ) {
|
||||||
ast_debug(4, "%s: handle_owned: got event: BUSY\n", p->dev);
|
ast_debug(4, "%s: handle_owned: got event: BUSY\n", p->dev);
|
||||||
if (p->owner->_state == AST_STATE_UP) {
|
if (p->owner->_state == AST_STATE_UP) {
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
} else {
|
} else {
|
||||||
f.subclass = AST_CONTROL_BUSY;
|
f.subclass.integer = AST_CONTROL_BUSY;
|
||||||
}
|
}
|
||||||
} else if (e->data == VPB_FAX) {
|
} else if (e->data == VPB_FAX) {
|
||||||
if (!p->faxhandled) {
|
if (!p->faxhandled) {
|
||||||
|
@ -923,7 +923,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
* Timeout connection */
|
* Timeout connection */
|
||||||
ast_verb(3, "grunt timeout\n");
|
ast_verb(3, "grunt timeout\n");
|
||||||
ast_log(LOG_NOTICE, "%s: Line hangup due of lack of conversation\n", p->dev);
|
ast_log(LOG_NOTICE, "%s: Line hangup due of lack of conversation\n", p->dev);
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
} else {
|
} else {
|
||||||
p->lastgrunt = ast_tvnow();
|
p->lastgrunt = ast_tvnow();
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
|
@ -936,13 +936,13 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
case VPB_CALLEND:
|
case VPB_CALLEND:
|
||||||
#ifdef DIAL_WITH_CALL_PROGRESS
|
#ifdef DIAL_WITH_CALL_PROGRESS
|
||||||
if (e->data == VPB_CALL_CONNECTED) {
|
if (e->data == VPB_CALL_CONNECTED) {
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
} else if (e->data == VPB_CALL_NO_DIAL_TONE || e->data == VPB_CALL_NO_RING_BACK) {
|
} else if (e->data == VPB_CALL_NO_DIAL_TONE || e->data == VPB_CALL_NO_RING_BACK) {
|
||||||
f.subclass = AST_CONTROL_CONGESTION;
|
f.subclass.integer = AST_CONTROL_CONGESTION;
|
||||||
} else if (e->data == VPB_CALL_NO_ANSWER || e->data == VPB_CALL_BUSY) {
|
} else if (e->data == VPB_CALL_NO_ANSWER || e->data == VPB_CALL_BUSY) {
|
||||||
f.subclass = AST_CONTROL_BUSY;
|
f.subclass.integer = AST_CONTROL_BUSY;
|
||||||
} else if (e->data == VPB_CALL_DISCONNECTED) {
|
} else if (e->data == VPB_CALL_DISCONNECTED) {
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ast_log(LOG_NOTICE, "%s: Got call progress callback but blind dialing \n", p->dev);
|
ast_log(LOG_NOTICE, "%s: Got call progress callback but blind dialing \n", p->dev);
|
||||||
|
@ -951,13 +951,13 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VPB_STATION_OFFHOOK:
|
case VPB_STATION_OFFHOOK:
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VPB_DROP:
|
case VPB_DROP:
|
||||||
if ((p->mode == MODE_FXO) && (UseLoopDrop)) { /* ignore loop drop on stations */
|
if ((p->mode == MODE_FXO) && (UseLoopDrop)) { /* ignore loop drop on stations */
|
||||||
if (p->owner->_state == AST_STATE_UP) {
|
if (p->owner->_state == AST_STATE_UP) {
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
} else {
|
} else {
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
}
|
}
|
||||||
|
@ -965,17 +965,17 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
break;
|
break;
|
||||||
case VPB_LOOP_ONHOOK:
|
case VPB_LOOP_ONHOOK:
|
||||||
if (p->owner->_state == AST_STATE_UP) {
|
if (p->owner->_state == AST_STATE_UP) {
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
} else {
|
} else {
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VPB_STATION_ONHOOK:
|
case VPB_STATION_ONHOOK:
|
||||||
f.subclass = AST_CONTROL_HANGUP;
|
f.subclass.integer = AST_CONTROL_HANGUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VPB_STATION_FLASH:
|
case VPB_STATION_FLASH:
|
||||||
f.subclass = AST_CONTROL_FLASH;
|
f.subclass.integer = AST_CONTROL_FLASH;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Called when dialing has finished and ringing starts
|
/* Called when dialing has finished and ringing starts
|
||||||
|
@ -983,7 +983,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
*/
|
*/
|
||||||
case VPB_DIALEND:
|
case VPB_DIALEND:
|
||||||
if (p->state < 5) {
|
if (p->state < 5) {
|
||||||
f.subclass = AST_CONTROL_ANSWER;
|
f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
ast_verb(2, "%s: Dialend\n", p->dev);
|
ast_verb(2, "%s: Dialend\n", p->dev);
|
||||||
} else {
|
} else {
|
||||||
f.frametype = AST_FRAME_NULL;
|
f.frametype = AST_FRAME_NULL;
|
||||||
|
@ -1063,7 +1063,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_verb(4, "%s: handle_owned: Prepared frame type[%d]subclass[%d], bridge=%p owner=[%s]\n",
|
ast_verb(4, "%s: handle_owned: Prepared frame type[%d]subclass[%d], bridge=%p owner=[%s]\n",
|
||||||
p->dev, f.frametype, f.subclass, (void *)p->bridge, p->owner->name);
|
p->dev, f.frametype, f.subclass.integer, (void *)p->bridge, p->owner->name);
|
||||||
|
|
||||||
/* Trylock used here to avoid deadlock that can occur if we
|
/* Trylock used here to avoid deadlock that can occur if we
|
||||||
* happen to be in here handling an event when hangup is called
|
* happen to be in here handling an event when hangup is called
|
||||||
|
@ -1076,7 +1076,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
|
||||||
ast_verb(4, "%s: handled_owned: Queued Frame to [%s]\n", p->dev, p->owner->name);
|
ast_verb(4, "%s: handled_owned: Queued Frame to [%s]\n", p->dev, p->owner->name);
|
||||||
} else {
|
} else {
|
||||||
ast_verbose("%s: handled_owned: Missed event %d/%d \n",
|
ast_verbose("%s: handled_owned: Missed event %d/%d \n",
|
||||||
p->dev, f.frametype, f.subclass);
|
p->dev, f.frametype, f.subclass.integer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = ast_mutex_unlock(&p->lock);
|
res = ast_mutex_unlock(&p->lock);
|
||||||
|
@ -2097,7 +2097,7 @@ static struct ast_frame *vpb_read(struct ast_channel *ast)
|
||||||
return &f;
|
return &f;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline AudioCompress ast2vpbformat(int ast_format)
|
static inline AudioCompress ast2vpbformat(format_t ast_format)
|
||||||
{
|
{
|
||||||
switch (ast_format) {
|
switch (ast_format) {
|
||||||
case AST_FORMAT_ALAW:
|
case AST_FORMAT_ALAW:
|
||||||
|
@ -2113,7 +2113,7 @@ static inline AudioCompress ast2vpbformat(int ast_format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char * ast2vpbformatname(int ast_format)
|
static inline const char * ast2vpbformatname(format_t ast_format)
|
||||||
{
|
{
|
||||||
switch(ast_format) {
|
switch(ast_format) {
|
||||||
case AST_FORMAT_ALAW:
|
case AST_FORMAT_ALAW:
|
||||||
|
@ -2129,7 +2129,7 @@ static inline const char * ast2vpbformatname(int ast_format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int astformatbits(int ast_format)
|
static inline int astformatbits(format_t ast_format)
|
||||||
{
|
{
|
||||||
switch (ast_format) {
|
switch (ast_format) {
|
||||||
case AST_FORMAT_SLINEAR:
|
case AST_FORMAT_SLINEAR:
|
||||||
|
@ -2175,7 +2175,7 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
/* ast_mutex_unlock(&p->lock); */
|
/* ast_mutex_unlock(&p->lock); */
|
||||||
return 0;
|
return 0;
|
||||||
} else if (ast->_state != AST_STATE_UP) {
|
} else if (ast->_state != AST_STATE_UP) {
|
||||||
ast_verb(4, "%s: vpb_write: Attempt to Write frame type[%d]subclass[%d] on not up chan(state[%d])\n",ast->name, frame->frametype, frame->subclass,ast->_state);
|
ast_verb(4, "%s: vpb_write: Attempt to Write frame type[%d]subclass[%s] on not up chan(state[%d])\n", ast->name, frame->frametype, ast_getformatname(frame->subclass.codec), ast->_state);
|
||||||
p->lastoutput = -1;
|
p->lastoutput = -1;
|
||||||
/* ast_mutex_unlock(&p->lock); */
|
/* ast_mutex_unlock(&p->lock); */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2183,9 +2183,9 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
/* ast_debug(1, "%s: vpb_write: Checked frame type..\n", p->dev); */
|
/* ast_debug(1, "%s: vpb_write: Checked frame type..\n", p->dev); */
|
||||||
|
|
||||||
|
|
||||||
fmt = ast2vpbformat(frame->subclass);
|
fmt = ast2vpbformat(frame->subclass.codec);
|
||||||
if (fmt < 0) {
|
if (fmt < 0) {
|
||||||
ast_log(LOG_WARNING, "%s: vpb_write: Cannot handle frames of %d format!\n", ast->name, frame->subclass);
|
ast_log(LOG_WARNING, "%s: vpb_write: Cannot handle frames of %s format!\n", ast->name, ast_getformatname(frame->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2209,7 +2209,7 @@ static int vpb_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||||
/* Check if we have set up the play_buf */
|
/* Check if we have set up the play_buf */
|
||||||
if (p->lastoutput == -1) {
|
if (p->lastoutput == -1) {
|
||||||
vpb_play_buf_start(p->handle, fmt);
|
vpb_play_buf_start(p->handle, fmt);
|
||||||
ast_verb(2, "%s: vpb_write: Starting play mode (codec=%d)[%s]\n", p->dev, fmt, ast2vpbformatname(frame->subclass));
|
ast_verb(2, "%s: vpb_write: Starting play mode (codec=%d)[%s]\n", p->dev, fmt, ast2vpbformatname(frame->subclass.codec));
|
||||||
p->lastoutput = fmt;
|
p->lastoutput = fmt;
|
||||||
ast_mutex_unlock(&p->play_lock);
|
ast_mutex_unlock(&p->play_lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2259,7 +2259,8 @@ static void *do_chanreads(void *pvt)
|
||||||
struct ast_frame *fr = &p->fr;
|
struct ast_frame *fr = &p->fr;
|
||||||
char *readbuf = ((char *)p->buf) + AST_FRIENDLY_OFFSET;
|
char *readbuf = ((char *)p->buf) + AST_FRIENDLY_OFFSET;
|
||||||
int bridgerec = 0;
|
int bridgerec = 0;
|
||||||
int afmt, readlen, res, trycnt=0;
|
format_t afmt;
|
||||||
|
int readlen, res, trycnt=0;
|
||||||
AudioCompress fmt;
|
AudioCompress fmt;
|
||||||
int ignore_dtmf;
|
int ignore_dtmf;
|
||||||
const char * getdtmf_var = NULL;
|
const char * getdtmf_var = NULL;
|
||||||
|
@ -2363,7 +2364,7 @@ static void *do_chanreads(void *pvt)
|
||||||
}
|
}
|
||||||
fmt = ast2vpbformat(afmt);
|
fmt = ast2vpbformat(afmt);
|
||||||
if (fmt < 0) {
|
if (fmt < 0) {
|
||||||
ast_log(LOG_WARNING, "%s: Record failure (unsupported format %d)\n", p->dev, afmt);
|
ast_log(LOG_WARNING, "%s: Record failure (unsupported format %s)\n", p->dev, ast_getformatname(afmt));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
readlen = VPB_SAMPLES * astformatbits(afmt) / 8;
|
readlen = VPB_SAMPLES * astformatbits(afmt) / 8;
|
||||||
|
@ -2391,16 +2392,16 @@ static void *do_chanreads(void *pvt)
|
||||||
a_gain_vector(p->rxswgain - MAX_VPB_GAIN, (short *)readbuf, readlen / sizeof(short));
|
a_gain_vector(p->rxswgain - MAX_VPB_GAIN, (short *)readbuf, readlen / sizeof(short));
|
||||||
ast_verb(6, "%s: chanreads: applied gain\n", p->dev);
|
ast_verb(6, "%s: chanreads: applied gain\n", p->dev);
|
||||||
|
|
||||||
fr->subclass = afmt;
|
fr->subclass.codec = afmt;
|
||||||
fr->data.ptr = readbuf;
|
fr->data.ptr = readbuf;
|
||||||
fr->datalen = readlen;
|
fr->datalen = readlen;
|
||||||
fr->frametype = AST_FRAME_VOICE;
|
fr->frametype = AST_FRAME_VOICE;
|
||||||
|
|
||||||
if ((use_ast_dtmfdet)&&(p->vad)) {
|
if ((use_ast_dtmfdet) && (p->vad)) {
|
||||||
fr = ast_dsp_process(p->owner,p->vad,fr);
|
fr = ast_dsp_process(p->owner, p->vad, fr);
|
||||||
if (fr && (fr->frametype == AST_FRAME_DTMF)) {
|
if (fr && (fr->frametype == AST_FRAME_DTMF)) {
|
||||||
ast_debug(1, "%s: chanreads: Detected DTMF '%c'\n", p->dev, fr->subclass);
|
ast_debug(1, "%s: chanreads: Detected DTMF '%c'\n", p->dev, fr->subclass.integer);
|
||||||
} else if (fr->subclass == 'f') {
|
} else if (fr->subclass.integer == 'f') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Using trylock here to prevent deadlock when channel is hungup
|
/* Using trylock here to prevent deadlock when channel is hungup
|
||||||
|
@ -2541,9 +2542,9 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_channel *vpb_request(const char *type, int format, const struct ast_channel *requestor, void *vdata, int *cause)
|
static struct ast_channel *vpb_request(const char *type, format_t format, const struct ast_channel *requestor, void *vdata, int *cause)
|
||||||
{
|
{
|
||||||
int oldformat;
|
format_t oldformat;
|
||||||
struct vpb_pvt *p;
|
struct vpb_pvt *p;
|
||||||
struct ast_channel *tmp = NULL;
|
struct ast_channel *tmp = NULL;
|
||||||
char *sepstr, *data = (char *)vdata, *name;
|
char *sepstr, *data = (char *)vdata, *name;
|
||||||
|
@ -2553,7 +2554,7 @@ static struct ast_channel *vpb_request(const char *type, int format, const struc
|
||||||
oldformat = format;
|
oldformat = format;
|
||||||
format &= prefformat;
|
format &= prefformat;
|
||||||
if (!format) {
|
if (!format) {
|
||||||
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%d'\n", oldformat);
|
ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname(oldformat));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define CHAN_H323_H
|
#define CHAN_H323_H
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include "asterisk/frame_defs.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable support for sending/reception of tunnelled Q.SIG messages and
|
* Enable support for sending/reception of tunnelled Q.SIG messages and
|
||||||
|
@ -64,7 +65,7 @@ typedef struct call_options {
|
||||||
int progress_audio;
|
int progress_audio;
|
||||||
int dtmfcodec[2];
|
int dtmfcodec[2];
|
||||||
int dtmfmode;
|
int dtmfmode;
|
||||||
int capability;
|
format_t capability;
|
||||||
int bridge;
|
int bridge;
|
||||||
int nat;
|
int nat;
|
||||||
int tunnelOptions;
|
int tunnelOptions;
|
||||||
|
|
|
@ -214,6 +214,21 @@ static void dump_samprate(char *output, int maxlen, void *value, int len)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dump_versioned_codec(char *output, int maxlen, void *value, int len)
|
||||||
|
{
|
||||||
|
char *version = (char *) value;
|
||||||
|
if (version[0] == 0) {
|
||||||
|
if (len == (int) (sizeof(format_t) + sizeof(char))) {
|
||||||
|
format_t codec = ntohll(get_unaligned_uint64(value + 1));
|
||||||
|
ast_copy_string(output, ast_getformatname(codec), maxlen);
|
||||||
|
} else {
|
||||||
|
ast_copy_string(output, "Invalid length!", maxlen);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ast_copy_string(output, "Unknown version!", maxlen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void dump_prov_ies(char *output, int maxlen, unsigned char *iedata, int len);
|
static void dump_prov_ies(char *output, int maxlen, unsigned char *iedata, int len);
|
||||||
static void dump_prov(char *output, int maxlen, void *value, int len)
|
static void dump_prov(char *output, int maxlen, void *value, int len)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +248,9 @@ static struct iax2_ie {
|
||||||
{ IAX_IE_USERNAME, "USERNAME", dump_string },
|
{ IAX_IE_USERNAME, "USERNAME", dump_string },
|
||||||
{ IAX_IE_PASSWORD, "PASSWORD", dump_string },
|
{ IAX_IE_PASSWORD, "PASSWORD", dump_string },
|
||||||
{ IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
|
{ IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
|
||||||
|
{ IAX_IE_CAPABILITY2, "CAPABILITY2", dump_versioned_codec },
|
||||||
{ IAX_IE_FORMAT, "FORMAT", dump_int },
|
{ IAX_IE_FORMAT, "FORMAT", dump_int },
|
||||||
|
{ IAX_IE_FORMAT2, "FORMAT2", dump_versioned_codec },
|
||||||
{ IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
|
{ IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
|
||||||
{ IAX_IE_VERSION, "VERSION", dump_short },
|
{ IAX_IE_VERSION, "VERSION", dump_short },
|
||||||
{ IAX_IE_ADSICPE, "ADSICPE", dump_short },
|
{ IAX_IE_ADSICPE, "ADSICPE", dump_short },
|
||||||
|
@ -679,6 +696,16 @@ int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct s
|
||||||
return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in));
|
return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iax_ie_append_versioned_uint64(struct iax_ie_data *ied, unsigned char ie, unsigned char version, uint64_t value)
|
||||||
|
{
|
||||||
|
struct _local {
|
||||||
|
unsigned char version;
|
||||||
|
uint64_t value;
|
||||||
|
} __attribute__((packed)) newval = { version, };
|
||||||
|
put_unaligned_uint64(&newval.value, htonll(value));
|
||||||
|
return iax_ie_append_raw(ied, ie, &newval, (int) sizeof(newval));
|
||||||
|
}
|
||||||
|
|
||||||
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
|
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
|
||||||
{
|
{
|
||||||
unsigned int newval;
|
unsigned int newval;
|
||||||
|
@ -769,15 +796,43 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
|
||||||
if (len != (int)sizeof(unsigned int)) {
|
if (len != (int)sizeof(unsigned int)) {
|
||||||
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
|
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
|
||||||
errorf(tmp);
|
errorf(tmp);
|
||||||
} else
|
} else if (ies->capability == 0) { /* Don't overwrite capability2, if specified */
|
||||||
ies->capability = ntohl(get_unaligned_uint32(data + 2));
|
ies->capability = ntohll(get_unaligned_uint32(data + 2));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IAX_IE_CAPABILITY2:
|
||||||
|
{
|
||||||
|
int version = data[2];
|
||||||
|
if (version == 0) {
|
||||||
|
if (len != (int)sizeof(char) + sizeof(format_t)) {
|
||||||
|
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int) (sizeof(format_t) + sizeof(char)), len);
|
||||||
|
errorf(tmp);
|
||||||
|
} else {
|
||||||
|
ies->capability = (format_t) ntohll(get_unaligned_uint64(data + 3));
|
||||||
|
}
|
||||||
|
} /* else unknown version */
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IAX_IE_FORMAT:
|
case IAX_IE_FORMAT:
|
||||||
if (len != (int)sizeof(unsigned int)) {
|
if (len != (int)sizeof(unsigned int)) {
|
||||||
snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
|
snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
|
||||||
errorf(tmp);
|
errorf(tmp);
|
||||||
} else
|
} else if (ies->format == 0) { /* Don't overwrite format2, if specified */
|
||||||
ies->format = ntohl(get_unaligned_uint32(data + 2));
|
ies->format = ntohl(get_unaligned_uint32(data + 2));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IAX_IE_FORMAT2:
|
||||||
|
{
|
||||||
|
int version = data[2];
|
||||||
|
if (version == 0) {
|
||||||
|
if (len != (int)sizeof(char) + sizeof(format_t)) {
|
||||||
|
snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int) (sizeof(format_t) + sizeof(char)), len);
|
||||||
|
errorf(tmp);
|
||||||
|
} else {
|
||||||
|
ies->format = (format_t) ntohll(get_unaligned_uint64(data + 3));
|
||||||
|
}
|
||||||
|
} /* else unknown version */
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IAX_IE_LANGUAGE:
|
case IAX_IE_LANGUAGE:
|
||||||
ies->language = (char *)data + 2;
|
ies->language = (char *)data + 2;
|
||||||
|
@ -1083,7 +1138,7 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen)
|
||||||
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
|
void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
|
||||||
{
|
{
|
||||||
fr->af.frametype = f->frametype;
|
fr->af.frametype = f->frametype;
|
||||||
fr->af.subclass = f->subclass;
|
fr->af.subclass.codec = f->subclass.codec;
|
||||||
fr->af.mallocd = 0; /* Our frame is static relative to the container */
|
fr->af.mallocd = 0; /* Our frame is static relative to the container */
|
||||||
fr->af.datalen = f->datalen;
|
fr->af.datalen = f->datalen;
|
||||||
fr->af.samples = f->samples;
|
fr->af.samples = f->samples;
|
||||||
|
@ -1102,7 +1157,7 @@ void iax_frame_wrap(struct iax_frame *fr, struct ast_frame *f)
|
||||||
}
|
}
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
/* We need to byte-swap slinear samples from network byte order */
|
/* We need to byte-swap slinear samples from network byte order */
|
||||||
if ((fr->af.frametype == AST_FRAME_VOICE) && (fr->af.subclass == AST_FORMAT_SLINEAR)) {
|
if ((fr->af.frametype == AST_FRAME_VOICE) && (fr->af.subclass.codec == AST_FORMAT_SLINEAR)) {
|
||||||
/* 2 bytes / sample for SLINEAR */
|
/* 2 bytes / sample for SLINEAR */
|
||||||
ast_swapcopy_samples(fr->af.data.ptr, f->data.ptr, copy_len / 2);
|
ast_swapcopy_samples(fr->af.data.ptr, f->data.ptr, copy_len / 2);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
#include "asterisk/aes.h"
|
#include "asterisk/aes.h"
|
||||||
|
#include "asterisk/frame_defs.h"
|
||||||
|
|
||||||
struct iax_ies {
|
struct iax_ies {
|
||||||
char *called_number;
|
char *called_number;
|
||||||
|
@ -32,8 +33,8 @@ struct iax_ies {
|
||||||
char *called_context;
|
char *called_context;
|
||||||
char *username;
|
char *username;
|
||||||
char *password;
|
char *password;
|
||||||
unsigned int capability;
|
format_t capability;
|
||||||
unsigned int format;
|
format_t format;
|
||||||
char *codec_prefs;
|
char *codec_prefs;
|
||||||
char *language;
|
char *language;
|
||||||
int version;
|
int version;
|
||||||
|
@ -158,6 +159,7 @@ const char *iax_ie2str(int ie);
|
||||||
|
|
||||||
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen);
|
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen);
|
||||||
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct sockaddr_in *sin);
|
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, const struct sockaddr_in *sin);
|
||||||
|
int iax_ie_append_versioned_uint64(struct iax_ie_data *ied, unsigned char ie, unsigned char version, uint64_t value);
|
||||||
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
|
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
|
||||||
int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
|
int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
|
||||||
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str);
|
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const char *str);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
#define IAX_FLAG_SC_LOG 0x80
|
#define IAX_FLAG_SC_LOG 0x80
|
||||||
|
|
||||||
#define IAX_MAX_SHIFT 0x1F
|
#define IAX_MAX_SHIFT 0x3F
|
||||||
|
|
||||||
#define IAX_WINDOW 64
|
#define IAX_WINDOW 64
|
||||||
|
|
||||||
|
@ -180,6 +180,9 @@ enum iax_frame_subclass {
|
||||||
#define IAX_IE_OSPTOKEN 53 /*!< OSP token */
|
#define IAX_IE_OSPTOKEN 53 /*!< OSP token */
|
||||||
#define IAX_IE_CALLTOKEN 54 /*!< Call number security token */
|
#define IAX_IE_CALLTOKEN 54 /*!< Call number security token */
|
||||||
|
|
||||||
|
#define IAX_IE_CAPABILITY2 55 /*!< Actual codec capability - u8 version + integer array */
|
||||||
|
#define IAX_IE_FORMAT2 56 /*!< Desired codec format - u8 version + integer array */
|
||||||
|
|
||||||
#define IAX_MAX_OSPBLOCK_SIZE 254 /*!< Max OSP token block size, 255 bytes - 1 byte OSP token block index */
|
#define IAX_MAX_OSPBLOCK_SIZE 254 /*!< Max OSP token block size, 255 bytes - 1 byte OSP token block index */
|
||||||
#define IAX_MAX_OSPBLOCK_NUM 4
|
#define IAX_MAX_OSPBLOCK_NUM 4
|
||||||
#define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
|
#define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
|
||||||
|
|
|
@ -1331,7 +1331,7 @@ int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
|
||||||
|
|
||||||
static int analog_handles_digit(struct ast_frame *f)
|
static int analog_handles_digit(struct ast_frame *f)
|
||||||
{
|
{
|
||||||
char subclass = toupper(f->subclass);
|
char subclass = toupper(f->subclass.integer);
|
||||||
|
|
||||||
switch (subclass) {
|
switch (subclass) {
|
||||||
case '1':
|
case '1':
|
||||||
|
@ -1363,13 +1363,13 @@ void analog_handle_dtmfup(struct analog_pvt *p, struct ast_channel *ast, enum an
|
||||||
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
|
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
|
||||||
of a DTMF digit */
|
of a DTMF digit */
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
*dest = &p->subs[index].f;
|
*dest = &p->subs[index].f;
|
||||||
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
|
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
|
||||||
analog_set_confirmanswer(p, 0);
|
analog_set_confirmanswer(p, 0);
|
||||||
}
|
}
|
||||||
if (p->callwaitcas) {
|
if (p->callwaitcas) {
|
||||||
if ((f->subclass == 'A') || (f->subclass == 'D')) {
|
if ((f->subclass.integer == 'A') || (f->subclass.integer == 'D')) {
|
||||||
ast_log(LOG_ERROR, "Got some DTMF, but it's for the CAS\n");
|
ast_log(LOG_ERROR, "Got some DTMF, but it's for the CAS\n");
|
||||||
p->cid.cid_name = p->callwait_name;
|
p->cid.cid_name = p->callwait_name;
|
||||||
p->cid.cid_num = p->callwait_num;
|
p->cid.cid_num = p->callwait_num;
|
||||||
|
@ -1378,7 +1378,7 @@ void analog_handle_dtmfup(struct analog_pvt *p, struct ast_channel *ast, enum an
|
||||||
if (analog_handles_digit(f))
|
if (analog_handles_digit(f))
|
||||||
p->callwaitcas = 0;
|
p->callwaitcas = 0;
|
||||||
p->subs[index].f.frametype = AST_FRAME_NULL;
|
p->subs[index].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
*dest = &p->subs[index].f;
|
*dest = &p->subs[index].f;
|
||||||
} else {
|
} else {
|
||||||
analog_cb_handle_dtmfup(p, ast, index, dest);
|
analog_cb_handle_dtmfup(p, ast, index, dest);
|
||||||
|
@ -2117,8 +2117,8 @@ static void *__analog_ss_thread(void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_DTMF) {
|
if (f->frametype == AST_FRAME_DTMF) {
|
||||||
dtmfbuf[i++] = f->subclass;
|
dtmfbuf[i++] = f->subclass.integer;
|
||||||
ast_debug(1, "CID got digit '%c'\n", f->subclass);
|
ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
|
||||||
res = 2000;
|
res = 2000;
|
||||||
}
|
}
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
|
@ -2354,7 +2354,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
mysig = p->outsigmod;
|
mysig = p->outsigmod;
|
||||||
}
|
}
|
||||||
p->subs[index].f.frametype = AST_FRAME_NULL;
|
p->subs[index].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
p->subs[index].f.datalen = 0;
|
p->subs[index].f.datalen = 0;
|
||||||
p->subs[index].f.samples = 0;
|
p->subs[index].f.samples = 0;
|
||||||
p->subs[index].f.mallocd = 0;
|
p->subs[index].f.mallocd = 0;
|
||||||
|
@ -2380,7 +2380,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
ast_debug(1, "Detected %sdigit '%c'\n", (res & ANALOG_EVENT_PULSEDIGIT) ? "pulse ": "", res & 0xff);
|
ast_debug(1, "Detected %sdigit '%c'\n", (res & ANALOG_EVENT_PULSEDIGIT) ? "pulse ": "", res & 0xff);
|
||||||
analog_confmute(p, 0);
|
analog_confmute(p, 0);
|
||||||
p->subs[index].f.frametype = AST_FRAME_DTMF_END;
|
p->subs[index].f.frametype = AST_FRAME_DTMF_END;
|
||||||
p->subs[index].f.subclass = res & 0xff;
|
p->subs[index].f.subclass.integer = res & 0xff;
|
||||||
analog_handle_dtmfup(p, ast, index, &f);
|
analog_handle_dtmfup(p, ast, index, &f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@ -2390,7 +2390,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
/* Mute conference */
|
/* Mute conference */
|
||||||
analog_confmute(p, 1);
|
analog_confmute(p, 1);
|
||||||
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
|
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
|
||||||
p->subs[index].f.subclass = res & 0xff;
|
p->subs[index].f.subclass.integer = res & 0xff;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2438,7 +2438,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
|
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
break;
|
break;
|
||||||
} else { /* if to state wait for offhook to dial rest */
|
} else { /* if to state wait for offhook to dial rest */
|
||||||
/* we now wait for off hook */
|
/* we now wait for off hook */
|
||||||
|
@ -2451,7 +2451,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
} else if (!p->answeronpolarityswitch) {
|
} else if (!p->answeronpolarityswitch) {
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
/* If aops=0 and hops=1, this is necessary */
|
/* If aops=0 and hops=1, this is necessary */
|
||||||
p->polarity = POLARITY_REV;
|
p->polarity = POLARITY_REV;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2623,7 +2623,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
analog_set_echocanceller(p, 1);
|
analog_set_echocanceller(p, 1);
|
||||||
analog_train_echocanceller(p);
|
analog_train_echocanceller(p);
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
/* Make sure it stops ringing */
|
/* Make sure it stops ringing */
|
||||||
analog_off_hook(p);
|
analog_off_hook(p);
|
||||||
ast_debug(1, "channel %d answered\n", p->channel);
|
ast_debug(1, "channel %d answered\n", p->channel);
|
||||||
|
@ -2633,7 +2633,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
if (analog_check_confirmanswer(p)) {
|
if (analog_check_confirmanswer(p)) {
|
||||||
/* Ignore answer if "confirm answer" is enabled */
|
/* Ignore answer if "confirm answer" is enabled */
|
||||||
p->subs[index].f.frametype = AST_FRAME_NULL;
|
p->subs[index].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
} else if (!ast_strlen_zero(p->dop.dialstr)) {
|
} else if (!ast_strlen_zero(p->dop.dialstr)) {
|
||||||
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
|
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
|
||||||
res = analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop);
|
res = analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop);
|
||||||
|
@ -2644,7 +2644,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
} else {
|
} else {
|
||||||
ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
|
ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
|
||||||
p->subs[index].f.frametype = AST_FRAME_NULL;
|
p->subs[index].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
analog_set_dialing(p, 1);
|
analog_set_dialing(p, 1);
|
||||||
}
|
}
|
||||||
p->dop.dialstr[0] = '\0';
|
p->dop.dialstr[0] = '\0';
|
||||||
|
@ -2657,7 +2657,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
ast_setstate(ast, AST_STATE_RING);
|
ast_setstate(ast, AST_STATE_RING);
|
||||||
ast->rings = 1;
|
ast->rings = 1;
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_OFFHOOK;
|
p->subs[index].f.subclass.integer = AST_CONTROL_OFFHOOK;
|
||||||
ast_debug(1, "channel %d picked up\n", p->channel);
|
ast_debug(1, "channel %d picked up\n", p->channel);
|
||||||
return &p->subs[index].f;
|
return &p->subs[index].f;
|
||||||
case AST_STATE_UP:
|
case AST_STATE_UP:
|
||||||
|
@ -2709,15 +2709,15 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) {
|
if ((ast->_state == AST_STATE_DOWN) || (ast->_state == AST_STATE_RING)) {
|
||||||
ast_debug(1, "Ring detected\n");
|
ast_debug(1, "Ring detected\n");
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_RING;
|
p->subs[index].f.subclass.integer = AST_CONTROL_RING;
|
||||||
} else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) {
|
} else if (p->outgoing && ((ast->_state == AST_STATE_RINGING) || (ast->_state == AST_STATE_DIALING))) {
|
||||||
ast_debug(1, "Line answered\n");
|
ast_debug(1, "Line answered\n");
|
||||||
if (analog_check_confirmanswer(p)) {
|
if (analog_check_confirmanswer(p)) {
|
||||||
p->subs[index].f.frametype = AST_FRAME_NULL;
|
p->subs[index].f.frametype = AST_FRAME_NULL;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
} else {
|
} else {
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
|
p->subs[index].f.subclass.integer = AST_CONTROL_ANSWER;
|
||||||
ast_setstate(ast, AST_STATE_UP);
|
ast_setstate(ast, AST_STATE_UP);
|
||||||
}
|
}
|
||||||
} else if (ast->_state != AST_STATE_RING) {
|
} else if (ast->_state != AST_STATE_RING) {
|
||||||
|
@ -2753,7 +2753,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
|
||||||
p->callwaitcas = 0;
|
p->callwaitcas = 0;
|
||||||
}
|
}
|
||||||
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
p->subs[index].f.frametype = AST_FRAME_CONTROL;
|
||||||
p->subs[index].f.subclass = AST_CONTROL_RINGING;
|
p->subs[index].f.subclass.integer = AST_CONTROL_RINGING;
|
||||||
break;
|
break;
|
||||||
case ANALOG_EVENT_RINGERON:
|
case ANALOG_EVENT_RINGERON:
|
||||||
break;
|
break;
|
||||||
|
@ -3160,7 +3160,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast
|
||||||
p->subs[index].f.samples = 0;
|
p->subs[index].f.samples = 0;
|
||||||
p->subs[index].f.mallocd = 0;
|
p->subs[index].f.mallocd = 0;
|
||||||
p->subs[index].f.offset = 0;
|
p->subs[index].f.offset = 0;
|
||||||
p->subs[index].f.subclass = 0;
|
p->subs[index].f.subclass.integer = 0;
|
||||||
p->subs[index].f.delivery = ast_tv(0,0);
|
p->subs[index].f.delivery = ast_tv(0,0);
|
||||||
p->subs[index].f.src = "dahdi_exception";
|
p->subs[index].f.src = "dahdi_exception";
|
||||||
p->subs[index].f.data.ptr = NULL;
|
p->subs[index].f.data.ptr = NULL;
|
||||||
|
|
|
@ -840,7 +840,7 @@ static void pri_queue_control(struct sig_pri_chan *p, int subclass, struct sig_p
|
||||||
p->calls->queue_control(p->chan_pvt, subclass);
|
p->calls->queue_control(p->chan_pvt, subclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
f.subclass = subclass;
|
f.subclass.integer = subclass;
|
||||||
pri_queue_frame(p, &f, pri);
|
pri_queue_frame(p, &f, pri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1200,7 +1200,7 @@ static void *do_idle_thread(void *vchan)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (f->frametype == AST_FRAME_CONTROL) {
|
if (f->frametype == AST_FRAME_CONTROL) {
|
||||||
switch (f->subclass) {
|
switch (f->subclass.integer) {
|
||||||
case AST_CONTROL_ANSWER:
|
case AST_CONTROL_ANSWER:
|
||||||
/* Launch the PBX */
|
/* Launch the PBX */
|
||||||
ast_copy_string(chan->exten, pvt->pri->idleext, sizeof(chan->exten));
|
ast_copy_string(chan->exten, pvt->pri->idleext, sizeof(chan->exten));
|
||||||
|
@ -1777,7 +1777,7 @@ static int sig_pri_handle_hold(struct sig_pri_pri *pri, pri_event *ev)
|
||||||
} else {
|
} else {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, };
|
struct ast_frame f = { AST_FRAME_CONTROL, };
|
||||||
|
|
||||||
f.subclass = AST_CONTROL_HOLD;
|
f.subclass.integer = AST_CONTROL_HOLD;
|
||||||
ast_queue_frame(owner, &f);
|
ast_queue_frame(owner, &f);
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
|
@ -1848,7 +1848,7 @@ static void sig_pri_handle_retrieve(struct sig_pri_pri *pri, pri_event *ev)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, };
|
struct ast_frame f = { AST_FRAME_CONTROL, };
|
||||||
|
|
||||||
f.subclass = AST_CONTROL_UNHOLD;
|
f.subclass.integer = AST_CONTROL_UNHOLD;
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
sig_pri_unlock_private(pri->pvts[chanpos]);
|
sig_pri_unlock_private(pri->pvts[chanpos]);
|
||||||
|
@ -2192,7 +2192,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < digitlen; i++) {
|
for (i = 0; i < digitlen; i++) {
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, e->digit.digits[i], };
|
struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = e->digit.digits[i], };
|
||||||
|
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
|
@ -2222,7 +2222,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < digitlen; i++) {
|
for (i = 0; i < digitlen; i++) {
|
||||||
struct ast_frame f = { AST_FRAME_DTMF, e->ring.callednum[i], };
|
struct ast_frame f = { AST_FRAME_DTMF, .subclass.integer = e->ring.callednum[i], };
|
||||||
|
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
|
@ -2685,7 +2685,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
|| (e->proceeding.progress == 8)
|
|| (e->proceeding.progress == 8)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
|
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_PROGRESS, };
|
||||||
|
|
||||||
if (e->proceeding.cause > -1) {
|
if (e->proceeding.cause > -1) {
|
||||||
ast_verb(3, "PROGRESS with cause code %d received\n", e->proceeding.cause);
|
ast_verb(3, "PROGRESS with cause code %d received\n", e->proceeding.cause);
|
||||||
|
@ -2696,7 +2696,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
ast_verb(3, "PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n");
|
ast_verb(3, "PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n");
|
||||||
|
|
||||||
pri->pvts[chanpos]->owner->hangupcause = e->proceeding.cause;
|
pri->pvts[chanpos]->owner->hangupcause = e->proceeding.cause;
|
||||||
f.subclass = AST_CONTROL_BUSY;
|
f.subclass.integer = AST_CONTROL_BUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2712,7 +2712,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
/* Bring voice path up */
|
/* Bring voice path up */
|
||||||
f.subclass = AST_CONTROL_PROGRESS;
|
f.subclass.integer = AST_CONTROL_PROGRESS;
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
pri->pvts[chanpos]->progress = 1;
|
pri->pvts[chanpos]->progress = 1;
|
||||||
|
@ -2728,7 +2728,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
sig_pri_handle_subcmds(pri, chanpos, e->e, e->proceeding.channel,
|
sig_pri_handle_subcmds(pri, chanpos, e->e, e->proceeding.channel,
|
||||||
e->proceeding.subcmds, e->proceeding.call);
|
e->proceeding.subcmds, e->proceeding.call);
|
||||||
if (!pri->pvts[chanpos]->proceeding) {
|
if (!pri->pvts[chanpos]->proceeding) {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
|
struct ast_frame f = { AST_FRAME_CONTROL, .subclass.integer = AST_CONTROL_PROCEEDING, };
|
||||||
|
|
||||||
ast_debug(1, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
|
ast_debug(1, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
|
||||||
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
|
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
|
||||||
|
@ -2741,7 +2741,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
/* Bring voice path up */
|
/* Bring voice path up */
|
||||||
f.subclass = AST_CONTROL_PROGRESS;
|
f.subclass.integer = AST_CONTROL_PROGRESS;
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
pri->pvts[chanpos]->proceeding = 1;
|
pri->pvts[chanpos]->proceeding = 1;
|
||||||
|
@ -3103,7 +3103,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
if (!pri->discardremoteholdretrieval) {
|
if (!pri->discardremoteholdretrieval) {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, };
|
struct ast_frame f = { AST_FRAME_CONTROL, };
|
||||||
|
|
||||||
f.subclass = AST_CONTROL_HOLD;
|
f.subclass.integer = AST_CONTROL_HOLD;
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3111,7 +3111,7 @@ static void *pri_dchannel(void *vpri)
|
||||||
if (!pri->discardremoteholdretrieval) {
|
if (!pri->discardremoteholdretrieval) {
|
||||||
struct ast_frame f = { AST_FRAME_CONTROL, };
|
struct ast_frame f = { AST_FRAME_CONTROL, };
|
||||||
|
|
||||||
f.subclass = AST_CONTROL_UNHOLD;
|
f.subclass.integer = AST_CONTROL_UNHOLD;
|
||||||
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
pri_queue_frame(pri->pvts[chanpos], &f, pri);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -181,7 +181,7 @@ static int dahdi_encoder_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
||||||
{
|
{
|
||||||
struct codec_dahdi_pvt *dahdip = pvt->pvt;
|
struct codec_dahdi_pvt *dahdip = pvt->pvt;
|
||||||
|
|
||||||
if (!f->subclass) {
|
if (!f->subclass.codec) {
|
||||||
/* We're just faking a return for calculation purposes. */
|
/* We're just faking a return for calculation purposes. */
|
||||||
dahdip->fake = 2;
|
dahdip->fake = 2;
|
||||||
pvt->samples = f->samples;
|
pvt->samples = f->samples;
|
||||||
|
@ -229,7 +229,7 @@ static struct ast_frame *dahdi_encoder_frameout(struct ast_trans_pvt *pvt)
|
||||||
if (2 == dahdip->fake) {
|
if (2 == dahdip->fake) {
|
||||||
dahdip->fake = 1;
|
dahdip->fake = 1;
|
||||||
pvt->f.frametype = AST_FRAME_VOICE;
|
pvt->f.frametype = AST_FRAME_VOICE;
|
||||||
pvt->f.subclass = 0;
|
pvt->f.subclass.codec = 0;
|
||||||
pvt->f.samples = dahdip->required_samples;
|
pvt->f.samples = dahdip->required_samples;
|
||||||
pvt->f.data.ptr = NULL;
|
pvt->f.data.ptr = NULL;
|
||||||
pvt->f.offset = 0;
|
pvt->f.offset = 0;
|
||||||
|
@ -257,7 +257,7 @@ static struct ast_frame *dahdi_encoder_frameout(struct ast_trans_pvt *pvt)
|
||||||
pvt->f.datalen = res;
|
pvt->f.datalen = res;
|
||||||
pvt->f.samples = dahdip->required_samples;
|
pvt->f.samples = dahdip->required_samples;
|
||||||
pvt->f.frametype = AST_FRAME_VOICE;
|
pvt->f.frametype = AST_FRAME_VOICE;
|
||||||
pvt->f.subclass = 1 << (pvt->t->dstfmt);
|
pvt->f.subclass.codec = 1 << (pvt->t->dstfmt);
|
||||||
pvt->f.mallocd = 0;
|
pvt->f.mallocd = 0;
|
||||||
pvt->f.offset = AST_FRIENDLY_OFFSET;
|
pvt->f.offset = AST_FRIENDLY_OFFSET;
|
||||||
pvt->f.src = pvt->t->name;
|
pvt->f.src = pvt->t->name;
|
||||||
|
@ -276,7 +276,7 @@ static int dahdi_decoder_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
|
||||||
{
|
{
|
||||||
struct codec_dahdi_pvt *dahdip = pvt->pvt;
|
struct codec_dahdi_pvt *dahdip = pvt->pvt;
|
||||||
|
|
||||||
if (!f->subclass) {
|
if (!f->subclass.codec) {
|
||||||
/* We're just faking a return for calculation purposes. */
|
/* We're just faking a return for calculation purposes. */
|
||||||
dahdip->fake = 2;
|
dahdip->fake = 2;
|
||||||
pvt->samples = f->samples;
|
pvt->samples = f->samples;
|
||||||
|
@ -302,7 +302,7 @@ static struct ast_frame *dahdi_decoder_frameout(struct ast_trans_pvt *pvt)
|
||||||
if (2 == dahdip->fake) {
|
if (2 == dahdip->fake) {
|
||||||
dahdip->fake = 1;
|
dahdip->fake = 1;
|
||||||
pvt->f.frametype = AST_FRAME_VOICE;
|
pvt->f.frametype = AST_FRAME_VOICE;
|
||||||
pvt->f.subclass = 0;
|
pvt->f.subclass.codec = 0;
|
||||||
pvt->f.samples = dahdip->required_samples;
|
pvt->f.samples = dahdip->required_samples;
|
||||||
pvt->f.data.ptr = NULL;
|
pvt->f.data.ptr = NULL;
|
||||||
pvt->f.offset = 0;
|
pvt->f.offset = 0;
|
||||||
|
@ -340,7 +340,7 @@ static struct ast_frame *dahdi_decoder_frameout(struct ast_trans_pvt *pvt)
|
||||||
}
|
}
|
||||||
pvt->datalen = 0;
|
pvt->datalen = 0;
|
||||||
pvt->f.frametype = AST_FRAME_VOICE;
|
pvt->f.frametype = AST_FRAME_VOICE;
|
||||||
pvt->f.subclass = 1 << (pvt->t->dstfmt);
|
pvt->f.subclass.codec = 1 << (pvt->t->dstfmt);
|
||||||
pvt->f.mallocd = 0;
|
pvt->f.mallocd = 0;
|
||||||
pvt->f.offset = AST_FRIENDLY_OFFSET;
|
pvt->f.offset = AST_FRIENDLY_OFFSET;
|
||||||
pvt->f.src = pvt->t->name;
|
pvt->f.src = pvt->t->name;
|
||||||
|
|
|
@ -87,6 +87,17 @@ static struct ast_translator ulawtolin = {
|
||||||
.plc_samples = 160,
|
.plc_samples = 160,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct ast_translator testlawtolin = {
|
||||||
|
.name = "testlawtolin",
|
||||||
|
.srcfmt = AST_FORMAT_TESTLAW,
|
||||||
|
.dstfmt = AST_FORMAT_SLINEAR,
|
||||||
|
.framein = ulawtolin_framein,
|
||||||
|
.sample = ulaw_sample,
|
||||||
|
.buffer_samples = BUFFER_SAMPLES,
|
||||||
|
.buf_size = BUFFER_SAMPLES * 2,
|
||||||
|
.plc_samples = 160,
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The complete translator for LinToulaw.
|
* \brief The complete translator for LinToulaw.
|
||||||
*/
|
*/
|
||||||
|
@ -101,6 +112,16 @@ static struct ast_translator lintoulaw = {
|
||||||
.buffer_samples = BUFFER_SAMPLES,
|
.buffer_samples = BUFFER_SAMPLES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct ast_translator lintotestlaw = {
|
||||||
|
.name = "lintotestlaw",
|
||||||
|
.srcfmt = AST_FORMAT_SLINEAR,
|
||||||
|
.dstfmt = AST_FORMAT_TESTLAW,
|
||||||
|
.framein = lintoulaw_framein,
|
||||||
|
.sample = slin8_sample,
|
||||||
|
.buf_size = BUFFER_SAMPLES,
|
||||||
|
.buffer_samples = BUFFER_SAMPLES,
|
||||||
|
};
|
||||||
|
|
||||||
static int parse_config(int reload)
|
static int parse_config(int reload)
|
||||||
{
|
{
|
||||||
struct ast_variable *var;
|
struct ast_variable *var;
|
||||||
|
@ -131,6 +152,8 @@ static int unload_module(void)
|
||||||
|
|
||||||
res = ast_unregister_translator(&lintoulaw);
|
res = ast_unregister_translator(&lintoulaw);
|
||||||
res |= ast_unregister_translator(&ulawtolin);
|
res |= ast_unregister_translator(&ulawtolin);
|
||||||
|
res |= ast_unregister_translator(&testlawtolin);
|
||||||
|
res |= ast_unregister_translator(&lintotestlaw);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +165,11 @@ static int load_module(void)
|
||||||
if (parse_config(0))
|
if (parse_config(0))
|
||||||
return AST_MODULE_LOAD_DECLINE;
|
return AST_MODULE_LOAD_DECLINE;
|
||||||
res = ast_register_translator(&ulawtolin);
|
res = ast_register_translator(&ulawtolin);
|
||||||
if (!res)
|
if (!res) {
|
||||||
res = ast_register_translator(&lintoulaw);
|
res = ast_register_translator(&lintoulaw);
|
||||||
else
|
res |= ast_register_translator(&lintotestlaw);
|
||||||
|
res |= ast_register_translator(&testlawtolin);
|
||||||
|
} else
|
||||||
ast_unregister_translator(&ulawtolin);
|
ast_unregister_translator(&ulawtolin);
|
||||||
if (res)
|
if (res)
|
||||||
return AST_MODULE_LOAD_FAILURE;
|
return AST_MODULE_LOAD_FAILURE;
|
||||||
|
|
|
@ -19,7 +19,7 @@ static struct ast_frame *adpcm_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_ADPCM,
|
.subclass.codec = AST_FORMAT_ADPCM,
|
||||||
.datalen = sizeof(ex_adpcm),
|
.datalen = sizeof(ex_adpcm),
|
||||||
.samples = ARRAY_LEN(ex_adpcm) * 2,
|
.samples = ARRAY_LEN(ex_adpcm) * 2,
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -24,7 +24,7 @@ static struct ast_frame *alaw_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_ALAW,
|
.subclass.codec = AST_FORMAT_ALAW,
|
||||||
.datalen = sizeof(ex_alaw),
|
.datalen = sizeof(ex_alaw),
|
||||||
.samples = ARRAY_LEN(ex_alaw),
|
.samples = ARRAY_LEN(ex_alaw),
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -34,7 +34,7 @@ static struct ast_frame *g722_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_G722,
|
.subclass.codec = AST_FORMAT_G722,
|
||||||
.datalen = sizeof(ex_g722),
|
.datalen = sizeof(ex_g722),
|
||||||
.samples = ARRAY_LEN(ex_g722),
|
.samples = ARRAY_LEN(ex_g722),
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -19,7 +19,7 @@ static struct ast_frame *g726_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_G726,
|
.subclass.codec = AST_FORMAT_G726,
|
||||||
.datalen = sizeof(ex_g726),
|
.datalen = sizeof(ex_g726),
|
||||||
.samples = ARRAY_LEN(ex_g726) * 2, /* 2 samples per byte */
|
.samples = ARRAY_LEN(ex_g726) * 2, /* 2 samples per byte */
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -18,7 +18,7 @@ static struct ast_frame *gsm_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_GSM,
|
.subclass.codec = AST_FORMAT_GSM,
|
||||||
.datalen = sizeof(ex_gsm),
|
.datalen = sizeof(ex_gsm),
|
||||||
/* All frames are 20 ms long */
|
/* All frames are 20 ms long */
|
||||||
.samples = GSM_SAMPLES,
|
.samples = GSM_SAMPLES,
|
||||||
|
|
|
@ -19,7 +19,7 @@ static struct ast_frame *ilbc_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_ILBC,
|
.subclass.codec = AST_FORMAT_ILBC,
|
||||||
.datalen = sizeof(ex_ilbc),
|
.datalen = sizeof(ex_ilbc),
|
||||||
/* All frames are 30 ms long */
|
/* All frames are 30 ms long */
|
||||||
.samples = ILBC_SAMPLES,
|
.samples = ILBC_SAMPLES,
|
||||||
|
|
|
@ -15,7 +15,7 @@ static struct ast_frame *lpc10_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_LPC10,
|
.subclass.codec = AST_FORMAT_LPC10,
|
||||||
.datalen = sizeof(ex_lpc10),
|
.datalen = sizeof(ex_lpc10),
|
||||||
/* All frames are 22 ms long (maybe a little more -- why did he choose
|
/* All frames are 22 ms long (maybe a little more -- why did he choose
|
||||||
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
|
LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
|
||||||
|
|
|
@ -18,7 +18,7 @@ static struct ast_frame *speex_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SPEEX,
|
.subclass.codec = AST_FORMAT_SPEEX,
|
||||||
.datalen = sizeof(ex_speex),
|
.datalen = sizeof(ex_speex),
|
||||||
/* All frames are 20 ms long */
|
/* All frames are 20 ms long */
|
||||||
.samples = SPEEX_SAMPLES,
|
.samples = SPEEX_SAMPLES,
|
||||||
|
|
|
@ -24,7 +24,7 @@ static struct ast_frame *ulaw_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_ULAW,
|
.subclass.codec = AST_FORMAT_ULAW,
|
||||||
.datalen = sizeof(ex_ulaw),
|
.datalen = sizeof(ex_ulaw),
|
||||||
.samples = ARRAY_LEN(ex_ulaw),
|
.samples = ARRAY_LEN(ex_ulaw),
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.ac Revision: 226018 .
|
# From configure.ac Revision: 227579 .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
|
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
|
||||||
#
|
#
|
||||||
|
@ -16713,7 +16713,9 @@ done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
|
|
||||||
|
|
||||||
|
for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
|
|
@ -390,7 +390,7 @@ AC_FUNC_STRNLEN
|
||||||
AC_FUNC_STRTOD
|
AC_FUNC_STRTOD
|
||||||
AC_FUNC_UTIME_NULL
|
AC_FUNC_UTIME_NULL
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
|
AC_CHECK_FUNCS([asprintf atexit closefrom dup2 eaccess endpwent euidaccess ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap ntohll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
|
||||||
|
|
||||||
# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
|
# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
|
||||||
# so that AC_CHECK_FUNCS can detect functions in that library.
|
# so that AC_CHECK_FUNCS can detect functions in that library.
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
CODEC BIT EXPANSION
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The code base up to and including Asterisk 1.6.2 has a basic limit of 32 codecs
|
||||||
|
recognizable, due to the use of a 32-bit integer for the codec bitmask. We
|
||||||
|
have expanded the number of available codecs from 32 to 64, through the use of
|
||||||
|
an immutable type, called format_t. This should make future expansion to even
|
||||||
|
more bits more easily done.
|
||||||
|
|
||||||
|
The design of this expansion has made some changes to the architecture of codecs
|
||||||
|
in order to accomplish this task. I will attempt to enumerate them here.
|
||||||
|
|
||||||
|
The initial set of 32-bits were allocated as the first 16 to audio codecs, the
|
||||||
|
next 8 to video codecs, and the remaining to text codecs (which are used for
|
||||||
|
fax capabilities). Initially, there is an assumption in the code that all
|
||||||
|
audio codecs are contiguous, followed by a contiguous set of video codecs.
|
||||||
|
After the conversion, this assumption will no longer be true. The codec bits
|
||||||
|
for the existing codecs will continue to be allocated as-is, and the additional
|
||||||
|
codec bits should be allocated on an as-needed basis, with audio codecs
|
||||||
|
occupying slots 32-47 and video codecs occupying slots 48-62 (with a 0-based
|
||||||
|
offset). Slot 63 is reserved and should not be allocated; it is used in code
|
||||||
|
as an end condition for iterating through the entire set of codecs.
|
||||||
|
|
||||||
|
The frame structure has been altered. Initially, the subclass held an integer
|
||||||
|
whose meaning was specified by the frametype. If the frametype was
|
||||||
|
AST_FRAME_VOICE, the subclass specified the audio codec. If the frametype was
|
||||||
|
AST_FRAME_VIDEO, the subclass specified the video codec, with the 0-bit set to
|
||||||
|
specify a key frame. This was done with a union on the subclass, where the
|
||||||
|
"integer" union member specifies the traditional 32-bit subclass and the "codec"
|
||||||
|
union member specifies the new 64-bit codec bitmask. This additionally
|
||||||
|
guarantees that code compiled under the old scheme will need to be altered to
|
||||||
|
compile under the new scheme, which helps avoid incorrect assumptions about the
|
||||||
|
state of code which might otherwise compile without errors.
|
||||||
|
|
||||||
|
The IAX2 code initially used a 32-bit integer IE to specify both the codec as
|
||||||
|
well as the preferred format. An additional IE has been added, which specifies
|
||||||
|
a single byte version number as the initial part of the data. This version
|
||||||
|
number is initially specified as 00 and requires 8 bytes to follow, specifying
|
||||||
|
the 64-bit codec bitmask, in network-byte order. This schema should allow
|
||||||
|
further codec expansion in the future without allocation of any additional IEs.
|
||||||
|
|
||||||
|
Little changes are required to support further codec expansion in the future,
|
||||||
|
though the majority of the work has already been accomplished. Specifically,
|
||||||
|
the bitwise operations that are immutable operations in the gcc compiler will
|
||||||
|
need to be altered to handle larger bitmasks. Additionally, the constants that
|
||||||
|
define specific codecs will need to be changed from integers to structures.
|
||||||
|
|
|
@ -61,7 +61,7 @@ static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext)
|
||||||
}
|
}
|
||||||
/* Read the data into the buffer */
|
/* Read the data into the buffer */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_G723_1;
|
s->fr.subclass.codec = AST_FORMAT_G723_1;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != size) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != size) {
|
||||||
|
@ -82,7 +82,7 @@ static int g723_write(struct ast_filestream *s, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_G723_1) {
|
if (f->subclass.codec != AST_FORMAT_G723_1) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ static struct ast_frame *g726_read(struct ast_filestream *s, int *whennext)
|
||||||
|
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_G726;
|
s->fr.subclass.codec = AST_FORMAT_G726;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
|
||||||
s->fr.samples = 8 * FRAME_TIME;
|
s->fr.samples = 8 * FRAME_TIME;
|
||||||
|
@ -141,9 +141,9 @@ static int g726_write(struct ast_filestream *s, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_G726) {
|
if (f->subclass.codec != AST_FORMAT_G726) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-G726 frame (%d)!\n",
|
ast_log(LOG_WARNING, "Asked to write non-G726 frame (%s)!\n",
|
||||||
f->subclass);
|
ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->datalen % frame_size[fs->rate]) {
|
if (f->datalen % frame_size[fs->rate]) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext)
|
||||||
int res;
|
int res;
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_G729A;
|
s->fr.subclass.codec = AST_FORMAT_G729A;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
s->fr.samples = G729A_SAMPLES;
|
s->fr.samples = G729A_SAMPLES;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
|
@ -66,8 +66,8 @@ static int g729_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_G729A) {
|
if (f->subclass.codec != AST_FORMAT_G729A) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-G729 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-G729 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->datalen % 10) {
|
if (f->datalen % 10) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ static struct ast_frame *gsm_read(struct ast_filestream *s, int *whennext)
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_GSM;
|
s->fr.subclass.codec = AST_FORMAT_GSM;
|
||||||
AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
|
AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
|
if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
|
||||||
|
@ -74,8 +74,8 @@ static int gsm_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_GSM) {
|
if (f->subclass.codec != AST_FORMAT_GSM) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(f->datalen % 65)) {
|
if (!(f->datalen % 65)) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ static int h263_open(struct ast_filestream *s)
|
||||||
static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
|
static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
int mark;
|
format_t mark;
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
unsigned int ts;
|
unsigned int ts;
|
||||||
struct h263_desc *fs = (struct h263_desc *)s->_private;
|
struct h263_desc *fs = (struct h263_desc *)s->_private;
|
||||||
|
@ -80,7 +80,7 @@ static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
s->fr.frametype = AST_FRAME_VIDEO;
|
s->fr.frametype = AST_FRAME_VIDEO;
|
||||||
s->fr.subclass = AST_FORMAT_H263;
|
s->fr.subclass.codec = AST_FORMAT_H263;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
||||||
|
@ -90,7 +90,7 @@ static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
|
||||||
}
|
}
|
||||||
s->fr.samples = fs->lastts; /* XXX what ? */
|
s->fr.samples = fs->lastts; /* XXX what ? */
|
||||||
s->fr.datalen = len;
|
s->fr.datalen = len;
|
||||||
s->fr.subclass |= mark;
|
s->fr.subclass.codec |= mark;
|
||||||
s->fr.delivery.tv_sec = 0;
|
s->fr.delivery.tv_sec = 0;
|
||||||
s->fr.delivery.tv_usec = 0;
|
s->fr.delivery.tv_usec = 0;
|
||||||
if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
|
if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
|
||||||
|
@ -106,18 +106,18 @@ static int h263_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
int res;
|
int res;
|
||||||
unsigned int ts;
|
unsigned int ts;
|
||||||
unsigned short len;
|
unsigned short len;
|
||||||
int subclass;
|
format_t subclass;
|
||||||
int mark=0;
|
format_t mark=0;
|
||||||
if (f->frametype != AST_FRAME_VIDEO) {
|
if (f->frametype != AST_FRAME_VIDEO) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
subclass = f->subclass;
|
subclass = f->subclass.codec;
|
||||||
if (subclass & 0x1)
|
if (subclass & 0x1)
|
||||||
mark=0x8000;
|
mark=0x8000;
|
||||||
subclass &= ~0x1;
|
subclass &= ~0x1;
|
||||||
if (subclass != AST_FORMAT_H263) {
|
if (subclass != AST_FORMAT_H263) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-h263 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-h263 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts = htonl(f->samples);
|
ts = htonl(f->samples);
|
||||||
|
|
|
@ -72,7 +72,7 @@ static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)
|
||||||
len = BUF_SIZE; /* XXX truncate */
|
len = BUF_SIZE; /* XXX truncate */
|
||||||
}
|
}
|
||||||
s->fr.frametype = AST_FRAME_VIDEO;
|
s->fr.frametype = AST_FRAME_VIDEO;
|
||||||
s->fr.subclass = AST_FORMAT_H264;
|
s->fr.subclass.codec = AST_FORMAT_H264;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
||||||
|
@ -82,7 +82,7 @@ static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)
|
||||||
}
|
}
|
||||||
s->fr.samples = fs->lastts;
|
s->fr.samples = fs->lastts;
|
||||||
s->fr.datalen = len;
|
s->fr.datalen = len;
|
||||||
s->fr.subclass |= mark;
|
s->fr.subclass.codec |= mark;
|
||||||
s->fr.delivery.tv_sec = 0;
|
s->fr.delivery.tv_sec = 0;
|
||||||
s->fr.delivery.tv_usec = 0;
|
s->fr.delivery.tv_usec = 0;
|
||||||
if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
|
if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
|
||||||
|
@ -104,9 +104,9 @@ static int h264_write(struct ast_filestream *s, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
mark = (f->subclass & 0x1) ? 0x8000 : 0;
|
mark = (f->subclass.codec & 0x1) ? 0x8000 : 0;
|
||||||
if ((f->subclass & ~0x1) != AST_FORMAT_H264) {
|
if ((f->subclass.codec & ~0x1) != AST_FORMAT_H264) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-h264 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-h264 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ts = htonl(f->samples);
|
ts = htonl(f->samples);
|
||||||
|
|
|
@ -45,7 +45,7 @@ static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)
|
||||||
int res;
|
int res;
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_ILBC;
|
s->fr.subclass.codec = AST_FORMAT_ILBC;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
||||||
|
@ -64,8 +64,8 @@ static int ilbc_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_ILBC) {
|
if (f->subclass.codec != AST_FORMAT_ILBC) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->datalen % 50) {
|
if (f->datalen % 50) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ static struct ast_frame *jpeg_read_image(int fd, int len)
|
||||||
}
|
}
|
||||||
memset(&fr, 0, sizeof(fr));
|
memset(&fr, 0, sizeof(fr));
|
||||||
fr.frametype = AST_FRAME_IMAGE;
|
fr.frametype = AST_FRAME_IMAGE;
|
||||||
fr.subclass = AST_FORMAT_JPEG;
|
fr.subclass.codec = AST_FORMAT_JPEG;
|
||||||
fr.data.ptr = buf;
|
fr.data.ptr = buf;
|
||||||
fr.src = "JPEG Read";
|
fr.src = "JPEG Read";
|
||||||
fr.datalen = len;
|
fr.datalen = len;
|
||||||
|
@ -74,7 +74,7 @@ static int jpeg_write_image(int fd, struct ast_frame *fr)
|
||||||
ast_log(LOG_WARNING, "Not an image\n");
|
ast_log(LOG_WARNING, "Not an image\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (fr->subclass != AST_FORMAT_JPEG) {
|
if (fr->subclass.codec != AST_FORMAT_JPEG) {
|
||||||
ast_log(LOG_WARNING, "Not a jpeg image\n");
|
ast_log(LOG_WARNING, "Not a jpeg image\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,9 +291,9 @@ static int ogg_vorbis_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SLINEAR) {
|
if (f->subclass.codec != AST_FORMAT_SLINEAR) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n",
|
ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n",
|
||||||
f->subclass);
|
ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!f->datalen)
|
if (!f->datalen)
|
||||||
|
@ -438,7 +438,7 @@ static struct ast_frame *ogg_vorbis_read(struct ast_filestream *fs,
|
||||||
short *buf; /* SLIN data buffer */
|
short *buf; /* SLIN data buffer */
|
||||||
|
|
||||||
fs->fr.frametype = AST_FRAME_VOICE;
|
fs->fr.frametype = AST_FRAME_VOICE;
|
||||||
fs->fr.subclass = AST_FORMAT_SLINEAR;
|
fs->fr.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
fs->fr.mallocd = 0;
|
fs->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
buf = (short *)(fs->fr.data.ptr); /* SLIN data buffer */
|
buf = (short *)(fs->fr.data.ptr); /* SLIN data buffer */
|
||||||
|
|
|
@ -80,7 +80,7 @@ static struct ast_frame *pcm_read(struct ast_filestream *s, int *whennext)
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = s->fmt->format;
|
s->fr.subclass.codec = s->fmt->format;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
||||||
|
@ -163,8 +163,8 @@ static int pcm_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != fs->fmt->format) {
|
if (f->subclass.codec != fs->fmt->format) {
|
||||||
ast_log(LOG_WARNING, "Asked to write incompatible format frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write incompatible format frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static struct ast_frame *siren14read(struct ast_filestream *s, int *whennext)
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_SIREN14;
|
s->fr.subclass.codec = AST_FORMAT_SIREN14;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
||||||
|
@ -61,8 +61,8 @@ static int siren14write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SIREN14) {
|
if (f->subclass.codec != AST_FORMAT_SIREN14) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-Siren14 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-Siren14 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ static struct ast_frame *siren7read(struct ast_filestream *s, int *whennext)
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_SIREN7;
|
s->fr.subclass.codec = AST_FORMAT_SIREN7;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
|
||||||
|
@ -61,8 +61,8 @@ static int siren7write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SIREN7) {
|
if (f->subclass.codec != AST_FORMAT_SIREN7) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-Siren7 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-Siren7 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ static struct ast_frame *slinear_read(struct ast_filestream *s, int *whennext)
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_SLINEAR;
|
s->fr.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
||||||
|
@ -59,8 +59,8 @@ static int slinear_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SLINEAR) {
|
if (f->subclass.codec != AST_FORMAT_SLINEAR) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-slinear frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-slinear frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ static struct ast_frame *slinear_read(struct ast_filestream *s, int *whennext)
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_SLINEAR16;
|
s->fr.subclass.codec = AST_FORMAT_SLINEAR16;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
||||||
|
@ -61,8 +61,8 @@ static int slinear_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SLINEAR16) {
|
if (f->subclass.codec != AST_FORMAT_SLINEAR16) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-slinear16 frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-slinear16 frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ static struct ast_frame *vox_read(struct ast_filestream *s, int *whennext)
|
||||||
|
|
||||||
/* Send a frame from the file to the appropriate channel */
|
/* Send a frame from the file to the appropriate channel */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_ADPCM;
|
s->fr.subclass.codec = AST_FORMAT_ADPCM;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
|
||||||
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
|
||||||
|
@ -61,8 +61,8 @@ static int vox_write(struct ast_filestream *s, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_ADPCM) {
|
if (f->subclass.codec != AST_FORMAT_ADPCM) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-ADPCM frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-ADPCM frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((res = fwrite(f->data.ptr, 1, f->datalen, s->f)) != f->datalen) {
|
if ((res = fwrite(f->data.ptr, 1, f->datalen, s->f)) != f->datalen) {
|
||||||
|
|
|
@ -361,7 +361,7 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
/* ast_debug(1, "here: %d, maxlen: %d, bytes: %d\n", here, s->maxlen, bytes); */
|
/* ast_debug(1, "here: %d, maxlen: %d, bytes: %d\n", here, s->maxlen, bytes); */
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_SLINEAR;
|
s->fr.subclass.codec = AST_FORMAT_SLINEAR;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes);
|
AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes);
|
||||||
|
|
||||||
|
@ -397,8 +397,8 @@ static int wav_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_SLINEAR) {
|
if (f->subclass.codec != AST_FORMAT_SLINEAR) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!f->datalen)
|
if (!f->datalen)
|
||||||
|
|
|
@ -395,7 +395,7 @@ static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)
|
||||||
struct wavg_desc *fs = (struct wavg_desc *)s->_private;
|
struct wavg_desc *fs = (struct wavg_desc *)s->_private;
|
||||||
|
|
||||||
s->fr.frametype = AST_FRAME_VOICE;
|
s->fr.frametype = AST_FRAME_VOICE;
|
||||||
s->fr.subclass = AST_FORMAT_GSM;
|
s->fr.subclass.codec = AST_FORMAT_GSM;
|
||||||
s->fr.offset = AST_FRIENDLY_OFFSET;
|
s->fr.offset = AST_FRIENDLY_OFFSET;
|
||||||
s->fr.samples = GSM_SAMPLES;
|
s->fr.samples = GSM_SAMPLES;
|
||||||
s->fr.mallocd = 0;
|
s->fr.mallocd = 0;
|
||||||
|
@ -432,8 +432,8 @@ static int wav_write(struct ast_filestream *s, struct ast_frame *f)
|
||||||
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (f->subclass != AST_FORMAT_GSM) {
|
if (f->subclass.codec != AST_FORMAT_GSM) {
|
||||||
ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass);
|
ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* XXX this might fail... if the input is a multiple of MSGSM_FRAME_SIZE
|
/* XXX this might fail... if the input is a multiple of MSGSM_FRAME_SIZE
|
||||||
|
|
|
@ -100,10 +100,10 @@ static int volume_callback(struct ast_audiohook *audiohook, struct ast_channel *
|
||||||
/* Only use DTMF coming from the source... not going to it */
|
/* Only use DTMF coming from the source... not going to it */
|
||||||
if (direction != AST_AUDIOHOOK_DIRECTION_READ)
|
if (direction != AST_AUDIOHOOK_DIRECTION_READ)
|
||||||
return 0;
|
return 0;
|
||||||
if (frame->subclass == '*') {
|
if (frame->subclass.integer == '*') {
|
||||||
vi->tx_gain += 1;
|
vi->tx_gain += 1;
|
||||||
vi->rx_gain += 1;
|
vi->rx_gain += 1;
|
||||||
} else if (frame->subclass == '#') {
|
} else if (frame->subclass.integer == '#') {
|
||||||
vi->tx_gain -= 1;
|
vi->tx_gain -= 1;
|
||||||
vi->rx_gain -= 1;
|
vi->rx_gain -= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "asterisk/frame_defs.h"
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,7 +94,7 @@ struct ast_jb
|
||||||
/*! \brief The time the next frame should be played. */
|
/*! \brief The time the next frame should be played. */
|
||||||
long next;
|
long next;
|
||||||
/*! \brief Voice format of the last frame in. */
|
/*! \brief Voice format of the last frame in. */
|
||||||
int last_format;
|
format_t last_format;
|
||||||
/*! \brief File for frame timestamp tracing. */
|
/*! \brief File for frame timestamp tracing. */
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
/*! \brief Jitterbuffer internal state flags. */
|
/*! \brief Jitterbuffer internal state flags. */
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern "C" {
|
||||||
/* these two are used in struct ast_audiohook */
|
/* these two are used in struct ast_audiohook */
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
|
#include "asterisk/frame_defs.h"
|
||||||
#include "asterisk/slinfactory.h"
|
#include "asterisk/slinfactory.h"
|
||||||
|
|
||||||
enum ast_audiohook_type {
|
enum ast_audiohook_type {
|
||||||
|
@ -133,7 +133,7 @@ int ast_audiohook_write_frame(struct ast_audiohook *audiohook, enum ast_audiohoo
|
||||||
* \param format Format of frame remote side wants back
|
* \param format Format of frame remote side wants back
|
||||||
* \return Returns frame on success, NULL on failure
|
* \return Returns frame on success, NULL on failure
|
||||||
*/
|
*/
|
||||||
struct ast_frame *ast_audiohook_read_frame(struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, int format);
|
struct ast_frame *ast_audiohook_read_frame(struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, format_t format);
|
||||||
|
|
||||||
/*! \brief Attach audiohook to channel
|
/*! \brief Attach audiohook to channel
|
||||||
* \param chan Channel
|
* \param chan Channel
|
||||||
|
|
|
@ -352,6 +352,9 @@
|
||||||
/* Define to the version of the Hoard Memory Allocator library. */
|
/* Define to the version of the Hoard Memory Allocator library. */
|
||||||
#undef HAVE_HOARD_VERSION
|
#undef HAVE_HOARD_VERSION
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `htonll' function. */
|
||||||
|
#undef HAVE_HTONLL
|
||||||
|
|
||||||
/* Define to 1 if you have the ical libraries library. */
|
/* Define to 1 if you have the ical libraries library. */
|
||||||
#undef HAVE_ICAL
|
#undef HAVE_ICAL
|
||||||
|
|
||||||
|
@ -576,6 +579,9 @@
|
||||||
/* Define to the version of the newt library. */
|
/* Define to the version of the newt library. */
|
||||||
#undef HAVE_NEWT_VERSION
|
#undef HAVE_NEWT_VERSION
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ntohll' function. */
|
||||||
|
#undef HAVE_NTOHLL
|
||||||
|
|
||||||
/* Define to 1 if your ODBC library has wide (Unicode) types. */
|
/* Define to 1 if your ODBC library has wide (Unicode) types. */
|
||||||
#undef HAVE_ODBC_WCHAR
|
#undef HAVE_ODBC_WCHAR
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ struct ast_bridge {
|
||||||
* This creates a simple two party bridge that will be destroyed once one of
|
* This creates a simple two party bridge that will be destroyed once one of
|
||||||
* the channels hangs up.
|
* the channels hangs up.
|
||||||
*/
|
*/
|
||||||
struct ast_bridge *ast_bridge_new(int capabilities, int flags);
|
struct ast_bridge *ast_bridge_new(format_t capabilities, int flags);
|
||||||
|
|
||||||
/*! \brief See if it is possible to create a bridge
|
/*! \brief See if it is possible to create a bridge
|
||||||
*
|
*
|
||||||
|
@ -211,7 +211,7 @@ struct ast_bridge *ast_bridge_new(int capabilities, int flags);
|
||||||
* This sees if it is possible to create a bridge capable of bridging two channels
|
* This sees if it is possible to create a bridge capable of bridging two channels
|
||||||
* together.
|
* together.
|
||||||
*/
|
*/
|
||||||
int ast_bridge_check(int capabilities);
|
int ast_bridge_check(format_t capabilities);
|
||||||
|
|
||||||
/*! \brief Destroy a bridge
|
/*! \brief Destroy a bridge
|
||||||
*
|
*
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct ast_bridge_technology {
|
||||||
/*! Unique name to this bridge technology */
|
/*! Unique name to this bridge technology */
|
||||||
const char *name;
|
const char *name;
|
||||||
/*! The capabilities that this bridge technology is capable of */
|
/*! The capabilities that this bridge technology is capable of */
|
||||||
int capabilities;
|
format_t capabilities;
|
||||||
/*! Preference level that should be used when determining whether to use this bridge technology or not */
|
/*! Preference level that should be used when determining whether to use this bridge technology or not */
|
||||||
enum ast_bridge_preference preference;
|
enum ast_bridge_preference preference;
|
||||||
/*! Callback for when a bridge is being created */
|
/*! Callback for when a bridge is being created */
|
||||||
|
@ -71,7 +71,7 @@ struct ast_bridge_technology {
|
||||||
/*! Callback for poking a bridge thread */
|
/*! Callback for poking a bridge thread */
|
||||||
int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
|
int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
|
||||||
/*! Formats that the bridge technology supports */
|
/*! Formats that the bridge technology supports */
|
||||||
int formats;
|
format_t formats;
|
||||||
/*! Bit to indicate whether the bridge technology is currently suspended or not */
|
/*! Bit to indicate whether the bridge technology is currently suspended or not */
|
||||||
unsigned int suspended:1;
|
unsigned int suspended:1;
|
||||||
/*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
|
/*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
|
||||||
|
|
|
@ -417,12 +417,12 @@ struct ast_channel_tech {
|
||||||
const char * const type;
|
const char * const type;
|
||||||
const char * const description;
|
const char * const description;
|
||||||
|
|
||||||
int capabilities; /*!< Bitmap of formats this channel can handle */
|
format_t capabilities; /*!< Bitmap of formats this channel can handle */
|
||||||
|
|
||||||
int properties; /*!< Technology Properties */
|
int properties; /*!< Technology Properties */
|
||||||
|
|
||||||
/*! \brief Requester - to set up call data structures (pvt's) */
|
/*! \brief Requester - to set up call data structures (pvt's) */
|
||||||
struct ast_channel *(* const requester)(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
struct ast_channel *(* const requester)(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||||
|
|
||||||
int (* const devicestate)(void *data); /*!< Devicestate call back */
|
int (* const devicestate)(void *data); /*!< Devicestate call back */
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ struct ast_channel {
|
||||||
int fdno; /*!< Which fd had an event detected on */
|
int fdno; /*!< Which fd had an event detected on */
|
||||||
int streamid; /*!< For streaming playback, the schedule ID */
|
int streamid; /*!< For streaming playback, the schedule ID */
|
||||||
int vstreamid; /*!< For streaming video playback, the schedule ID */
|
int vstreamid; /*!< For streaming video playback, the schedule ID */
|
||||||
int oldwriteformat; /*!< Original writer format */
|
format_t oldwriteformat; /*!< Original writer format */
|
||||||
int timingfd; /*!< Timing fd */
|
int timingfd; /*!< Timing fd */
|
||||||
enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */
|
enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */
|
||||||
int rings; /*!< Number of rings so far */
|
int rings; /*!< Number of rings so far */
|
||||||
|
@ -746,11 +746,11 @@ struct ast_channel {
|
||||||
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
|
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
|
||||||
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
|
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
|
||||||
int alertpipe[2];
|
int alertpipe[2];
|
||||||
int nativeformats; /*!< Kinds of data this channel can natively handle */
|
format_t nativeformats; /*!< Kinds of data this channel can natively handle */
|
||||||
int readformat; /*!< Requested read format */
|
format_t readformat; /*!< Requested read format */
|
||||||
int writeformat; /*!< Requested write format */
|
format_t writeformat; /*!< Requested write format */
|
||||||
int rawreadformat; /*!< Raw read format */
|
format_t rawreadformat; /*!< Raw read format */
|
||||||
int rawwriteformat; /*!< Raw write format */
|
format_t rawwriteformat; /*!< Raw write format */
|
||||||
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
|
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
|
||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
int epfd;
|
int epfd;
|
||||||
|
@ -1139,7 +1139,7 @@ struct ast_channel *ast_channel_release(struct ast_channel *chan);
|
||||||
* \retval NULL failure
|
* \retval NULL failure
|
||||||
* \retval non-NULL channel on success
|
* \retval non-NULL channel on success
|
||||||
*/
|
*/
|
||||||
struct ast_channel *ast_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *status);
|
struct ast_channel *ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *status);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Request a channel of a given type, with data as optional information used
|
* \brief Request a channel of a given type, with data as optional information used
|
||||||
|
@ -1156,7 +1156,7 @@ struct ast_channel *ast_request(const char *type, int format, const struct ast_c
|
||||||
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
||||||
* to know if the call was answered or not.
|
* to know if the call was answered or not.
|
||||||
*/
|
*/
|
||||||
struct ast_channel *ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
|
struct ast_channel *ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
|
||||||
int timeout, int *reason, const char *cid_num, const char *cid_name);
|
int timeout, int *reason, const char *cid_num, const char *cid_name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1173,7 +1173,7 @@ struct ast_channel *ast_request_and_dial(const char *type, int format, const str
|
||||||
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
||||||
* to know if the call was answered or not.
|
* to know if the call was answered or not.
|
||||||
*/
|
*/
|
||||||
struct ast_channel *__ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
|
struct ast_channel *__ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
|
||||||
int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
|
int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -1186,7 +1186,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, const s
|
||||||
* \param outstate reason why unsuccessful (if uncuccessful)
|
* \param outstate reason why unsuccessful (if uncuccessful)
|
||||||
* \return Returns the forwarded call's ast_channel on success or NULL on failure
|
* \return Returns the forwarded call's ast_channel on success or NULL on failure
|
||||||
*/
|
*/
|
||||||
struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate);
|
struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, format_t format, struct outgoing_helper *oh, int *outstate);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register a channel technology (a new channel driver)
|
* \brief Register a channel technology (a new channel driver)
|
||||||
|
@ -1591,7 +1591,7 @@ int ast_prod(struct ast_channel *chan);
|
||||||
* \param format format to change to
|
* \param format format to change to
|
||||||
* \return Returns 0 on success, -1 on failure
|
* \return Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int ast_set_read_format(struct ast_channel *chan, int format);
|
int ast_set_read_format(struct ast_channel *chan, format_t format);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets write format on channel chan
|
* \brief Sets write format on channel chan
|
||||||
|
@ -1600,7 +1600,7 @@ int ast_set_read_format(struct ast_channel *chan, int format);
|
||||||
* \param format new format for writing
|
* \param format new format for writing
|
||||||
* \return Returns 0 on success, -1 on failure
|
* \return Returns 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int ast_set_write_format(struct ast_channel *chan, int format);
|
int ast_set_write_format(struct ast_channel *chan, format_t format);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sends text to a channel
|
* \brief Sends text to a channel
|
||||||
|
@ -1821,7 +1821,7 @@ int ast_channel_setoption(struct ast_channel *channel, int option, void *data, i
|
||||||
|
|
||||||
/*! Pick the best codec
|
/*! Pick the best codec
|
||||||
* Choose the best codec... Uhhh... Yah. */
|
* Choose the best codec... Uhhh... Yah. */
|
||||||
int ast_best_codec(int fmts);
|
format_t ast_best_codec(format_t fmts);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -81,6 +81,14 @@ int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt,
|
||||||
int getloadavg(double *list, int nelem);
|
int getloadavg(double *list, int nelem);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_HTONLL
|
||||||
|
uint64_t htonll(uint64_t host64);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_NTOHLL
|
||||||
|
uint64_t ntohll(uint64_t net64);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_SETENV
|
#ifndef HAVE_SETENV
|
||||||
int setenv(const char *name, const char *value, int overwrite);
|
int setenv(const char *name, const char *value, int overwrite);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,12 +31,13 @@ extern "C" {
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include "asterisk/frame_defs.h"
|
||||||
#include "asterisk/endian.h"
|
#include "asterisk/endian.h"
|
||||||
#include "asterisk/linkedlists.h"
|
#include "asterisk/linkedlists.h"
|
||||||
|
|
||||||
struct ast_codec_pref {
|
struct ast_codec_pref {
|
||||||
char order[32];
|
char order[sizeof(format_t) * 8];
|
||||||
char framing[32];
|
char framing[sizeof(format_t) * 8];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -136,7 +137,10 @@ struct ast_frame {
|
||||||
/*! Kind of frame */
|
/*! Kind of frame */
|
||||||
enum ast_frame_type frametype;
|
enum ast_frame_type frametype;
|
||||||
/*! Subclass, frame dependent */
|
/*! Subclass, frame dependent */
|
||||||
int subclass;
|
union {
|
||||||
|
int integer;
|
||||||
|
format_t codec;
|
||||||
|
} subclass;
|
||||||
/*! Length of data */
|
/*! Length of data */
|
||||||
int datalen;
|
int datalen;
|
||||||
/*! Number of samples in this frame */
|
/*! Number of samples in this frame */
|
||||||
|
@ -232,61 +236,65 @@ extern struct ast_frame ast_null_frame;
|
||||||
|
|
||||||
/* Data formats for capabilities and frames alike */
|
/* Data formats for capabilities and frames alike */
|
||||||
/*! G.723.1 compression */
|
/*! G.723.1 compression */
|
||||||
#define AST_FORMAT_G723_1 (1 << 0)
|
#define AST_FORMAT_G723_1 (1ULL << 0)
|
||||||
/*! GSM compression */
|
/*! GSM compression */
|
||||||
#define AST_FORMAT_GSM (1 << 1)
|
#define AST_FORMAT_GSM (1ULL << 1)
|
||||||
/*! Raw mu-law data (G.711) */
|
/*! Raw mu-law data (G.711) */
|
||||||
#define AST_FORMAT_ULAW (1 << 2)
|
#define AST_FORMAT_ULAW (1ULL << 2)
|
||||||
/*! Raw A-law data (G.711) */
|
/*! Raw A-law data (G.711) */
|
||||||
#define AST_FORMAT_ALAW (1 << 3)
|
#define AST_FORMAT_ALAW (1ULL << 3)
|
||||||
/*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
|
/*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
|
||||||
#define AST_FORMAT_G726_AAL2 (1 << 4)
|
#define AST_FORMAT_G726_AAL2 (1ULL << 4)
|
||||||
/*! ADPCM (IMA) */
|
/*! ADPCM (IMA) */
|
||||||
#define AST_FORMAT_ADPCM (1 << 5)
|
#define AST_FORMAT_ADPCM (1ULL << 5)
|
||||||
/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
|
/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
|
||||||
#define AST_FORMAT_SLINEAR (1 << 6)
|
#define AST_FORMAT_SLINEAR (1ULL << 6)
|
||||||
/*! LPC10, 180 samples/frame */
|
/*! LPC10, 180 samples/frame */
|
||||||
#define AST_FORMAT_LPC10 (1 << 7)
|
#define AST_FORMAT_LPC10 (1ULL << 7)
|
||||||
/*! G.729A audio */
|
/*! G.729A audio */
|
||||||
#define AST_FORMAT_G729A (1 << 8)
|
#define AST_FORMAT_G729A (1ULL << 8)
|
||||||
/*! SpeeX Free Compression */
|
/*! SpeeX Free Compression */
|
||||||
#define AST_FORMAT_SPEEX (1 << 9)
|
#define AST_FORMAT_SPEEX (1ULL << 9)
|
||||||
/*! iLBC Free Compression */
|
/*! iLBC Free Compression */
|
||||||
#define AST_FORMAT_ILBC (1 << 10)
|
#define AST_FORMAT_ILBC (1ULL << 10)
|
||||||
/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
|
/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
|
||||||
#define AST_FORMAT_G726 (1 << 11)
|
#define AST_FORMAT_G726 (1ULL << 11)
|
||||||
/*! G.722 */
|
/*! G.722 */
|
||||||
#define AST_FORMAT_G722 (1 << 12)
|
#define AST_FORMAT_G722 (1ULL << 12)
|
||||||
/*! G.722.1 (also known as Siren7, 32kbps assumed) */
|
/*! G.722.1 (also known as Siren7, 32kbps assumed) */
|
||||||
#define AST_FORMAT_SIREN7 (1 << 13)
|
#define AST_FORMAT_SIREN7 (1ULL << 13)
|
||||||
/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
|
/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
|
||||||
#define AST_FORMAT_SIREN14 (1 << 14)
|
#define AST_FORMAT_SIREN14 (1ULL << 14)
|
||||||
/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
|
/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
|
||||||
#define AST_FORMAT_SLINEAR16 (1 << 15)
|
#define AST_FORMAT_SLINEAR16 (1ULL << 15)
|
||||||
/*! Maximum audio mask */
|
/*! Maximum audio mask */
|
||||||
#define AST_FORMAT_AUDIO_MASK ((1 << 16)-1)
|
#define AST_FORMAT_AUDIO_MASK 0xFFFF0000FFFFULL
|
||||||
/*! JPEG Images */
|
/*! JPEG Images */
|
||||||
#define AST_FORMAT_JPEG (1 << 16)
|
#define AST_FORMAT_JPEG (1ULL << 16)
|
||||||
/*! PNG Images */
|
/*! PNG Images */
|
||||||
#define AST_FORMAT_PNG (1 << 17)
|
#define AST_FORMAT_PNG (1ULL << 17)
|
||||||
/*! H.261 Video */
|
/*! H.261 Video */
|
||||||
#define AST_FORMAT_H261 (1 << 18)
|
#define AST_FORMAT_H261 (1ULL << 18)
|
||||||
/*! H.263 Video */
|
/*! H.263 Video */
|
||||||
#define AST_FORMAT_H263 (1 << 19)
|
#define AST_FORMAT_H263 (1ULL << 19)
|
||||||
/*! H.263+ Video */
|
/*! H.263+ Video */
|
||||||
#define AST_FORMAT_H263_PLUS (1 << 20)
|
#define AST_FORMAT_H263_PLUS (1ULL << 20)
|
||||||
/*! H.264 Video */
|
/*! H.264 Video */
|
||||||
#define AST_FORMAT_H264 (1 << 21)
|
#define AST_FORMAT_H264 (1ULL << 21)
|
||||||
/*! MPEG4 Video */
|
/*! MPEG4 Video */
|
||||||
#define AST_FORMAT_MP4_VIDEO (1 << 22)
|
#define AST_FORMAT_MP4_VIDEO (1ULL << 22)
|
||||||
#define AST_FORMAT_VIDEO_MASK (((1 << 25)-1) & ~(AST_FORMAT_AUDIO_MASK))
|
#define AST_FORMAT_VIDEO_MASK ((((1ULL << 25)-1) & ~(AST_FORMAT_AUDIO_MASK)) | 0x7FFF000000000000ULL)
|
||||||
/*! T.140 RED Text format RFC 4103 */
|
/*! T.140 RED Text format RFC 4103 */
|
||||||
#define AST_FORMAT_T140RED (1 << 26)
|
#define AST_FORMAT_T140RED (1ULL << 26)
|
||||||
/*! T.140 Text format - ITU T.140, RFC 4103 */
|
/*! T.140 Text format - ITU T.140, RFC 4103 */
|
||||||
#define AST_FORMAT_T140 (1 << 27)
|
#define AST_FORMAT_T140 (1ULL << 27)
|
||||||
/*! Maximum text mask */
|
/*! Maximum text mask */
|
||||||
#define AST_FORMAT_MAX_TEXT (1 << 28))
|
#define AST_FORMAT_MAX_TEXT (1ULL << 28)
|
||||||
#define AST_FORMAT_TEXT_MASK (((1 << 30)-1) & ~(AST_FORMAT_AUDIO_MASK) & ~(AST_FORMAT_VIDEO_MASK))
|
#define AST_FORMAT_TEXT_MASK (((1ULL << 30)-1) & ~(AST_FORMAT_AUDIO_MASK) & ~(AST_FORMAT_VIDEO_MASK))
|
||||||
|
/*! Raw mu-law data (G.711) */
|
||||||
|
#define AST_FORMAT_TESTLAW (1ULL << 47)
|
||||||
|
/*! Reserved bit - do not use */
|
||||||
|
#define AST_FORMAT_RESERVED (1ULL << 63)
|
||||||
|
|
||||||
enum ast_control_frame_type {
|
enum ast_control_frame_type {
|
||||||
AST_CONTROL_HANGUP = 1, /*!< Other end has hungup */
|
AST_CONTROL_HANGUP = 1, /*!< Other end has hungup */
|
||||||
|
@ -444,7 +452,7 @@ struct ast_option_header {
|
||||||
|
|
||||||
/*! \brief Definition of supported media formats (codecs) */
|
/*! \brief Definition of supported media formats (codecs) */
|
||||||
struct ast_format_list {
|
struct ast_format_list {
|
||||||
int bits; /*!< bitmask value */
|
format_t bits; /*!< bitmask value */
|
||||||
char *name; /*!< short name */
|
char *name; /*!< short name */
|
||||||
int samplespersecond; /*!< Number of samples per second (8000/16000) */
|
int samplespersecond; /*!< Number of samples per second (8000/16000) */
|
||||||
char *desc; /*!< Description */
|
char *desc; /*!< Description */
|
||||||
|
@ -517,7 +525,7 @@ void ast_swapcopy_samples(void *dst, const void *src, int samples);
|
||||||
* \param format id of format
|
* \param format id of format
|
||||||
* \return A static string containing the name of the format or "unknown" if unknown.
|
* \return A static string containing the name of the format or "unknown" if unknown.
|
||||||
*/
|
*/
|
||||||
char* ast_getformatname(int format);
|
char* ast_getformatname(format_t format);
|
||||||
|
|
||||||
/*! \brief Get the names of a set of formats
|
/*! \brief Get the names of a set of formats
|
||||||
* \param buf a buffer for the output string
|
* \param buf a buffer for the output string
|
||||||
|
@ -527,21 +535,21 @@ char* ast_getformatname(int format);
|
||||||
* ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
|
* ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
|
||||||
* \return The return value is buf.
|
* \return The return value is buf.
|
||||||
*/
|
*/
|
||||||
char* ast_getformatname_multiple(char *buf, size_t size, int format);
|
char* ast_getformatname_multiple(char *buf, size_t size, format_t format);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Gets a format from a name.
|
* \brief Gets a format from a name.
|
||||||
* \param name string of format
|
* \param name string of format
|
||||||
* \return This returns the form of the format in binary on success, 0 on error.
|
* \return This returns the form of the format in binary on success, 0 on error.
|
||||||
*/
|
*/
|
||||||
int ast_getformatbyname(const char *name);
|
format_t ast_getformatbyname(const char *name);
|
||||||
|
|
||||||
/*! \brief Get a name from a format
|
/*! \brief Get a name from a format
|
||||||
* Gets a name from a format
|
* Gets a name from a format
|
||||||
* \param codec codec number (1,2,4,8,16,etc.)
|
* \param codec codec number (1,2,4,8,16,etc.)
|
||||||
* \return This returns a static string identifying the format on success, 0 on error.
|
* \return This returns a static string identifying the format on success, 0 on error.
|
||||||
*/
|
*/
|
||||||
char *ast_codec2str(int codec);
|
char *ast_codec2str(format_t codec);
|
||||||
|
|
||||||
/*! \name AST_Smoother
|
/*! \name AST_Smoother
|
||||||
*/
|
*/
|
||||||
|
@ -617,38 +625,38 @@ void ast_codec_pref_init(struct ast_codec_pref *pref);
|
||||||
* \brief Codec located at a particular place in the preference index.
|
* \brief Codec located at a particular place in the preference index.
|
||||||
* \arg \ref AudioCodecPref
|
* \arg \ref AudioCodecPref
|
||||||
*/
|
*/
|
||||||
int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
|
format_t ast_codec_pref_index(struct ast_codec_pref *pref, int index);
|
||||||
|
|
||||||
/*! \brief Remove audio a codec from a preference list */
|
/*! \brief Remove audio a codec from a preference list */
|
||||||
void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
|
void ast_codec_pref_remove(struct ast_codec_pref *pref, format_t format);
|
||||||
|
|
||||||
/*! \brief Append a audio codec to a preference list, removing it first if it was already there
|
/*! \brief Append a audio codec to a preference list, removing it first if it was already there
|
||||||
*/
|
*/
|
||||||
int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
|
int ast_codec_pref_append(struct ast_codec_pref *pref, format_t format);
|
||||||
|
|
||||||
/*! \brief Prepend an audio codec to a preference list, removing it first if it was already there
|
/*! \brief Prepend an audio codec to a preference list, removing it first if it was already there
|
||||||
*/
|
*/
|
||||||
void ast_codec_pref_prepend(struct ast_codec_pref *pref, int format, int only_if_existing);
|
void ast_codec_pref_prepend(struct ast_codec_pref *pref, format_t format, int only_if_existing);
|
||||||
|
|
||||||
/*! \brief Select the best audio format according to preference list from supplied options.
|
/*! \brief Select the best audio format according to preference list from supplied options.
|
||||||
If "find_best" is non-zero then if nothing is found, the "Best" format of
|
If "find_best" is non-zero then if nothing is found, the "Best" format of
|
||||||
the format list is selected, otherwise 0 is returned. */
|
the format list is selected, otherwise 0 is returned. */
|
||||||
int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
|
format_t ast_codec_choose(struct ast_codec_pref *pref, format_t formats, int find_best);
|
||||||
|
|
||||||
/*! \brief Set packet size for codec
|
/*! \brief Set packet size for codec
|
||||||
*/
|
*/
|
||||||
int ast_codec_pref_setsize(struct ast_codec_pref *pref, int format, int framems);
|
int ast_codec_pref_setsize(struct ast_codec_pref *pref, format_t format, int framems);
|
||||||
|
|
||||||
/*! \brief Get packet size for codec
|
/*! \brief Get packet size for codec
|
||||||
*/
|
*/
|
||||||
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, int format);
|
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, format_t format);
|
||||||
|
|
||||||
/*! \brief Parse an "allow" or "deny" line in a channel or device configuration
|
/*! \brief Parse an "allow" or "deny" line in a channel or device configuration
|
||||||
and update the capabilities mask and pref if provided.
|
and update the capabilities mask and pref if provided.
|
||||||
Video codecs are not added to codec preference lists, since we can not transcode
|
Video codecs are not added to codec preference lists, since we can not transcode
|
||||||
\return Returns number of errors encountered during parsing
|
\return Returns number of errors encountered during parsing
|
||||||
*/
|
*/
|
||||||
int ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);
|
int ast_parse_allow_disallow(struct ast_codec_pref *pref, format_t *mask, const char *list, int allowing);
|
||||||
|
|
||||||
/*! \brief Dump audio codec preference list into a string */
|
/*! \brief Dump audio codec preference list into a string */
|
||||||
int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
|
int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
|
||||||
|
@ -660,14 +668,14 @@ void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size,
|
||||||
int ast_codec_get_samples(struct ast_frame *f);
|
int ast_codec_get_samples(struct ast_frame *f);
|
||||||
|
|
||||||
/*! \brief Returns the number of bytes for the number of samples of the given format */
|
/*! \brief Returns the number of bytes for the number of samples of the given format */
|
||||||
int ast_codec_get_len(int format, int samples);
|
int ast_codec_get_len(format_t format, int samples);
|
||||||
|
|
||||||
/*! \brief Appends a frame to the end of a list of frames, truncating the maximum length of the list */
|
/*! \brief Appends a frame to the end of a list of frames, truncating the maximum length of the list */
|
||||||
struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe);
|
struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe);
|
||||||
|
|
||||||
|
|
||||||
/*! \brief Gets duration in ms of interpolation frame for a format */
|
/*! \brief Gets duration in ms of interpolation frame for a format */
|
||||||
static inline int ast_codec_interp_len(int format)
|
static inline int ast_codec_interp_len(format_t format)
|
||||||
{
|
{
|
||||||
return (format == AST_FORMAT_ILBC) ? 30 : 20;
|
return (format == AST_FORMAT_ILBC) ? 30 : 20;
|
||||||
}
|
}
|
||||||
|
@ -694,7 +702,7 @@ int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2);
|
||||||
/*!
|
/*!
|
||||||
* \brief Get the sample rate for a given format.
|
* \brief Get the sample rate for a given format.
|
||||||
*/
|
*/
|
||||||
static force_inline int ast_format_rate(int format)
|
static force_inline int ast_format_rate(format_t format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case AST_FORMAT_G722:
|
case AST_FORMAT_G722:
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Asterisk -- An open source telephony toolkit.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1999 - 2009, Digium, Inc.
|
||||||
|
*
|
||||||
|
* Mark Spencer <markster@digium.com>
|
||||||
|
*
|
||||||
|
* See http://www.asterisk.org for more information about
|
||||||
|
* the Asterisk project. Please do not directly contact
|
||||||
|
* any of the maintainers of this project for assistance;
|
||||||
|
* the project provides a web site, mailing lists and IRC
|
||||||
|
* channels for your use.
|
||||||
|
*
|
||||||
|
* This program is free software, distributed under the terms of
|
||||||
|
* the GNU General Public License Version 2. See the LICENSE file
|
||||||
|
* at the top of the source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file
|
||||||
|
* \brief Asterisk internal frame definitions.
|
||||||
|
* \arg For an explanation of frames, see \ref Def_Frame
|
||||||
|
* \arg Frames are send of Asterisk channels, see \ref Def_Channel
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASTERISK_FRAME_DEFS_H
|
||||||
|
#define _ASTERISK_FRAME_DEFS_H
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int64_t format_t;
|
||||||
|
|
||||||
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _ASTERISK_FRAME_DEFS_H */
|
|
@ -879,11 +879,11 @@ int ast_async_goto_by_name(const char *chan, const char *context, const char *ex
|
||||||
|
|
||||||
/*! Synchronously or asynchronously make an outbound call and send it to a
|
/*! Synchronously or asynchronously make an outbound call and send it to a
|
||||||
particular extension */
|
particular extension */
|
||||||
int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
int ast_pbx_outgoing_exten(const char *type, format_t format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||||
|
|
||||||
/*! Synchronously or asynchronously make an outbound call and send it to a
|
/*! Synchronously or asynchronously make an outbound call and send it to a
|
||||||
particular application with given extension */
|
particular application with given extension */
|
||||||
int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
int ast_pbx_outgoing_app(const char *type, format_t format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Evaluate a condition
|
* \brief Evaluate a condition
|
||||||
|
|
|
@ -221,7 +221,7 @@ struct ast_rtp_payload_type {
|
||||||
/*! Is this an Asterisk value */
|
/*! Is this an Asterisk value */
|
||||||
int asterisk_format;
|
int asterisk_format;
|
||||||
/*! Actual internal value of the payload */
|
/*! Actual internal value of the payload */
|
||||||
int code;
|
format_t code;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Structure that represents statistics from an RTP instance */
|
/*! Structure that represents statistics from an RTP instance */
|
||||||
|
@ -328,7 +328,7 @@ struct ast_rtp_engine {
|
||||||
/*! Callback for setting an RTP property */
|
/*! Callback for setting an RTP property */
|
||||||
void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
|
void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
|
||||||
/*! Callback for setting a payload */
|
/*! Callback for setting a payload */
|
||||||
void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, int format);
|
void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, format_t format);
|
||||||
/*! Callback for setting packetization preferences */
|
/*! Callback for setting packetization preferences */
|
||||||
void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
|
void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
|
||||||
/*! Callback for setting the remote address that RTP is to be sent to */
|
/*! Callback for setting the remote address that RTP is to be sent to */
|
||||||
|
@ -352,9 +352,9 @@ struct ast_rtp_engine {
|
||||||
/*! Callback to locally bridge two RTP instances */
|
/*! Callback to locally bridge two RTP instances */
|
||||||
int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
|
int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
|
||||||
/*! Callback to set the read format */
|
/*! Callback to set the read format */
|
||||||
int (*set_read_format)(struct ast_rtp_instance *instance, int format);
|
int (*set_read_format)(struct ast_rtp_instance *instance, format_t format);
|
||||||
/*! Callback to set the write format */
|
/*! Callback to set the write format */
|
||||||
int (*set_write_format)(struct ast_rtp_instance *instance, int format);
|
int (*set_write_format)(struct ast_rtp_instance *instance, format_t format);
|
||||||
/*! Callback to make two instances compatible */
|
/*! Callback to make two instances compatible */
|
||||||
int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
|
int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
|
||||||
/*! Callback to see if two instances are compatible with DTMF */
|
/*! Callback to see if two instances are compatible with DTMF */
|
||||||
|
@ -399,9 +399,9 @@ struct ast_rtp_glue {
|
||||||
*/
|
*/
|
||||||
enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
|
enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
|
||||||
/*! Callback for updating the destination that the remote side should send RTP to */
|
/*! Callback for updating the destination that the remote side should send RTP to */
|
||||||
int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, int codecs, int nat_active);
|
int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
|
||||||
/*! Callback for retrieving codecs that the channel can do */
|
/*! Callback for retrieving codecs that the channel can do */
|
||||||
int (*get_codec)(struct ast_channel *chan);
|
format_t (*get_codec)(struct ast_channel *chan);
|
||||||
/*! Linked list information */
|
/*! Linked list information */
|
||||||
AST_RWLIST_ENTRY(ast_rtp_glue) entry;
|
AST_RWLIST_ENTRY(ast_rtp_glue) entry;
|
||||||
};
|
};
|
||||||
|
@ -994,7 +994,7 @@ struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
|
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, format_t code);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Retrieve all formats that were found
|
* \brief Retrieve all formats that were found
|
||||||
|
@ -1015,7 +1015,7 @@ unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astformats, int *nonastformats);
|
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Retrieve a payload based on whether it is an Asterisk format and the code
|
* \brief Retrieve a payload based on whether it is an Asterisk format and the code
|
||||||
|
@ -1036,7 +1036,7 @@ void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astforma
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code);
|
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Retrieve mime subtype information on a payload
|
* \brief Retrieve mime subtype information on a payload
|
||||||
|
@ -1058,7 +1058,7 @@ int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asteris
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options);
|
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert formats into a string and put them into a buffer
|
* \brief Convert formats into a string and put them into a buffer
|
||||||
|
@ -1082,7 +1082,7 @@ const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int co
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const int capability, const int asterisk_format, enum ast_rtp_options options);
|
char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set codec packetization preferences
|
* \brief Set codec packetization preferences
|
||||||
|
@ -1464,7 +1464,7 @@ char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_r
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int format);
|
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Tell underlying RTP engine that audio frames will be provided in a specific format
|
* \brief Tell underlying RTP engine that audio frames will be provided in a specific format
|
||||||
|
@ -1485,7 +1485,7 @@ int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int form
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, int format);
|
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
|
* \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
|
||||||
|
@ -1527,7 +1527,7 @@ int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_in
|
||||||
*
|
*
|
||||||
* \since 1.6.3
|
* \since 1.6.3
|
||||||
*/
|
*/
|
||||||
int ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk);
|
format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
|
* \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
|
||||||
|
|
|
@ -86,7 +86,7 @@ static inline struct ast_frame *slin8_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass.codec = AST_FORMAT_SLINEAR,
|
||||||
.datalen = sizeof(ex_slin8),
|
.datalen = sizeof(ex_slin8),
|
||||||
.samples = ARRAY_LEN(ex_slin8) / 2,
|
.samples = ARRAY_LEN(ex_slin8) / 2,
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
@ -102,7 +102,7 @@ static inline struct ast_frame *slin16_sample(void)
|
||||||
{
|
{
|
||||||
static struct ast_frame f = {
|
static struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR16,
|
.subclass.codec = AST_FORMAT_SLINEAR16,
|
||||||
.datalen = sizeof(ex_slin16),
|
.datalen = sizeof(ex_slin16),
|
||||||
.samples = ARRAY_LEN(ex_slin16) / 2,
|
.samples = ARRAY_LEN(ex_slin16) / 2,
|
||||||
.mallocd = 0,
|
.mallocd = 0,
|
||||||
|
|
|
@ -37,8 +37,8 @@ struct ast_slinfactory {
|
||||||
short *offset; /*!< Offset into the hold where audio begins */
|
short *offset; /*!< Offset into the hold where audio begins */
|
||||||
size_t holdlen; /*!< Number of samples currently in the hold */
|
size_t holdlen; /*!< Number of samples currently in the hold */
|
||||||
unsigned int size; /*!< Number of samples currently in the factory */
|
unsigned int size; /*!< Number of samples currently in the factory */
|
||||||
unsigned int format; /*!< Current format the translation path is converting from */
|
format_t format; /*!< Current format the translation path is converting from */
|
||||||
unsigned int output_format; /*!< The output format desired */
|
format_t output_format; /*!< The output format desired */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#ifndef _ASTERISK_TRANSLATE_H
|
#ifndef _ASTERISK_TRANSLATE_H
|
||||||
#define _ASTERISK_TRANSLATE_H
|
#define _ASTERISK_TRANSLATE_H
|
||||||
|
|
||||||
#define MAX_AUDIO_FORMAT 15 /* Do not include video here */
|
#define MAX_AUDIO_FORMAT 47 /* Do not include video here */
|
||||||
#define MAX_FORMAT 32 /* Do include video here */
|
#define MAX_FORMAT 64 /* Do include video here */
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -70,29 +70,29 @@ struct ast_trans_pvt; /* declared below */
|
||||||
*/
|
*/
|
||||||
struct ast_translator {
|
struct ast_translator {
|
||||||
const char name[80]; /*!< Name of translator */
|
const char name[80]; /*!< Name of translator */
|
||||||
int srcfmt; /*!< Source format (note: bit position,
|
format_t srcfmt; /*!< Source format (note: bit position,
|
||||||
converted to index during registration) */
|
* converted to index during registration) */
|
||||||
int dstfmt; /*!< Destination format (note: bit position,
|
format_t dstfmt; /*!< Destination format (note: bit position,
|
||||||
converted to index during registration) */
|
* converted to index during registration) */
|
||||||
|
|
||||||
int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data
|
int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data
|
||||||
associated with the translator */
|
* associated with the translator */
|
||||||
|
|
||||||
int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
|
int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
|
||||||
/*!< Input frame callback. Store
|
/*!< Input frame callback. Store
|
||||||
(and possibly convert) input frame. */
|
* (and possibly convert) input frame. */
|
||||||
|
|
||||||
struct ast_frame * (*frameout)(struct ast_trans_pvt *pvt);
|
struct ast_frame * (*frameout)(struct ast_trans_pvt *pvt);
|
||||||
/*!< Output frame callback. Generate a frame
|
/*!< Output frame callback. Generate a frame
|
||||||
with outbuf content. */
|
* with outbuf content. */
|
||||||
|
|
||||||
void (*destroy)(struct ast_trans_pvt *pvt);
|
void (*destroy)(struct ast_trans_pvt *pvt);
|
||||||
/*!< cleanup private data, if needed
|
/*!< cleanup private data, if needed
|
||||||
(often unnecessary). */
|
* (often unnecessary). */
|
||||||
|
|
||||||
struct ast_frame * (*sample)(void); /*!< Generate an example frame */
|
struct ast_frame * (*sample)(void); /*!< Generate an example frame */
|
||||||
|
|
||||||
/*! \brief size of outbuf, in samples. Leave it 0 if you want the framein
|
/*!\brief size of outbuf, in samples. Leave it 0 if you want the framein
|
||||||
* callback deal with the frame. Set it appropriately if you
|
* callback deal with the frame. Set it appropriately if you
|
||||||
* want the code to checks if the incoming frame fits the
|
* want the code to checks if the incoming frame fits the
|
||||||
* outbuf (this is e.g. required for plc).
|
* outbuf (this is e.g. required for plc).
|
||||||
|
@ -109,7 +109,7 @@ struct ast_translator {
|
||||||
int useplc; /*!< current status of plc, changed at runtime */
|
int useplc; /*!< current status of plc, changed at runtime */
|
||||||
int native_plc; /*!< true if the translator can do native plc */
|
int native_plc; /*!< true if the translator can do native plc */
|
||||||
|
|
||||||
struct ast_module *module; /* opaque reference to the parent module */
|
struct ast_module *module; /*!< opaque reference to the parent module */
|
||||||
|
|
||||||
int cost; /*!< Cost in milliseconds for encoding/decoding 1 second of sound */
|
int cost; /*!< Cost in milliseconds for encoding/decoding 1 second of sound */
|
||||||
int active; /*!< Whether this translator should be used or not */
|
int active; /*!< Whether this translator should be used or not */
|
||||||
|
@ -205,7 +205,7 @@ void ast_translator_deactivate(struct ast_translator *t);
|
||||||
* \return Returns 0 on success, -1 if no path could be found.
|
* \return Returns 0 on success, -1 if no path could be found.
|
||||||
* \note Modifies dests and srcs in place
|
* \note Modifies dests and srcs in place
|
||||||
*/
|
*/
|
||||||
int ast_translator_best_choice(int *dsts, int *srcs);
|
format_t ast_translator_best_choice(format_t *dsts, format_t *srcs);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Builds a translator path
|
* \brief Builds a translator path
|
||||||
|
@ -214,7 +214,7 @@ int ast_translator_best_choice(int *dsts, int *srcs);
|
||||||
* \param source source format
|
* \param source source format
|
||||||
* \return ast_trans_pvt on success, NULL on failure
|
* \return ast_trans_pvt on success, NULL on failure
|
||||||
* */
|
* */
|
||||||
struct ast_trans_pvt *ast_translator_build_path(int dest, int source);
|
struct ast_trans_pvt *ast_translator_build_path(format_t dest, format_t source);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Frees a translator path
|
* \brief Frees a translator path
|
||||||
|
@ -240,7 +240,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, i
|
||||||
* \param src source format
|
* \param src source format
|
||||||
* \return the number of translation steps required, or -1 if no path is available
|
* \return the number of translation steps required, or -1 if no path is available
|
||||||
*/
|
*/
|
||||||
unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src);
|
unsigned int ast_translate_path_steps(format_t dest, format_t src);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Mask off unavailable formats from a format bitmask
|
* \brief Mask off unavailable formats from a format bitmask
|
||||||
|
@ -254,7 +254,7 @@ unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src);
|
||||||
* \note Only a single audio format and a single video format can be
|
* \note Only a single audio format and a single video format can be
|
||||||
* present in 'src', or the function will produce unexpected results.
|
* present in 'src', or the function will produce unexpected results.
|
||||||
*/
|
*/
|
||||||
unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src);
|
format_t ast_translate_available_formats(format_t dest, format_t src);
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Asterisk -- An open source telephony toolkit.
|
* Asterisk -- An open source telephony toolkit.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
* Copyright (C) 1999 - 2009, Digium, Inc.
|
||||||
*
|
*
|
||||||
* Mark Spencer <markster@digium.com>
|
* Mark Spencer <markster@digium.com>
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,12 @@ extern "C" {
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* If we just tell GCC what's going on, we can trust it to behave optimally */
|
/* If we just tell GCC what's going on, we can trust it to behave optimally */
|
||||||
|
static inline uint64_t get_unaligned_uint64(const void *p)
|
||||||
|
{
|
||||||
|
const struct { uint64_t d; } __attribute__((packed)) *pp = p;
|
||||||
|
return pp->d;
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned int get_unaligned_uint32(const void *p)
|
static inline unsigned int get_unaligned_uint32(const void *p)
|
||||||
{
|
{
|
||||||
const struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
const struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
||||||
|
@ -42,6 +48,13 @@ static inline unsigned short get_unaligned_uint16(const void *p)
|
||||||
return pp->d;
|
return pp->d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void put_unaligned_uint64(void *p, uint64_t datum)
|
||||||
|
{
|
||||||
|
struct { uint64_t d; } __attribute__((packed)) *pp = p;
|
||||||
|
|
||||||
|
pp->d = datum;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
||||||
{
|
{
|
||||||
struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
||||||
|
@ -56,6 +69,21 @@ static inline void put_unaligned_uint16(void *p, unsigned short datum)
|
||||||
pp->d = datum;
|
pp->d = datum;
|
||||||
}
|
}
|
||||||
#elif defined(SOLARIS) && defined(__sparc__)
|
#elif defined(SOLARIS) && defined(__sparc__)
|
||||||
|
static inline uint64_t get_unaligned_uint64(const void *p)
|
||||||
|
{
|
||||||
|
const unsigned char *cp = p;
|
||||||
|
|
||||||
|
return
|
||||||
|
(((uint64_t) cp[0]) << 56) |
|
||||||
|
(((uint64_t) cp[1]) << 48) |
|
||||||
|
(((uint64_t) cp[2]) << 40) |
|
||||||
|
(((uint64_t) cp[3]) << 32) |
|
||||||
|
(((uint64_t) cp[4]) << 24) |
|
||||||
|
(((uint64_t) cp[5]) << 16) |
|
||||||
|
(((uint64_t) cp[6]) << 8) |
|
||||||
|
(((uint64_t) cp[7]) << 0);
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned int get_unaligned_uint32(const void *p)
|
static inline unsigned int get_unaligned_uint32(const void *p)
|
||||||
{
|
{
|
||||||
const unsigned char *cp = p;
|
const unsigned char *cp = p;
|
||||||
|
@ -70,6 +98,20 @@ static inline unsigned short get_unaligned_uint16(const void *p)
|
||||||
return (cp[0] << 8) | cp[1] ;
|
return (cp[0] << 8) | cp[1] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void put_unaligned_uint64(void *p, uint64_t datum)
|
||||||
|
{
|
||||||
|
unsigned char *cp = p;
|
||||||
|
|
||||||
|
cp[0] = (datum >> 56) & 0xff;
|
||||||
|
cp[1] = (datum >> 48) & 0xff;
|
||||||
|
cp[2] = (datum >> 40) & 0xff;
|
||||||
|
cp[3] = (datum >> 32) & 0xff;
|
||||||
|
cp[4] = (datum >> 24) & 0xff;
|
||||||
|
cp[5] = (datum >> 16) & 0xff;
|
||||||
|
cp[6] = (datum >> 8) & 0xff;
|
||||||
|
cp[7] = (datum >> 0) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
||||||
{
|
{
|
||||||
unsigned char *cp = p;
|
unsigned char *cp = p;
|
||||||
|
@ -88,8 +130,10 @@ static inline void put_unaligned_uint16(void *p, unsigned int datum)
|
||||||
cp[1] = datum;
|
cp[1] = datum;
|
||||||
}
|
}
|
||||||
#else /* Not GCC, not Solaris/SPARC. Assume we can handle direct load/store. */
|
#else /* Not GCC, not Solaris/SPARC. Assume we can handle direct load/store. */
|
||||||
|
#define get_unaligned_uint64(p) (*((uint64_t *)(p)))
|
||||||
#define get_unaligned_uint32(p) (*((unsigned int *)(p)))
|
#define get_unaligned_uint32(p) (*((unsigned int *)(p)))
|
||||||
#define get_unaligned_uint16(p) (*((unsigned short *)(p)))
|
#define get_unaligned_uint16(p) (*((unsigned short *)(p)))
|
||||||
|
#define put_unaligned_uint64(p,d) do { uint64_t *__P = (p); *__P = d; } while(0)
|
||||||
#define put_unaligned_uint32(p,d) do { unsigned int *__P = (p); *__P = d; } while(0)
|
#define put_unaligned_uint32(p,d) do { unsigned int *__P = (p); *__P = d; } while(0)
|
||||||
#define put_unaligned_uint16(p,d) do { unsigned short *__P = (p); *__P = d; } while(0)
|
#define put_unaligned_uint16(p,d) do { unsigned short *__P = (p); *__P = d; } while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -409,14 +409,14 @@ static void jb_get_and_deliver(struct ast_channel *chan)
|
||||||
case JB_IMPL_DROP:
|
case JB_IMPL_DROP:
|
||||||
jb_framelog("\tJB_GET {now=%ld}: %s frame with ts=%ld and len=%ld\n",
|
jb_framelog("\tJB_GET {now=%ld}: %s frame with ts=%ld and len=%ld\n",
|
||||||
now, jb_get_actions[res], f->ts, f->len);
|
now, jb_get_actions[res], f->ts, f->len);
|
||||||
jb->last_format = f->subclass;
|
jb->last_format = f->subclass.codec;
|
||||||
ast_frfree(f);
|
ast_frfree(f);
|
||||||
break;
|
break;
|
||||||
case JB_IMPL_INTERP:
|
case JB_IMPL_INTERP:
|
||||||
/* interpolate a frame */
|
/* interpolate a frame */
|
||||||
f = &finterp;
|
f = &finterp;
|
||||||
f->frametype = AST_FRAME_VOICE;
|
f->frametype = AST_FRAME_VOICE;
|
||||||
f->subclass = jb->last_format;
|
f->subclass.codec = jb->last_format;
|
||||||
f->datalen = 0;
|
f->datalen = 0;
|
||||||
f->samples = interpolation_len * 8;
|
f->samples = interpolation_len * 8;
|
||||||
f->mallocd = 0;
|
f->mallocd = 0;
|
||||||
|
@ -480,7 +480,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
|
||||||
jb->next = jbimpl->next(jbobj);
|
jb->next = jbimpl->next(jbobj);
|
||||||
|
|
||||||
/* Init last format for a first time. */
|
/* Init last format for a first time. */
|
||||||
jb->last_format = frr->subclass;
|
jb->last_format = frr->subclass.codec;
|
||||||
|
|
||||||
/* Create a frame log file */
|
/* Create a frame log file */
|
||||||
if (ast_test_flag(jbconf, AST_JB_LOG)) {
|
if (ast_test_flag(jbconf, AST_JB_LOG)) {
|
||||||
|
|
16
main/app.c
16
main/app.c
|
@ -429,7 +429,7 @@ static int linear_generator(struct ast_channel *chan, void *data, int len, int s
|
||||||
struct linear_state *ls = data;
|
struct linear_state *ls = data;
|
||||||
struct ast_frame f = {
|
struct ast_frame f = {
|
||||||
.frametype = AST_FRAME_VOICE,
|
.frametype = AST_FRAME_VOICE,
|
||||||
.subclass = AST_FORMAT_SLINEAR,
|
.subclass.codec = AST_FORMAT_SLINEAR,
|
||||||
.data.ptr = buf + AST_FRIENDLY_OFFSET / 2,
|
.data.ptr = buf + AST_FRIENDLY_OFFSET / 2,
|
||||||
.offset = AST_FRIENDLY_OFFSET,
|
.offset = AST_FRIENDLY_OFFSET,
|
||||||
};
|
};
|
||||||
|
@ -851,20 +851,20 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
||||||
} else if (f->frametype == AST_FRAME_DTMF) {
|
} else if (f->frametype == AST_FRAME_DTMF) {
|
||||||
if (prepend) {
|
if (prepend) {
|
||||||
/* stop recording with any digit */
|
/* stop recording with any digit */
|
||||||
ast_verb(3, "User ended message by pressing %c\n", f->subclass);
|
ast_verb(3, "User ended message by pressing %c\n", f->subclass.integer);
|
||||||
res = 't';
|
res = 't';
|
||||||
outmsg = 2;
|
outmsg = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strchr(acceptdtmf, f->subclass)) {
|
if (strchr(acceptdtmf, f->subclass.integer)) {
|
||||||
ast_verb(3, "User ended message by pressing %c\n", f->subclass);
|
ast_verb(3, "User ended message by pressing %c\n", f->subclass.integer);
|
||||||
res = f->subclass;
|
res = f->subclass.integer;
|
||||||
outmsg = 2;
|
outmsg = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strchr(canceldtmf, f->subclass)) {
|
if (strchr(canceldtmf, f->subclass.integer)) {
|
||||||
ast_verb(3, "User cancelled message by pressing %c\n", f->subclass);
|
ast_verb(3, "User cancelled message by pressing %c\n", f->subclass.integer);
|
||||||
res = f->subclass;
|
res = f->subclass.integer;
|
||||||
outmsg = 0;
|
outmsg = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue