aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_agent.c27
-rw-r--r--channels/chan_alsa.c31
-rw-r--r--channels/chan_bridge.c4
-rw-r--r--channels/chan_console.c31
-rw-r--r--channels/chan_dahdi.c106
-rw-r--r--channels/chan_gtalk.c55
-rw-r--r--channels/chan_h323.c59
-rw-r--r--channels/chan_iax2.c348
-rw-r--r--channels/chan_jingle.c61
-rw-r--r--channels/chan_local.c18
-rw-r--r--channels/chan_mgcp.c83
-rw-r--r--channels/chan_misdn.c30
-rw-r--r--channels/chan_multicast_rtp.c6
-rw-r--r--channels/chan_oss.c33
-rw-r--r--channels/chan_phone.c59
-rw-r--r--channels/chan_sip.c164
-rw-r--r--channels/chan_skinny.c53
-rw-r--r--channels/chan_unistim.c75
-rw-r--r--channels/chan_vpb.cc75
-rw-r--r--channels/h323/chan_h323.h3
-rw-r--r--channels/iax2-parser.c65
-rw-r--r--channels/iax2-parser.h6
-rw-r--r--channels/iax2.h5
-rw-r--r--channels/sig_analog.c40
-rw-r--r--channels/sig_pri.c26
25 files changed, 805 insertions, 658 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 0d0159cae..0bc35c0bf 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -280,10 +280,11 @@ static AST_LIST_HEAD_STATIC(agents, agent_pvt); /*!< Holds the list of agents (l
#define CHECK_FORMATS(ast, p) do { \
if (p->chan) {\
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 */ \
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_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)
/*--- 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_digit_begin(struct ast_channel *ast, char digit);
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 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);
ast_mutex_lock(&p->lock);
CHECK_FORMATS(ast, p);
@@ -566,7 +567,7 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
}
switch (f->frametype) {
case AST_FRAME_CONTROL:
- if (f->subclass == AST_CONTROL_ANSWER) {
+ if (f->subclass.integer == AST_CONTROL_ANSWER) {
if (p->ackcall) {
ast_verb(3, "%s answered, waiting for '%c' to acknowledge\n", p->chan->name, p->acceptdtmf);
/* Don't pass answer along */
@@ -583,18 +584,18 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
break;
case AST_FRAME_DTMF_BEGIN:
/*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);
f = &ast_null_frame;
}
break;
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);
p->acknowledged = 1;
ast_frfree(f);
f = &answer_frame;
- } else if (f->subclass == p->enddtmf && endcall) {
+ } else if (f->subclass.integer == p->enddtmf && endcall) {
/* terminates call */
ast_frfree(f);
f = NULL;
@@ -660,7 +661,7 @@ static int agent_write(struct ast_channel *ast, struct ast_frame *f)
else {
if ((f->frametype != AST_FRAME_VOICE) ||
(f->frametype != AST_FRAME_VIDEO) ||
- (f->subclass == p->chan->writeformat)) {
+ (f->subclass.codec == p->chan->writeformat)) {
res = ast_write(p->chan, f);
} else {
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)
return -1;
if (f->frametype == AST_FRAME_DTMF)
- res = f->subclass;
+ res = f->subclass.integer;
else
res = 0;
ast_frfree(f);
@@ -1334,7 +1335,7 @@ static int check_beep(struct agent_pvt *newlyavailable, int needlock)
}
/*! \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 ast_channel *chan = NULL;
@@ -1958,12 +1959,12 @@ static int login_exec(struct ast_channel *chan, const char *data)
if (!res) {
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
if (res)
- ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
+ ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(chan->nativeformats)));
}
if (!res) {
res = ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
if (res)
- ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
+ 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 */
if (p->chan)
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index ffc62c8b1..ca6c07897 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -130,7 +130,7 @@ static int writedev = -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_text(struct ast_channel *c, const char *text);
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");
grab_owner();
if (alsa.owner) {
- f.subclass = AST_CONTROL_ANSWER;
+ f.subclass.integer = AST_CONTROL_ANSWER;
ast_queue_frame(alsa.owner, &f);
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");
grab_owner();
if (alsa.owner) {
- f.subclass = AST_CONTROL_RINGING;
+ f.subclass.integer = AST_CONTROL_RINGING;
ast_queue_frame(alsa.owner, &f);
ast_channel_unlock(alsa.owner);
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);
f.frametype = AST_FRAME_NULL;
- f.subclass = 0;
+ f.subclass.integer = 0;
f.samples = 0;
f.datalen = 0;
f.data.ptr = NULL;
@@ -471,7 +471,7 @@ static struct ast_frame *alsa_read(struct ast_channel *chan)
return &f;
}
f.frametype = AST_FRAME_VOICE;
- f.subclass = AST_FORMAT_SLINEAR;
+ f.subclass.codec = AST_FORMAT_SLINEAR;
f.samples = FRAME_SIZE;
f.datalen = FRAME_SIZE * 2;
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;
}
-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;
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;
}
@@ -669,9 +670,7 @@ static char *console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
hookstate = 1;
grab_owner();
if (alsa.owner) {
- struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
-
- ast_queue_frame(alsa.owner, &f);
+ ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);
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");
res = CLI_FAILURE;
} else {
- struct ast_frame f = { AST_FRAME_TEXT, 0 };
+ struct ast_frame f = { AST_FRAME_TEXT };
char text2send[256] = "";
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();
if (alsa.owner) {
ast_queue_frame(alsa.owner, &f);
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_ANSWER;
- f.data.ptr = NULL;
- f.datalen = 0;
- ast_queue_frame(alsa.owner, &f);
+ ast_queue_control(alsa.owner, AST_CONTROL_ANSWER);
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 (alsa.owner) {
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);
}
diff --git a/channels/chan_bridge.c b/channels/chan_bridge.c
index be823cd32..db2646654 100644
--- a/channels/chan_bridge.c
+++ b/channels/chan_bridge.c
@@ -46,7 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.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_hangup(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 */
-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;
diff --git a/channels/chan_console.c b/channels/chan_console.c
index ead0b1231..9141c3d1d 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -182,7 +182,7 @@ static struct ast_jb_conf default_jbconf = {
static struct ast_jb_conf global_jbconf;
/*! 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);
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);
@@ -264,7 +264,7 @@ static void *stream_monitor(void *data)
PaError res;
struct ast_frame f = {
.frametype = AST_FRAME_VOICE,
- .subclass = AST_FORMAT_SLINEAR16,
+ .subclass.codec = AST_FORMAT_SLINEAR16,
.src = "console_stream_monitor",
.data.ptr = buf,
.datalen = sizeof(buf),
@@ -440,11 +440,12 @@ static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext,
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 console_pvt *pvt;
+ char buf[512];
if (!(pvt = find_pvt(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;
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;
}
@@ -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)
{
- struct ast_frame f = { 0, };
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,
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;
console_pvt_unlock(pvt);
ast_verb(1, V_BEGIN "Auto-answered" V_END);
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_ANSWER;
+ ctrl = AST_CONTROL_ANSWER;
} else {
console_pvt_unlock(pvt);
ast_verb(1, V_BEGIN "Type 'console answer' to answer, or use the 'autoanswer' option "
"for future calls" V_END);
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_RINGING;
+ ctrl = AST_CONTROL_RINGING;
ast_indicate(c, AST_CONTROL_RINGING);
}
- ast_queue_frame(c, &f);
+ ast_queue_control(c, ctrl);
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)
{
- struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH };
struct console_pvt *pvt = get_active_pvt();
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;
- ast_queue_frame(pvt->owner, &f);
+ ast_queue_control(pvt->owner, AST_CONTROL_FLASH);
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 */
int i;
- struct ast_frame f = { AST_FRAME_DTMF, 0 };
+ struct ast_frame f = { AST_FRAME_DTMF };
const char *s;
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];
/* send the string one char at a time */
for (i = 0; i < strlen(s); i++) {
- f.subclass = s[i];
+ f.subclass.integer = s[i];
ast_queue_frame(pvt->owner, &f);
}
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)
{
- struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
struct console_pvt *pvt = get_active_pvt();
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_queue_frame(pvt->owner, &f);
+ ast_queue_control(pvt->owner, AST_CONTROL_ANSWER);
unref_pvt(pvt);
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index b81c7a8ef..77caff836 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -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_end(struct ast_channel *ast, char digit, unsigned int duration);
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;
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 */
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
/* 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);
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;
}
}
@@ -5327,7 +5327,7 @@ static int dahdi_accept_r2_call_exec(struct ast_channel *chan, const char *data)
res = -1;
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_frfree(f);
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 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) {
ast_debug(1, "Confirm answer on %s!\n", ast->name);
/* Upon receiving a DTMF digit, consider this an answer confirmation instead
of a DTMF digit */
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;
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
p->confirmanswer = 0;
} 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");
if (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->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;
- } else if (f->subclass == 'f') {
+ } else if (f->subclass.integer == 'f') {
/* Fax tone -- Handle and return NULL */
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
/* 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);
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;
}
}
@@ -6962,7 +6962,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
if (p->outsigmod > -1)
mysig = p->outsigmod;
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.samples = 0;
p->subs[idx].f.mallocd = 0;
@@ -6994,7 +6994,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
#endif
dahdi_confmute(p, 0);
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
}
#endif
@@ -7007,7 +7007,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
/* Mute conference */
dahdi_confmute(p, 1);
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;
}
@@ -7075,7 +7075,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
ast_setstate(ast, AST_STATE_UP);
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;
} else { /* if to state wait for offhook to dial rest */
/* 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) {
ast_setstate(ast, AST_STATE_UP);
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 */
p->polarity = POLARITY_REV;
} else {
@@ -7140,7 +7140,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
case DAHDI_EVENT_ONHOOK:
if (p->radio) {
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;
}
if (p->oprmode < 0)
@@ -7274,7 +7274,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
if (p->radio)
{
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;
}
/* 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_train_ec(p);
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 */
dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
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) {
/* Ignore answer if "confirm answer" is enabled */
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)) {
/* 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);
@@ -7340,7 +7340,7 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
} else {
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.subclass = 0;
+ p->subs[idx].f.subclass.integer = 0;
p->dialing = 1;
}
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->rings = 1;
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);
return &p->subs[idx].f;
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)) {
ast_debug(1, "Ring detected\n");
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))) {
ast_debug(1, "Line answered\n");
if (p->confirmanswer) {
p->subs[idx].f.frametype = AST_FRAME_NULL;
- p->subs[idx].f.subclass = 0;
+ p->subs[idx].f.subclass.integer = 0;
} else {
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);
}
} 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.mallocd = 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.src = "dahdi_exception";
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.mallocd = 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.src = "dahdi_read";
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;
if (ps.rxisoffhook)
{
- p->subs[idx].f.subclass = AST_CONTROL_RADIO_KEY;
+ p->subs[idx].f.subclass.integer = AST_CONTROL_RADIO_KEY;
}
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);
return &p->subs[idx].f;
@@ -8003,7 +8003,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send ringing frame if requested */
p->subs[idx].needringing = 0;
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_mutex_unlock(&p->lock);
return &p->subs[idx].f;
@@ -8013,7 +8013,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send busy frame if requested */
p->subs[idx].needbusy = 0;
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);
return &p->subs[idx].f;
}
@@ -8022,7 +8022,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send congestion frame if requested */
p->subs[idx].needcongestion = 0;
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);
return &p->subs[idx].f;
}
@@ -8031,7 +8031,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send answer frame if requested */
p->subs[idx].needanswer = 0;
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);
return &p->subs[idx].f;
}
@@ -8050,7 +8050,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send answer frame if requested */
p->subs[idx].needflash = 0;
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);
return &p->subs[idx].f;
}
@@ -8059,7 +8059,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send answer frame if requested */
p->subs[idx].needhold = 0;
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_debug(1, "Sending hold on '%s'\n", ast->name);
return &p->subs[idx].f;
@@ -8069,7 +8069,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
/* Send answer frame if requested */
p->subs[idx].needunhold = 0;
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_debug(1, "Sending unhold on '%s'\n", ast->name);
return &p->subs[idx].f;
@@ -8141,7 +8141,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
return NULL;
}
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.mallocd = 0;
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.subclass = ast->rawreadformat;
+ p->subs[idx].f.subclass.codec = ast->rawreadformat;
p->subs[idx].f.samples = READ_SIZE;
p->subs[idx].f.mallocd = 0;
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....
don't send anything */
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.mallocd = 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->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) {
/* Treat this as a "hangup" instead of a "busy" on the assumption that
a busy */
@@ -8230,7 +8230,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
|| (p->outgoing && (p->pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING)))) {
/* Don't accept in-band DTMF when in overlap dial mode */
f->frametype = AST_FRAME_NULL;
- f->subclass = 0;
+ f->subclass.integer = 0;
}
#endif
/* DSP clears us of being pulse */
@@ -8242,7 +8242,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
f=NULL;
} else if (f->frametype == AST_FRAME_VOICE) {
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) {
p->waitingfordt.tv_sec = 0;
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);
return 0;
}
- if ((frame->subclass != AST_FORMAT_SLINEAR) &&
- (frame->subclass != AST_FORMAT_ULAW) &&
- (frame->subclass != AST_FORMAT_ALAW)) {
- ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
+ if ((frame->subclass.codec != AST_FORMAT_SLINEAR) &&
+ (frame->subclass.codec != AST_FORMAT_ULAW) &&
+ (frame->subclass.codec != AST_FORMAT_ALAW)) {
+ ast_log(LOG_WARNING, "Cannot handle frames in %s format\n", ast_getformatname(frame->subclass.codec));
return -1;
}
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)
return 0;
- if (frame->subclass == AST_FORMAT_SLINEAR) {
+ if (frame->subclass.codec == AST_FORMAT_SLINEAR) {
if (!p->subs[idx].linear) {
p->subs[idx].linear = 1;
res = dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
@@ -9410,8 +9410,8 @@ static void *analog_ss_thread(void *data)
if (!f)
break;
if (f->frametype == AST_FRAME_DTMF) {
- dtmfbuf[k++] = f->subclass;
- ast_debug(1, "CID got digit '%c'\n", f->subclass);
+ dtmfbuf[k++] = f->subclass.integer;
+ ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
res = 2000;
}
ast_frfree(f);
@@ -9648,8 +9648,8 @@ static void *analog_ss_thread(void *data)
}
f = ast_read(chan);
if (f->frametype == AST_FRAME_DTMF) {
- dtmfbuf[k++] = f->subclass;
- ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass);
+ dtmfbuf[k++] = f->subclass.integer;
+ ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass.integer);
res = 2000;
}
ast_frfree(f);
@@ -11991,7 +11991,7 @@ static struct dahdi_pvt *duplicate_pseudo(struct dahdi_pvt *src)
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;
int channelmatch = -1;
@@ -14986,7 +14986,7 @@ static int action_dahdidialoffhook(struct mansession *s, const struct message *m
return 0;
}
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);
}
astman_send_ack(s, m, "DAHDIDialOffhook");
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 25fdc2c63..8655806b0 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -115,8 +115,8 @@ struct gtalk_pvt {
struct ast_channel *owner; /*!< Master Channel */
struct ast_rtp_instance *rtp; /*!< RTP audio session */
struct ast_rtp_instance *vrtp; /*!< RTP video session */
- int jointcapability; /*!< Supported capability at both ends (codecs ) */
- int peercapability;
+ format_t jointcapability; /*!< Supported capability at both ends (codecs ) */
+ format_t peercapability;
struct gtalk_pvt *next; /* Next entity */
};
@@ -146,7 +146,7 @@ struct gtalk {
char context[AST_MAX_CONTEXT];
char parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
- int capability;
+ format_t capability;
ast_group_t callgroup; /*!< Call group */
ast_group_t pickupgroup; /*!< Pickup group */
int callingpres; /*!< Calling presentation */
@@ -161,12 +161,12 @@ struct gtalk_container {
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) */
/* 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_sendtext(struct ast_channel *ast, const char *text);
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, "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)))
break;
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;
}
-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;
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;
@@ -701,19 +701,19 @@ static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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")) {
struct ast_frame f = {AST_FRAME_DTMF_END, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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 */
struct ast_frame f = {AST_FRAME_DTMF, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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"))) {
@@ -721,14 +721,14 @@ static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
struct ast_frame f = {AST_FRAME_DTMF_END, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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")) {
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+ if (f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
+ ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
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_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;
int res = 0;
+ char buf[256];
switch (frame->frametype) {
case AST_FRAME_VOICE:
- 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",
- frame->subclass, ast->nativeformats, ast->readformat,
- ast->writeformat);
+ "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 0;
}
if (p) {
@@ -1655,7 +1658,7 @@ static int gtalk_hangup(struct ast_channel *ast)
}
/*! \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 *client = NULL;
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 897416a42..3ccfde2d3 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -172,9 +172,9 @@ static struct oh323_pvt {
int newcontrol; /*!< Pending control to send */
int newdigit; /*!< Pending DTMF digit to send */
int newduration; /*!< Pending DTMF digit duration to send */
- int pref_codec; /*!< Preferred codec */
- int peercapability; /*!< Capabilities learned from peer */
- int jointcapability; /*!< Common capabilities for local and remote side */
+ format_t pref_codec; /*!< Preferred codec */
+ format_t peercapability; /*!< Capabilities learned from peer */
+ format_t jointcapability; /*!< Common capabilities for local and remote side */
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 curDTMF; /*!< DTMF tone being generated to Asterisk side */
@@ -230,7 +230,7 @@ static void delete_users(void);
static void delete_aliases(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_end(struct ast_channel *c, char digit, unsigned int duration);
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) {
struct ast_frame f = {
.frametype = AST_FRAME_DTMF_END,
- .subclass = pvt->curDTMF,
+ .subclass.integer = pvt->curDTMF,
.samples = 0,
.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) {
struct ast_frame f = {
.frametype = AST_FRAME_DTMF_END,
- .subclass = pvt->newdigit,
+ .subclass.integer = pvt->newdigit,
.samples = pvt->newduration * 8,
.len = pvt->newduration,
.src = "UPDATE_INFO",
};
if (pvt->newdigit == ' ') { /* signalUpdate message */
- f.subclass = pvt->curDTMF;
+ f.subclass.integer = pvt->curDTMF;
if (pvt->DTMFsched >= 0) {
AST_SCHED_DEL(sched, pvt->DTMFsched);
}
@@ -761,16 +761,16 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt)
if (pvt->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (f->subclass != pvt->owner->nativeformats) {
+ if (f->subclass.codec != pvt->owner->nativeformats) {
/* Try to avoid deadlock */
if (ast_channel_trylock(pvt->owner)) {
ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n");
return &ast_null_frame;
}
if (h323debug)
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
- pvt->owner->nativeformats = f->subclass;
- pvt->nativeformats = f->subclass;
+ ast_debug(1, "Oooh, format changed to '%s'\n", ast_getformatname(f->subclass.codec));
+ pvt->owner->nativeformats = f->subclass.codec;
+ pvt->nativeformats = f->subclass.codec;
ast_set_read_format(pvt->owner, pvt->owner->readformat);
ast_set_write_format(pvt->owner, pvt->owner->writeformat);
ast_channel_unlock(pvt->owner);
@@ -785,12 +785,12 @@ static struct ast_frame *oh323_rtp_read(struct oh323_pvt *pvt)
else
ast_log(LOG_NOTICE, "Unable to process inband DTMF while channel is locked\n");
} 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;
}
if (f &&(f->frametype == AST_FRAME_DTMF)) {
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;
}
} else {
- if (!(frame->subclass & c->nativeformats)) {
- ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
- frame->subclass, c->nativeformats, c->readformat, c->writeformat);
+ if (!(frame->subclass.codec & c->nativeformats)) {
+ char tmp[256];
+ 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;
}
}
@@ -1717,9 +1718,9 @@ static int create_addr(struct oh323_pvt *pvt, char *opeer)
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 ast_channel *tmpc = NULL;
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];
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);
if (!pvt) {
@@ -1738,7 +1739,7 @@ static struct ast_channel *oh323_request(const char *type, int format, const str
oldformat = format;
format &= AST_FORMAT_AUDIO_MASK;
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);
if (cause)
*cause = AST_CAUSE_INCOMPATIBLE_DESTINATION;
@@ -1841,23 +1842,23 @@ static int receive_digit(unsigned call_reference, char digit, const char *token,
else {
struct ast_frame f = {
.frametype = AST_FRAME_DTMF_END,
- .subclass = digit,
+ .subclass.integer = digit,
.samples = duration * 8,
.len = duration,
.src = "SEND_DIGIT",
};
if (digit == ' ') { /* signalUpdate message */
- f.subclass = pvt->curDTMF;
+ f.subclass.integer = pvt->curDTMF;
AST_SCHED_DEL(sched, pvt->DTMFsched);
} else { /* Regular input or signal message */
if (pvt->DTMFsched >= 0) {
/* We still don't send DTMF END from previous event, send it now */
AST_SCHED_DEL(sched, pvt->DTMFsched);
- f.subclass = pvt->curDTMF;
+ f.subclass.integer = pvt->curDTMF;
f.samples = f.len = 0;
ast_queue_frame(pvt->owner, &f);
/* Restore values */
- f.subclass = digit;
+ f.subclass.integer = digit;
f.samples = duration * 8;
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 */
struct ast_rtp_payload_type rtptype = ast_rtp_codecs_payload_lookup(ast_rtp_instance_get_codecs(pvt->rtp), pt);
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) {
pvt->nativeformats = rtptype.code;
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)) {
/* Re-build translation path only if native format(s) has been changed */
if (pvt->owner->nativeformats != pvt->nativeformats) {
- 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);
+ if (h323debug) {
+ 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;
ast_set_read_format(pvt->owner, pvt->owner->readformat);
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 */
struct oh323_pvt *pvt;
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index d6deac779..1948bc51f 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -352,7 +352,7 @@ static int (*iax2_regfunk)(const char *username, int onoff) = NULL;
static struct io_context *io;
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;
@@ -461,7 +461,7 @@ struct iax2_user {
int amaflags;
int adsi;
uint64_t flags;
- int capability;
+ format_t capability;
int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
int curauthreq; /*!< Current number of outstanding AUTHREQs */
struct ast_codec_pref prefs;
@@ -508,7 +508,7 @@ struct iax2_peer {
int expire; /*!< Schedule entry for expiry */
int expiry; /*!< How soon to expire */
- int capability; /*!< Capability */
+ format_t capability; /*!< Capability */
/* Qualification */
int callno; /*!< Call number of POKE request */
@@ -639,15 +639,15 @@ struct chan_iax2_pvt {
/*! Socket to send/receive on for this call */
int sockfd;
/*! Last received voice format */
- int voiceformat;
+ format_t voiceformat;
/*! Last received video format */
- int videoformat;
+ format_t videoformat;
/*! Last sent voice format */
- int svoiceformat;
+ format_t svoiceformat;
/*! Last sent video format */
- int svideoformat;
+ format_t svideoformat;
/*! What we are capable of sending */
- int capability;
+ format_t capability;
/*! Last received timestamp */
unsigned int last;
/*! 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
chosen for an unauthenticated call so that the channel can get
created later using the right format */
- int chosenformat;
+ format_t chosenformat;
/*! Peer selected format */
- int peerformat;
+ format_t peerformat;
/*! Peer capability */
- int peercapability;
+ format_t peercapability;
/*! timeval that we base our transmission on */
struct timeval offset;
/*! 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_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 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 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);
@@ -1506,18 +1506,18 @@ static int send_lagrq(const void *data)
return 0;
}
-static unsigned char compress_subclass(int subclass)
+static unsigned char compress_subclass(format_t subclass)
{
int x;
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)
return subclass;
/* Otherwise find its power */
for (x = 0; x < IAX_MAX_SHIFT; x++) {
- if (subclass & (1 << x)) {
+ if (subclass & (1LL << x)) {
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;
} else
power = x;
@@ -1526,7 +1526,7 @@ static unsigned char compress_subclass(int subclass)
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 (csub & IAX_FLAG_SC_LOG) {
@@ -1534,7 +1534,7 @@ static int uncompress_subclass(unsigned char csub)
if (csub == 0xff)
return -1;
else
- return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
+ return 1LL << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
}
else
return csub;
@@ -3370,10 +3370,10 @@ static void __attempt_transmit(const void *data)
iax2_destroy(callno);
} else {
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;
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 */
iax2_queue_frame(callno, &fr); /* XXX */
/* Remember, owner could disappear */
@@ -3965,7 +3965,7 @@ static void __get_from_jb(const void *p)
/* create an interpolation frame */
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.src = "IAX2 JB interpolation";
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) {
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) {
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)
{
- 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)
@@ -4384,7 +4384,7 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
}
struct create_addr_info {
- int capability;
+ format_t capability;
uint64_t flags;
int maxtime;
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));
/* Move the calling channel's native codec to the top of the preference list */
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_convert(&ourprefs, cai->prefs, sizeof(cai->prefs), 1);
@@ -4498,7 +4498,7 @@ return_unref:
static void __auto_congest(const void *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]);
if (iaxs[callno]) {
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];
int frametype = f->af.frametype;
- int subclass = f->af.subclass;
+ int subclass = f->af.subclass.integer;
struct {
struct ast_iax2_full_hdr fh;
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);
}
+ /* WARNING: this breaks down at 190 bits! */
iax_ie_append_str(&ied, IAX_IE_CODEC_PREFS, cai.prefs);
if (l) {
@@ -4973,8 +4974,10 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
if (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_CAPABILITY, iaxs[callno]->capability);
+ iax_ie_append_int(&ied, IAX_IE_FORMAT, (int) c->nativeformats);
+ 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_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;
}
if (c0->nativeformats != c1->nativeformats) {
- char buf0[255];
- char buf1[255];
- ast_getformatname_multiple(buf0, sizeof(buf0) -1, c0->nativeformats);
- ast_getformatname_multiple(buf1, sizeof(buf1) -1, c1->nativeformats);
- ast_verb(3, "Operating with different codecs %d[%s] %d[%s] , can't native bridge...\n", c0->nativeformats, buf0, c1->nativeformats, buf1);
+ char buf0[256];
+ char buf1[256];
+ ast_getformatname_multiple(buf0, sizeof(buf0), c0->nativeformats);
+ ast_getformatname_multiple(buf1, sizeof(buf1), c1->nativeformats);
+ ast_verb(3, "Operating with different codecs [%s] [%s] , can't native bridge...\n", buf0, buf1);
/* Remove from native mode */
lock_both(callno0, callno1);
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;
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;
*rc = who;
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 */
-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 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 genuine = 0;
int adjust;
- int rate = ast_format_rate(f->subclass) / 1000;
+ int rate = ast_format_rate(f->subclass.codec) / 1000;
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));
f->frametype = fh->type;
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 {
- f->subclass = uncompress_subclass(fh->csub);
+ f->subclass.integer = uncompress_subclass(fh->csub);
}
} else {
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 */ &&
(f->frametype == AST_FRAME_VOICE)
/* is a voice frame */ &&
- (f->subclass == pvt->svoiceformat)
+ (f->subclass.codec == pvt->svoiceformat)
/* is the same type */ ) {
/* Force immediate rather than delayed transmission */
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
*/
if (((fts & 0xFFFF8000L) == (pvt->lastvsent & 0xFFFF8000L)) &&
- ((f->subclass & ~0x1) == pvt->svideoformat)
+ ((f->subclass.codec & ~0x1LL) == pvt->svideoformat)
) {
now = 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) {
/* 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) {
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;
fh->type = fr->af.frametype & 0xFF;
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
- fh->csub = compress_subclass(fr->af.subclass);
+ fh->csub = compress_subclass(fr->af.subclass.codec);
if (transfer) {
fr->dcallno = pvt->transfercallno;
} 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)
fr->retrytime = MAX_RETRY_TIME;
/* 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;
else if (f->frametype == AST_FRAME_VOICE)
- pvt->svoiceformat = f->subclass;
+ pvt->svoiceformat = f->subclass.codec;
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_KEYPOPULATED)) {
if (fr->transfer)
@@ -6298,11 +6303,11 @@ 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->zeros = 0;
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->data = vh;
fr->retries = -1;
- res = send_packet(fr);
+ res = send_packet(fr);
} else {
/* Mini-frames have no sequence number */
fr->oseqno = -1;
@@ -7213,7 +7218,7 @@ static int __send_command(struct chan_iax2_pvt *i, char type, int command, unsig
int res = 0;
f.frametype = type;
- f.subclass = command;
+ f.subclass.integer = command;
f.datalen = datalen;
f.src = __FUNCTION__;
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;
/* 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]->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");
iax2_vnak(fr->callno);
} else {
- f.subclass = iaxs[fr->callno]->voiceformat;
+ f.subclass.codec = iaxs[fr->callno]->voiceformat;
f.datalen = len;
if (f.datalen >= 0) {
if (f.datalen)
@@ -9568,7 +9573,7 @@ static int socket_process(struct iax2_thread *thread)
struct iax2_peer *peer;
struct iax_ies ies;
struct iax_ie_data ied0, ied1;
- int format;
+ format_t format;
int fd;
int exists;
int minivid = 0;
@@ -9639,17 +9644,19 @@ static int socket_process(struct iax2_thread *thread)
/* Retrieve the type and subclass */
f.frametype = fh->type;
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 {
- f.subclass = uncompress_subclass(fh->csub);
+ f.subclass.integer = uncompress_subclass(fh->csub);
}
/* 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. */
send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohl(fh->ts), fh->iseqno + 1, fd, NULL);
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 */
return 1;
}
@@ -9675,7 +9682,7 @@ static int socket_process(struct iax2_thread *thread)
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 */
if (handle_call_token(fh, &ies, &sin, fd)) {
return 1;
@@ -9694,7 +9701,7 @@ static int socket_process(struct iax2_thread *thread)
} else {
/* Don't know anything about it yet */
f.frametype = AST_FRAME_NULL;
- f.subclass = 0;
+ f.subclass.integer = 0;
}
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
*/
- 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;
}
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);
- } 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);
}
return 1;
@@ -9730,10 +9737,10 @@ static int socket_process(struct iax2_thread *thread)
frame, reply with an inval */
if (ntohs(mh->callno) & IAX_FLAG_FULL) {
/* We can only raw hangup control frames */
- if (((f.subclass != IAX_COMMAND_INVAL) &&
- (f.subclass != IAX_COMMAND_TXCNT) &&
- (f.subclass != IAX_COMMAND_TXACC) &&
- (f.subclass != IAX_COMMAND_FWDOWNL))||
+ if (((f.subclass.integer != IAX_COMMAND_INVAL) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXACC) &&
+ (f.subclass.integer != IAX_COMMAND_FWDOWNL))||
(f.frametype != AST_FRAME_IAX))
raw_hangup(&sin, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, ntohs(mh->callno) & ~IAX_FLAG_FULL,
fd);
@@ -9762,8 +9769,8 @@ static int socket_process(struct iax2_thread *thread)
iaxs[fr->callno]->frames_received++;
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) && !minivid &&
- f.subclass != IAX_COMMAND_TXCNT && /* for attended transfer */
- f.subclass != IAX_COMMAND_TXACC) { /* for attended transfer */
+ f.subclass.integer != IAX_COMMAND_TXCNT && /* for attended transfer */
+ f.subclass.integer != IAX_COMMAND_TXACC) { /* for attended transfer */
unsigned short new_peercallno;
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 (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) */
fr->oseqno = fh->oseqno;
fr->iseqno = fh->iseqno;
@@ -9800,31 +9807,31 @@ static int socket_process(struct iax2_thread *thread)
updatehistory = 0;
if ((iaxs[fr->callno]->iseqno != fr->oseqno) &&
(iaxs[fr->callno]->iseqno ||
- ((f.subclass != IAX_COMMAND_TXCNT) &&
- (f.subclass != IAX_COMMAND_TXREADY) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_TXREL) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_TXACC)) ||
+ ((f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXREADY) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_TXREL) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_TXACC)) ||
(f.frametype != AST_FRAME_IAX))) {
if (
- ((f.subclass != IAX_COMMAND_ACK) &&
- (f.subclass != IAX_COMMAND_INVAL) &&
- (f.subclass != IAX_COMMAND_TXCNT) &&
- (f.subclass != IAX_COMMAND_TXREADY) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_TXREL) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
- (f.subclass != IAX_COMMAND_TXACC) &&
- (f.subclass != IAX_COMMAND_VNAK)) ||
+ ((f.subclass.integer != IAX_COMMAND_ACK) &&
+ (f.subclass.integer != IAX_COMMAND_INVAL) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXREADY) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_TXREL) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_UNQUELCH ) && /* for attended transfer */
+ (f.subclass.integer != IAX_COMMAND_TXACC) &&
+ (f.subclass.integer != IAX_COMMAND_VNAK)) ||
(f.frametype != AST_FRAME_IAX)) {
/* 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",
- 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,
* and take sequence number wraparound into account */
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 ((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");
/* 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 */
@@ -9839,11 +9846,11 @@ static int socket_process(struct iax2_thread *thread)
}
} else {
/* Increment unless it's an ACK or VNAK */
- if (((f.subclass != IAX_COMMAND_ACK) &&
- (f.subclass != IAX_COMMAND_INVAL) &&
- (f.subclass != IAX_COMMAND_TXCNT) &&
- (f.subclass != IAX_COMMAND_TXACC) &&
- (f.subclass != IAX_COMMAND_VNAK)) ||
+ if (((f.subclass.integer != IAX_COMMAND_ACK) &&
+ (f.subclass.integer != IAX_COMMAND_INVAL) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXACC) &&
+ (f.subclass.integer != IAX_COMMAND_VNAK)) ||
(f.frametype != AST_FRAME_IAX))
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
from the real peer, not the transfer peer */
if (!inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
- ((f.subclass != IAX_COMMAND_INVAL) ||
+ ((f.subclass.integer != IAX_COMMAND_INVAL) ||
(f.frametype != AST_FRAME_IAX))) {
unsigned char x;
int call_to_destroy;
@@ -9906,8 +9913,8 @@ static int socket_process(struct iax2_thread *thread)
}
if (inaddrcmp(&sin, &iaxs[fr->callno]->addr) &&
((f.frametype != AST_FRAME_IAX) ||
- ((f.subclass != IAX_COMMAND_TXACC) &&
- (f.subclass != IAX_COMMAND_TXCNT)))) {
+ ((f.subclass.integer != IAX_COMMAND_TXACC) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT)))) {
/* Only messages we accept from a transfer host are TXACC and TXCNT */
ast_mutex_unlock(&iaxsl[fr->callno]);
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
* 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]);
}
if (f.frametype == AST_FRAME_VOICE) {
- if (f.subclass != iaxs[fr->callno]->voiceformat) {
- iaxs[fr->callno]->voiceformat = f.subclass;
- ast_debug(1, "Ooh, voice format changed to %d\n", f.subclass);
+ if (f.subclass.codec != iaxs[fr->callno]->voiceformat) {
+ iaxs[fr->callno]->voiceformat = f.subclass.codec;
+ ast_debug(1, "Ooh, voice format changed to '%s'\n", ast_getformatname(f.subclass.codec));
if (iaxs[fr->callno]->owner) {
- int orignative;
+ format_t orignative;
retryowner:
if (ast_channel_trylock(iaxs[fr->callno]->owner)) {
DEADLOCK_AVOIDANCE(&iaxsl[fr->callno]);
@@ -10005,7 +10012,7 @@ retryowner:
if (iaxs[fr->callno]) {
if (iaxs[fr->callno]->owner) {
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)
ast_set_read_format(iaxs[fr->callno]->owner, iaxs[fr->callno]->owner->readformat);
iaxs[fr->callno]->owner->nativeformats = orignative;
@@ -10026,15 +10033,15 @@ retryowner:
}
}
if (f.frametype == AST_FRAME_VIDEO) {
- if (f.subclass != iaxs[fr->callno]->videoformat) {
- ast_debug(1, "Ooh, video format changed to %d\n", f.subclass & ~0x1);
- iaxs[fr->callno]->videoformat = f.subclass & ~0x1;
+ if (f.subclass.codec != iaxs[fr->callno]->videoformat) {
+ ast_debug(1, "Ooh, video format changed to %s\n", ast_getformatname(f.subclass.codec & ~0x1LL));
+ iaxs[fr->callno]->videoformat = f.subclass.codec & ~0x1LL;
}
}
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;
- } else if (f.subclass == AST_CONTROL_CONGESTION) {
+ } else if (f.subclass.integer == AST_CONTROL_CONGESTION) {
iaxs[fr->callno]->owner->hangupcause = AST_CAUSE_CONGESTION;
}
}
@@ -10042,22 +10049,22 @@ retryowner:
ast_sched_thread_del(sched, iaxs[fr->callno]->initid);
/* Handle the IAX pseudo frame itself */
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. */
if (iaxs[fr->callno]->last < fr->ts &&
- f.subclass != IAX_COMMAND_ACK &&
- f.subclass != IAX_COMMAND_PONG &&
- f.subclass != IAX_COMMAND_LAGRP) {
+ f.subclass.integer != IAX_COMMAND_ACK &&
+ f.subclass.integer != IAX_COMMAND_PONG &&
+ f.subclass.integer != IAX_COMMAND_LAGRP) {
iaxs[fr->callno]->last = fr->ts;
if (iaxdebug)
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) {
- 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:
/* Do nothing */
break;
@@ -10237,10 +10244,19 @@ retryowner:
return 1;
}
if (authdebug) {
- 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);
- else
- 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);
+ char tmp[256], tmp2[256], tmp3[256];
+ if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
+ ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%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]->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 {
/* Pick one... */
@@ -10271,17 +10287,23 @@ retryowner:
}
if (!format) {
+ char tmp[256], tmp2[256], tmp3[256];
memset(&ied0, 0, sizeof(ied0));
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
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);
if (!iaxs[fr->callno]) {
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
- 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);
+ if (authdebug) {
+ 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);
break;
}
@@ -10456,8 +10478,13 @@ retryowner:
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
}
- 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);
+ if (authdebug) {
+ 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 {
ast_set_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED);
if (iaxs[fr->callno]->owner) {
@@ -10565,9 +10592,9 @@ retryowner2:
f.offset = 0;
f.samples = 0;
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 */
- 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);
} else {
/* 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)) {
struct ast_frame hangup_fr = { .frametype = AST_FRAME_CONTROL,
- .subclass = AST_CONTROL_HANGUP,
+ .subclass.integer = AST_CONTROL_HANGUP,
};
ast_log(LOG_WARNING,
"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);
}
if (!format) {
+ char tmp1[256], tmp2[256], tmp3[256];
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;
}
if (!format) {
if (authdebug) {
- 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);
- else
- 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);
+ if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
+ ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%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 {
+ 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));
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
@@ -10709,12 +10746,22 @@ retryowner2:
}
}
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(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);
- else
- 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);
+ if (ast_test_flag64(iaxs[fr->callno], IAX_CODEC_NOCAP)) {
+ ast_log(LOG_NOTICE, "Rejected connect attempt from %s, requested '%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 {
+ 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));
iax_ie_append_str(&ied0, IAX_IE_CAUSE, "Unable to negotiate codec");
@@ -10818,8 +10865,11 @@ immediatedial:
return 1;
}
} else {
+ char tmp[256];
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);
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)))
@@ -10894,7 +10944,7 @@ immediatedial:
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)) {
- if (f.subclass == IAX_COMMAND_REGREL)
+ if (f.subclass.integer == IAX_COMMAND_REGREL)
memset(&sin, 0, sizeof(sin));
if (update_registry(&sin, fr->callno, ies.devicetype, fd, ies.refresh))
ast_log(LOG_WARNING, "Registry error\n");
@@ -11085,9 +11135,9 @@ immediatedial:
break;
}
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));
- 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);
}
/* Free remote variables (if any) */
@@ -11098,11 +11148,11 @@ immediatedial:
}
/* Don't actually pass these frames along */
- if ((f.subclass != IAX_COMMAND_ACK) &&
- (f.subclass != IAX_COMMAND_TXCNT) &&
- (f.subclass != IAX_COMMAND_TXACC) &&
- (f.subclass != IAX_COMMAND_INVAL) &&
- (f.subclass != IAX_COMMAND_VNAK)) {
+ if ((f.subclass.integer != IAX_COMMAND_ACK) &&
+ (f.subclass.integer != IAX_COMMAND_TXCNT) &&
+ (f.subclass.integer != IAX_COMMAND_TXACC) &&
+ (f.subclass.integer != IAX_COMMAND_INVAL) &&
+ (f.subclass.integer != IAX_COMMAND_VNAK)) {
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);
}
@@ -11115,7 +11165,7 @@ immediatedial:
} else if (minivid) {
f.frametype = AST_FRAME_VIDEO;
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 {
ast_log(LOG_WARNING, "Received mini frame before first full video frame\n");
iax2_vnak(fr->callno);
@@ -11137,7 +11187,7 @@ immediatedial:
/* A mini frame */
f.frametype = AST_FRAME_VOICE;
if (iaxs[fr->callno]->voiceformat > 0)
- f.subclass = iaxs[fr->callno]->voiceformat;
+ f.subclass.codec = iaxs[fr->callno]->voiceformat;
else {
ast_debug(1, "Received mini frame before first full voice frame\n");
iax2_vnak(fr->callno);
@@ -11168,7 +11218,7 @@ immediatedial:
return 1;
}
/* 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;
if (!ast_test_flag64(iaxs[fr->callno], IAX_RECVCONNECTEDLINE)) {
@@ -11200,7 +11250,7 @@ immediatedial:
if (f.datalen && (f.frametype == AST_FRAME_VOICE)) {
f.samples = ast_codec_get_samples(&f);
/* 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);
} else
f.samples = 0;
@@ -11212,7 +11262,7 @@ immediatedial:
fr->outoforder = 0;
} else {
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->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 res;
- int fmt, native;
+ format_t fmt, native;
struct sockaddr_in sin;
struct ast_channel *c;
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)
{
struct ast_config *cfg, *ucfg;
- int capability=iax2_capability;
+ format_t capability = iax2_capability;
struct ast_variable *v;
char *cat;
const char *utype;
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index 1461b83c7..c1181dbfe 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -103,7 +103,7 @@ struct jingle_pvt {
iksrule *ringrule; /*!< Rule for matching RING request */
int initiator; /*!< If we're the initiator */
int alreadygone;
- int capability;
+ format_t capability;
struct ast_codec_pref prefs;
struct jingle_candidate *theircandidates;
struct jingle_candidate *ourcandidates;
@@ -115,8 +115,8 @@ struct jingle_pvt {
struct ast_rtp_instance *rtp; /*!< RTP audio session */
char video_content_name[100]; /*!< name attribute of content tag */
struct ast_rtp_instance *vrtp; /*!< RTP video session */
- int jointcapability; /*!< Supported capability at both ends (codecs ) */
- int peercapability;
+ format_t jointcapability; /*!< Supported capability at both ends (codecs ) */
+ format_t peercapability;
struct jingle_pvt *next; /* Next entity */
};
@@ -146,7 +146,7 @@ struct jingle {
char user[100];
char context[100];
char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */
- int capability;
+ format_t capability;
ast_group_t callgroup; /*!< Call group */
ast_group_t pickupgroup; /*!< Pickup group */
int callingpres; /*!< Calling presentation */
@@ -163,12 +163,12 @@ struct jingle_container {
static const char desc[] = "Jingle Channel";
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) */
/* 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_digit_begin(struct ast_channel *ast, char digit);
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;
iks *iq, *jingle, *dcodecs, *payload_red, *payload_audio, *payload_cn;
int x;
- int pref_codec = 0;
+ format_t pref_codec = 0;
int alreadysent = 0;
if (p->initiator)
@@ -312,7 +312,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
if (iq && jingle && dcodecs) {
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)))
break;
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;
}
-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;
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;
@@ -511,19 +511,19 @@ static int jingle_handle_dtmf(struct jingle *client, ikspak *pak)
if((dtmf = iks_find_attrib(dtmfnode, "code"))) {
if(iks_find_with_attrib(pak->x, "dtmf", "action", "button-up")) {
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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")) {
struct ast_frame f = {AST_FRAME_DTMF_END, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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 */
struct ast_frame f = {AST_FRAME_DTMF, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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"))) {
@@ -531,14 +531,14 @@ static int jingle_handle_dtmf(struct jingle *client, ikspak *pak)
if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
struct ast_frame f = {AST_FRAME_DTMF_END, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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")) {
struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
- f.subclass = dtmf[0];
+ f.subclass.integer = dtmf[0];
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) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+ if (f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
+ ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
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_write_format(p->owner, p->owner->writeformat);
}
/* if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_INBAND) && p->vad) {
f = ast_dsp_process(p->owner, p->vad, f);
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;
int res = 0;
+ char buf[256];
switch (frame->frametype) {
case AST_FRAME_VOICE:
- 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",
- frame->subclass, ast->nativeformats, ast->readformat,
- ast->writeformat);
+ "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 0;
}
if (p) {
@@ -1479,7 +1482,7 @@ static int jingle_hangup(struct ast_channel *ast)
}
/*! \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 *client = NULL;
diff --git a/channels/chan_local.c b/channels/chan_local.c
index c699a5cba..f26084b49 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -60,7 +60,7 @@ static struct ast_jb_conf g_jb_conf = {
.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_end(struct ast_channel *ast, char digit, unsigned int duration);
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);
if (isoutbound) {
/* 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);
} else
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 {
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;
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 1))) {
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 */
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
- f.subclass = condition;
+ f.subclass.integer = condition;
f.data.ptr = (void*)data;
f.datalen = datalen;
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);
isoutbound = IS_OUTBOUND(ast, p);
- f.subclass = digit;
+ f.subclass.integer = digit;
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
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);
isoutbound = IS_OUTBOUND(ast, p);
- f.subclass = digit;
+ f.subclass.integer = digit;
f.len = duration;
if (!(res = local_queue_frame(p, isoutbound, &f, ast, 0)))
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);
isoutbound = IS_OUTBOUND(ast, p);
- f.subclass = subclass;
+ f.subclass.integer = subclass;
f.data.ptr = (char *)data;
f.datalen = datalen;
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;
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;
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 */
-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 ast_channel *chan = NULL;
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index a03de42c3..e3cc64e98 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -216,7 +216,7 @@ static pthread_t monitor_thread = AST_PTHREADT_NULL;
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 char ourhost[MAXHOSTNAMELEN];
@@ -355,7 +355,7 @@ struct mgcp_endpoint {
int iseq; /*!< Not used? */
int lastout; /*!< tracking this on the subchannels. Is it needed here? */
int needdestroy; /*!< Not used? */
- int capability;
+ format_t capability;
int nonCodecCapability;
int onhooktime;
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_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_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_audit_endpoint(struct mgcp_endpoint *p);
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 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_hangup(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)
{
- struct ast_frame f = { AST_FRAME_CONTROL, };
- f.subclass = control;
+ struct ast_frame f = { AST_FRAME_CONTROL, { control } };
return mgcp_queue_frame(sub, &f);
}
@@ -1194,9 +1193,9 @@ static struct ast_frame *mgcp_rtp_read(struct mgcp_subchannel *sub)
if (sub->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (f->subclass != sub->owner->nativeformats) {
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
- sub->owner->nativeformats = f->subclass;
+ if (f->subclass.codec != sub->owner->nativeformats) {
+ ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
+ sub->owner->nativeformats = f->subclass.codec;
ast_set_read_format(sub->owner, sub->owner->readformat);
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;
int res = 0;
+ char buf[256];
+
if (frame->frametype != AST_FRAME_VOICE) {
if (frame->frametype == AST_FRAME_IMAGE)
return 0;
@@ -1235,9 +1236,12 @@ static int mgcp_write(struct ast_channel *ast, struct ast_frame *frame)
return 0;
}
} else {
- if (!(frame->subclass & ast->nativeformats)) {
- ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
- frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
+ if (!(frame->subclass.codec & ast->nativeformats)) {
+ 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; */
}
}
@@ -1911,13 +1915,15 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req)
char host[258];
int len;
int portno;
- int peercapability, peerNonCodecCapability;
+ format_t peercapability;
+ int peerNonCodecCapability;
struct sockaddr_in sin;
char *codecs;
struct ast_hostent ahp; struct hostent *hp;
int codec, codec_count=0;
int iterator;
struct mgcp_endpoint *p = sub->parent;
+ char tmp1[256], tmp2[256], tmp3[256];
/* Get codec and RTP info from SDP */
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: */
ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), &peercapability, &peerNonCodecCapability);
p->capability = capability & peercapability;
- ast_debug(1, "Capabilities: us - %d, them - %d, combined - %d\n",
- capability, peercapability, p->capability);
+ ast_debug(1, "Capabilities: us - %s, them - %s, combined - %s\n",
+ 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",
nonCodecCapability, peerNonCodecCapability, p->nonCodecCapability);
if (!p->capability) {
@@ -2131,7 +2139,7 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
char t[256];
char m[256] = "";
char a[1024] = "";
- int x;
+ format_t x;
struct sockaddr_in dest = { 0, };
struct mgcp_endpoint *p = sub->parent;
/* 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));
ast_copy_string(t, "t=0 0\r\n", sizeof(t));
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) {
- 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);
if (codec > -1) {
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) {
- 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);
if (codec > -1) {
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;
}
-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;
char local[256];
char tmp[80];
struct mgcp_endpoint *p = sub->parent;
- int x;
+ format_t x;
if (ast_strlen_zero(sub->cxident) && rtp) {
/* 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));
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
+ if (!(x & AST_FORMAT_AUDIO_MASK)) {
+ /* No longer contiguous */
+ continue;
+ }
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
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));
for (x = 1; x <= AST_FORMAT_AUDIO_MASK; x <<= 1) {
+ if (!(x & AST_FORMAT_AUDIO_MASK)) {
+ /* No longer contiguous */
+ continue;
+ }
if (p->capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
strncat(local, tmp, sizeof(local) - strlen(local) - 1);
@@ -2352,12 +2372,12 @@ static int transmit_connect(struct mgcp_subchannel *sub)
struct mgcp_request resp;
char local[256];
char tmp[80];
- int x;
+ format_t x;
struct mgcp_endpoint *p = sub->parent;
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) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype2(1, x, 0));
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_endpoint *p = sub->parent;
- int x, fc;
+ format_t x;
+ int fc = 1;
char local[256];
char tmp[80];
@@ -3468,7 +3489,7 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
(ev[0] == '*') || (ev[0] == '#'))) {
if (sub && sub->owner && (sub->owner->_state >= AST_STATE_UP)) {
f.frametype = AST_FRAME_DTMF;
- f.subclass = ev[0];
+ f.subclass.integer = ev[0];
f.src = "mgcp";
/* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
mgcp_queue_frame(sub, &f);
@@ -3825,9 +3846,9 @@ static int restart_monitor(void)
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 ast_channel *tmpc = NULL;
char tmp[256];
@@ -3836,7 +3857,7 @@ static struct ast_channel *mgcp_request(const char *type, int format, const stru
oldformat = format;
format &= capability;
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;*/
}
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;
}
-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 */
struct mgcp_subchannel *sub;
@@ -4327,7 +4348,7 @@ static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *
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_endpoint *p = sub->parent;
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 3adcf7b75..fdf4cf2fd 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -6977,9 +6977,9 @@ static struct ast_frame *process_ast_dsp(struct chan_list *tmp, struct ast_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 */
if (!tmp->faxhandled) {
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')) {
- chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass);
+ if (tmp->ast_dsp && (f->subclass.integer != 'f')) {
+ chan_misdn_log(2, tmp->bc->port, " --> * SEND: DTMF (AST_DSP) :%c\n", f->subclass.integer);
}
return f;
@@ -7084,7 +7084,7 @@ static struct ast_frame *misdn_read(struct ast_channel *ast)
}
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.samples = len;
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");
return 0;
}
- if (!(frame->subclass & prefformat)) {
- chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%d\n", frame->subclass);
+ if (!(frame->subclass.codec & prefformat)) {
+ chan_misdn_log(-1, ch->bc->port, "Got Unsupported Frame with Format:%s\n", ast_getformatname(frame->subclass.codec));
return 0;
}
@@ -7301,7 +7301,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
if (!f) {
chan_misdn_log(4, ch1->bc->port, "Read Null Frame\n");
} 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;
@@ -7310,7 +7310,7 @@ static enum ast_bridge_result misdn_bridge(struct ast_channel *c0,
}
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;
*rc = who;
@@ -7437,7 +7437,7 @@ static struct chan_list *init_chan_list(int orig)
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;
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)) {
fr.frametype = AST_FRAME_DTMF;
- fr.subclass = *predial;
+ fr.subclass.integer = *predial;
fr.src = NULL;
fr.data.ptr = NULL;
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));
fr.frametype = AST_FRAME_DTMF;
- fr.subclass = bc->dtmf ;
+ fr.subclass.integer = bc->dtmf ;
fr.src = NULL;
fr.data.ptr = NULL;
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));
fr.frametype = AST_FRAME_DTMF;
- fr.subclass = bc->info_dad[0] ;
+ fr.subclass.integer = bc->info_dad[0] ;
fr.src = NULL;
fr.data.ptr = NULL;
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 */
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.samples = bc->bframe_len;
frame.mallocd = 0;
diff --git a/channels/chan_multicast_rtp.c b/channels/chan_multicast_rtp.c
index d2bbc6875..24c073215 100644
--- a/channels/chan_multicast_rtp.c
+++ b/channels/chan_multicast_rtp.c
@@ -52,7 +52,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static const char tdesc[] = "Multicast RTP Paging Channel Driver";
/* 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_hangup(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 */
-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;
struct ast_rtp_instance *instance;
struct sockaddr_in control_address = { .sin_family = AF_INET, }, destination_address = { .sin_family = AF_INET, };
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 (ast_strlen_zero(multicast_type)) {
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index d7b6cc3f4..6e1fff8aa 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -325,7 +325,7 @@ static struct chan_oss_pvt oss_default = {
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);
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);
@@ -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)
{
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_APP_ARG(name);
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);
if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) {
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_ANSWER;
+ f.subclass.integer = AST_CONTROL_ANSWER;
ast_queue_frame(c, &f);
} else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) {
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_RINGING;
+ f.subclass.integer = AST_CONTROL_RINGING;
ast_queue_frame(c, &f);
ast_indicate(c, AST_CONTROL_RINGING);
} else if (o->autoanswer) {
ast_verbose(" << Auto-answered >> \n");
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_ANSWER;
+ f.subclass.integer = AST_CONTROL_ANSWER;
ast_queue_frame(c, &f);
o->hookstate = 1;
} else {
ast_verbose("<< Type 'answer' to answer, or use 'autoanswer' for future calls >> \n");
- f.frametype = AST_FRAME_CONTROL;
- f.subclass = AST_CONTROL_RINGING;
+ f.subclass.integer = AST_CONTROL_RINGING;
ast_queue_frame(c, &f);
ast_indicate(c, AST_CONTROL_RINGING);
}
@@ -717,7 +713,7 @@ static struct ast_frame *oss_read(struct ast_channel *c)
return f;
/* ok we can build and deliver the frame to the caller */
f->frametype = AST_FRAME_VOICE;
- f->subclass = AST_FORMAT_SLINEAR;
+ f->subclass.codec = AST_FORMAT_SLINEAR;
f->samples = FRAME_SIZE;
f->datalen = FRAME_SIZE * 2;
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;
}
-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 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);
);
char *parse = ast_strdupa(data);
+ char buf[256];
AST_NONSTANDARD_APP_ARGS(args, parse, '/');
o = find_desc(args.name);
@@ -844,7 +841,7 @@ static struct ast_channel *oss_request(const char *type, int format, const struc
return NULL;
}
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;
}
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 */
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);
if (!o->owner) {
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);
buf[i] = '\n';
f.frametype = AST_FRAME_TEXT;
- f.subclass = 0;
+ f.subclass.integer = 0;
f.data.ptr = buf;
f.datalen = i + 1;
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)
{
- 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);
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;
if (o->owner) { /* already in a call */
int i;
- struct ast_frame f = { AST_FRAME_DTMF, 0 };
+ struct ast_frame f = { AST_FRAME_DTMF, { 0 } };
const char *s;
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];
/* send the string one char at a time */
for (i = 0; i < strlen(s); i++) {
- f.subclass = s[i];
+ f.subclass.integer = s[i];
ast_queue_frame(o->owner, &f);
}
return CLI_SUCCESS;
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index 736fb2708..b84c39c9f 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -125,8 +125,8 @@ static struct phone_pvt {
int fd; /* Raw file descriptor for this device */
struct ast_channel *owner; /* Channel we belong to, possibly NULL */
int mode; /* Is this in the */
- int lastformat; /* Last output format */
- int lastinput; /* Last input format */
+ format_t lastformat; /* Last output format */
+ format_t lastinput; /* Last input format */
int ministate; /* Miniature state, for dialtone mode */
char dev[256]; /* Device name */
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_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_end(struct ast_channel *ast, char digit, unsigned int duration);
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) {
p->lastinput = ast->rawreadformat;
if (ioctl(p->fd, PHONE_REC_CODEC, ast->rawreadformat)) {
- ast_log(LOG_WARNING, "Failed to set codec to %d\n",
- ast->rawreadformat);
+ ast_log(LOG_WARNING, "Failed to set codec to %s\n",
+ ast_getformatname(ast->rawreadformat));
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 */
digit = ioctl(p->fd, PHONE_GET_DTMF_ASCII);
- p->fr.subclass = digit;
+ p->fr.subclass.integer = digit;
p->fr.frametype = AST_FRAME_DTMF;
return &p->fr;
}
@@ -521,7 +521,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
if (ast->_state == AST_STATE_RINGING) {
/* They've picked up the phone */
p->fr.frametype = AST_FRAME_CONTROL;
- p->fr.subclass = AST_CONTROL_ANSWER;
+ p->fr.subclass.integer = AST_CONTROL_ANSWER;
phone_setup(ast);
ast_setstate(ast, AST_STATE_UP);
return &p->fr;
@@ -540,7 +540,7 @@ static struct ast_frame *phone_exception(struct ast_channel *ast)
#endif
/* Strange -- nothing there.. */
p->fr.frametype = AST_FRAME_NULL;
- p->fr.subclass = 0;
+ p->fr.subclass.integer = 0;
return &p->fr;
}
@@ -594,10 +594,10 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
AST_FRAME_VOICE :
p->lastinput <= AST_FORMAT_PNG ? AST_FRAME_IMAGE
: AST_FRAME_VIDEO;
- p->fr.subclass = p->lastinput;
+ p->fr.subclass.codec = p->lastinput;
p->fr.offset = AST_FRIENDLY_OFFSET;
/* 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);
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);
return 0;
}
- if (!(frame->subclass &
+ if (!(frame->subclass.codec &
(AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_G729A)) &&
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;
}
#if 0
@@ -677,7 +677,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
return 0;
}
#endif
- if (frame->subclass == AST_FORMAT_G729A) {
+ if (frame->subclass.codec == AST_FORMAT_G729A) {
if (p->lastformat != AST_FORMAT_G729A) {
ioctl(p->fd, PHONE_PLAY_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;
}
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) {
ioctl(p->fd, PHONE_PLAY_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;
}
maxfr = 24;
- } else if (frame->subclass == AST_FORMAT_SLINEAR) {
+ } else if (frame->subclass.codec == AST_FORMAT_SLINEAR) {
if (p->lastformat != AST_FORMAT_SLINEAR) {
ioctl(p->fd, PHONE_PLAY_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;
}
maxfr = 480;
- } else if (frame->subclass == AST_FORMAT_ULAW) {
+ } else if (frame->subclass.codec == AST_FORMAT_ULAW) {
if (p->lastformat != AST_FORMAT_ULAW) {
ioctl(p->fd, PHONE_PLAY_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;
} else {
- if (p->lastformat != frame->subclass) {
+ if (p->lastformat != frame->subclass.codec) {
ioctl(p->fd, PHONE_PLAY_STOP);
ioctl(p->fd, PHONE_REC_STOP);
- if (ioctl(p->fd, PHONE_PLAY_CODEC, frame->subclass)) {
- ast_log(LOG_WARNING, "Unable to set %d mode\n",
- frame->subclass);
+ if (ioctl(p->fd, PHONE_PLAY_CODEC, (int) frame->subclass.codec)) {
+ ast_log(LOG_WARNING, "Unable to set %s mode\n",
+ ast_getformatname(frame->subclass.codec));
return -1;
}
- if (ioctl(p->fd, PHONE_REC_CODEC, frame->subclass)) {
- ast_log(LOG_WARNING, "Unable to set %d mode\n",
- frame->subclass);
+ if (ioctl(p->fd, PHONE_REC_CODEC, (int) frame->subclass.codec)) {
+ ast_log(LOG_WARNING, "Unable to set %s mode\n",
+ ast_getformatname(frame->subclass.codec));
return -1;
}
- p->lastformat = frame->subclass;
- p->lastinput = frame->subclass;
+ p->lastformat = frame->subclass.codec;
+ p->lastinput = frame->subclass.codec;
codecset = 1;
/* Reset output buffer */
p->obuflen = 0;
@@ -816,7 +816,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
} else {
int swap = 0;
#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 */
#endif
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;
}
-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 ast_channel *tmp = NULL;
char *name = data;
@@ -1245,7 +1245,8 @@ static struct ast_channel *phone_request(const char *type, int format, const str
oldformat = format;
format &= (AST_FORMAT_G729A | AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW);
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;
}
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 8934c1a97..438df8f33 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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_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_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
/*@}*/
@@ -1215,7 +1215,7 @@ struct sip_settings {
char default_context[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 */
- int capability; /*!< Supported codecs */
+ format_t capability; /*!< Supported codecs */
};
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 reqsipoptions; /*!< Required SIP options on the other end */
struct ast_codec_pref prefs; /*!< codec prefs */
- int capability; /*!< Special capability (codec) */
- int jointcapability; /*!< Supported capability at both ends (codecs) */
- int peercapability; /*!< Supported peer capability */
- int prefcodec; /*!< Preferred codec (outbound only) */
+ format_t capability; /*!< Special capability (codec) */
+ format_t jointcapability; /*!< Supported capability at both ends (codecs) */
+ format_t peercapability; /*!< Supported peer capability */
+ format_t prefcodec; /*!< Preferred codec (outbound only) */
int noncodeccapability; /*!< DTMF RFC2833 telephony-event */
int jointnoncodeccapability; /*!< Joint Non codec capability */
- int redircodecs; /*!< Redirect codecs */
+ format_t redircodecs; /*!< Redirect codecs */
int maxcallbitrate; /*!< Maximum Call Bitrate for Video Calls */
int t38_maxdatagram; /*!< T.38 FaxMaxDatagram override */
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 expire; /*!< When to expire this peer registration */
- int capability; /*!< Codec capability */
+ format_t capability; /*!< Codec capability */
int rtptimeout; /*!< RTP timeout */
int rtpholdtimeout; /*!< RTP Hold Timeout */
int rtpkeepalive; /*!< Send RTP packets for keepalive */
@@ -2408,7 +2408,7 @@ enum t38_action_flag {
in coming releases. */
/*--- 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_sendtext(struct ast_channel *ast, const char *text);
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 int find_sdp(struct sip_request *req);
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,
int debug, int *min_packet_size);
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);
/*------- 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 */
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 */
static void try_suggested_sip_codec(struct sip_pvt *p)
{
- int fmt;
+ format_t fmt;
const char *codec;
struct ast_channel* chan;
@@ -6526,16 +6526,13 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
switch (frame->frametype) {
case AST_FRAME_VOICE:
- if (!(frame->subclass & ast->nativeformats)) {
+ if (!(frame->subclass.codec & ast->nativeformats)) {
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",
- frame->subclass,
- ast_getformatname_multiple(s1, sizeof(s1) - 1, ast->nativeformats & AST_FORMAT_AUDIO_MASK),
- ast->nativeformats & AST_FORMAT_AUDIO_MASK,
- ast_getformatname_multiple(s2, sizeof(s2) - 1, ast->readformat),
- ast->readformat,
- ast_getformatname_multiple(s3, sizeof(s3) - 1, ast->writeformat),
- 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(s1, sizeof(s1), ast->nativeformats & AST_FORMAT_AUDIO_MASK),
+ ast_getformatname_multiple(s2, sizeof(s2), ast->readformat),
+ ast_getformatname_multiple(s3, sizeof(s3), ast->writeformat));
return 0;
}
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_variable *v = NULL;
- int fmt;
- int what;
- int video;
- int text;
- int needvideo = 0;
+ format_t fmt;
+ format_t what;
+ format_t video;
+ format_t text;
+ format_t needvideo = 0;
int needtext = 0;
char buf[SIPBUFSIZE];
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 */
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_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;
}
@@ -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))
return f;
- if (f && f->subclass != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
- if (!(f->subclass & p->jointcapability)) {
+ if (f && f->subclass.codec != (p->owner->nativeformats & AST_FORMAT_AUDIO_MASK)) {
+ if (!(f->subclass.codec & p->jointcapability)) {
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;
}
- ast_debug(1, "Oooh, format changed to %d %s\n",
- f->subclass, ast_getformatname(f->subclass));
- p->owner->nativeformats = (p->owner->nativeformats & (AST_FORMAT_VIDEO_MASK | AST_FORMAT_TEXT_MASK)) | f->subclass;
+ ast_debug(1, "Oooh, format changed to %s\n",
+ ast_getformatname(f->subclass.codec));
+ 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_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) {
f = ast_dsp_process(p->owner, p->dsp, f);
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);
*faxdetect = 1;
} 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;
/* Peer capability is the capability in the SDP, non codec is RFC2833 DTMF (101) */
- int peercapability = 0, peernoncodeccapability = 0;
- int vpeercapability = 0, vpeernoncodeccapability = 0;
- int tpeercapability = 0, tpeernoncodeccapability = 0;
+ format_t peercapability = 0, vpeercapability = 0, tpeercapability = 0;
+ int peernoncodeccapability = 0, vpeernoncodeccapability = 0, tpeernoncodeccapability = 0;
struct sockaddr_in sin; /*!< media socket address */
struct sockaddr_in vsin; /*!< Video 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 numberofports;
struct ast_rtp_codecs newaudiortp, newvideortp, newtextrtp;
- int newjointcapability; /* Negotiated capability */
- int newpeercapability;
+ format_t newjointcapability; /* Negotiated capability */
+ format_t newpeercapability;
int newnoncodeccapability;
int numberofmediastreams = 0;
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 */
continue;
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_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 */
-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,
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)
- 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)
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)
{
int len = 0;
- int alreadysent = 0;
+ format_t alreadysent = 0;
struct sockaddr_in sin = { 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_modem = ast_str_alloca(1024); /* Attributes for modem */
- int x;
- int capability = 0;
+ format_t x;
+ format_t capability = 0;
int needaudio = FALSE;
int needvideo = 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
*/
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);
alreadysent |= codec;
}
/* Start by sending our preferred audio/video codecs */
- for (x = 0; x < 32; x++) {
- int codec;
+ for (x = 0; x < 64; x++) {
+ format_t codec;
if (!(codec = ast_codec_pref_index(&p->prefs, x)))
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: */
- 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 */
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 */
- for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
+ for (x = 1LL; x <= AST_RTP_MAX; x <<= 1) {
if (!(p->jointnoncodeccapability & x))
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);
memset(&f, 0, sizeof(f));
f.frametype = AST_FRAME_TEXT;
- f.subclass = 0;
+ f.subclass.integer = 0;
f.offset = 0;
f.data.ptr = 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 */
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);
if (!codec)
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_variable *v;
struct sip_auth *auth;
- int x = 0, codec = 0, load_realtime;
+ int x = 0, load_realtime;
+ format_t codec = 0;
int realtimepeers;
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, "CodecOrder: ");
pref = &peer->prefs;
- for(x = 0; x < 32 ; x++) {
+ for(x = 0; x < 64 ; x++) {
codec = ast_codec_pref_index(pref, x);
if (!codec)
break;
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, ",");
}
@@ -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, " 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, " 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, " Their Codec Capability: %d\n", cur->peercapability);
- ast_cli(a->fd, " Joint Codec Capability: %d\n", cur->jointcapability);
+ ast_cli(a->fd, " Their Codec Capability: %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercapability));
+ 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, " T.38 support %s\n", cli_yesno(cur->udptl != 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);
if (event == 16) {
/* 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);
if (sipdebug)
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 */
struct ast_frame f = { AST_FRAME_DTMF, };
if (event < 10) {
- f.subclass = '0' + event;
- } else if (event < 11) {
- f.subclass = '*';
- } else if (event < 12) {
- f.subclass = '#';
+ f.subclass.integer = '0' + event;
+ } else if (event == 10) {
+ f.subclass.integer = '*';
+ } else if (event == 11) {
+ f.subclass.integer = '#';
} else if (event < 16) {
- f.subclass = 'A' + (event - 12);
+ f.subclass.integer = 'A' + (event - 12);
}
f.len = duration;
ast_queue_frame(p->owner, &f);
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);
return;
@@ -17221,7 +17219,7 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
event = atoi(buf);
if (event == 16) {
/* 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);
if (sipdebug)
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 */
struct ast_frame f = { AST_FRAME_DTMF, };
if (event < 10) {
- f.subclass = '0' + event;
- } else if (event < 11) {
- f.subclass = '*';
- } else if (event < 12) {
- f.subclass = '#';
+ f.subclass.integer = '0' + event;
+ } else if (event == 10) {
+ f.subclass.integer = '*';
+ } else if (event == 11) {
+ f.subclass.integer = '#';
} else if (event < 16) {
- f.subclass = 'A' + (event - 12);
+ f.subclass.integer = 'A' + (event - 12);
}
f.len = duration;
ast_queue_frame(p->owner, &f);
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);
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 */
f.len = 100;
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);
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();
@@ -17866,7 +17864,7 @@ static int function_sippeer(struct ast_channel *chan, const char *cmd, char *dat
}
} else if (!strncasecmp(colname, "codec[", 6)) {
char *codecnum;
- int codec = 0;
+ format_t codec = 0;
codecnum = colname + 6; /* move past the '[' */
codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */
@@ -23955,7 +23953,7 @@ static int sip_devicestate(void *data)
* or SIP/host!dnid
* \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 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 *trans = NULL;
enum sip_transport transport = 0;
- int oldformat = format;
+ format_t oldformat = format;
/* mask request with some set of allowed formats.
* 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;
}
-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;
int changed = 0;
@@ -26321,7 +26319,7 @@ static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *i
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;
return p->peercapability ? p->peercapability : p->capability;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 011db2046..354414e23 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -141,7 +141,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
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;
enum skinny_codecs {
@@ -1229,9 +1229,9 @@ struct skinny_subchannel {
int instance; \
int group; \
int needdestroy; \
- int confcapability; \
+ format_t confcapability; \
struct ast_codec_pref confprefs; \
- int capability; \
+ format_t capability; \
struct ast_codec_pref prefs; \
int nonCodecCapability; \
int onhooktime; \
@@ -1309,9 +1309,9 @@ struct skinny_addon {
int registered; \
int lastlineinstance; \
int lastcallreference; \
- int confcapability; \
+ format_t confcapability; \
struct ast_codec_pref confprefs; \
- int capability; \
+ format_t capability; \
int earlyrtp; \
int transfer; \
int callwaiting; \
@@ -1371,7 +1371,7 @@ struct skinnysession {
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 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_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));
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.passThruPartyId = htolel(sub->callid);
@@ -4021,9 +4021,9 @@ static struct ast_frame *skinny_rtp_read(struct skinny_subchannel *sub)
if (ast) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
- if (f->subclass != ast->nativeformats) {
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
- ast->nativeformats = f->subclass;
+ if (f->subclass.codec != ast->nativeformats) {
+ ast_debug(1, "Oooh, format changed to %s\n", ast_getformatname(f->subclass.codec));
+ ast->nativeformats = f->subclass.codec;
ast_set_read_format(ast, ast->readformat);
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;
}
} else {
- if (!(frame->subclass & ast->nativeformats)) {
- ast_log(LOG_WARNING, "Asked to transmit frame type %d, while native formats is %d (read/write = %d/%d)\n",
- frame->subclass, ast->nativeformats, ast->readformat, ast->writeformat);
+ if (!(frame->subclass.codec & ast->nativeformats)) {
+ char buf[256];
+ 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;
}
}
@@ -4400,8 +4404,12 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state, const ch
// Should throw an error
tmp->nativeformats = default_capability;
fmt = ast_best_codec(tmp->nativeformats);
- if (skinnydebug)
- ast_verb(1, "skinny_new: tmp->nativeformats=%d fmt=%d\n", tmp->nativeformats, fmt);
+ if (skinnydebug) {
+ 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) {
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);
}
- f.subclass = dgt;
+ f.subclass.integer = dgt;
f.src = "skinny";
@@ -5301,6 +5309,7 @@ static int handle_capabilities_res_message(struct skinny_req *req, struct skinny
uint32_t count = 0;
int codecs = 0;
int i;
+ char buf[256];
count = letohl(req->data.caps.count);
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;
- 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_mutex_lock(&l->lock);
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));
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.passThruPartyId = htolel(sub->callid);
@@ -6576,9 +6585,9 @@ static int skinny_devicestate(void *data)
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 ast_channel *tmpc = NULL;
@@ -6588,7 +6597,7 @@ static struct ast_channel *skinny_request(const char *type, int format, const st
oldformat = format;
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;
}
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 8de4ada33..53ac9f94e 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -676,7 +676,7 @@ static int reload(void);
static int unload_module(void);
static int reload_config(void);
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);
static int unistim_call(struct ast_channel *ast, char *dest, int timeout);
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 public = { 0, };
struct sockaddr_in sin = { 0, };
- int codec;
+ format_t codec;
struct sockaddr_in sout = { 0, };
/* Sanity checks */
@@ -2085,13 +2085,14 @@ static void start_rtp(struct unistim_subchannel *sub)
sin.sin_port = htons(sub->parent->parent->rtp_port);
ast_rtp_instance_set_remote_address(sub->rtp, &sin);
if (!(sub->owner->nativeformats & sub->owner->readformat)) {
- int fmt;
+ format_t fmt;
+ char tmp[256];
fmt = ast_best_codec(sub->owner->nativeformats);
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),
- sub->owner->readformat, ast_getformatname(fmt), fmt,
- sub->owner->nativeformats);
+ ast_getformatname(fmt),
+ ast_getformatname_multiple(tmp, sizeof(tmp), sub->owner->nativeformats));
sub->owner->readformat = fmt;
sub->owner->writeformat = fmt;
}
@@ -2102,20 +2103,19 @@ static void start_rtp(struct unistim_subchannel *sub)
else
memcpy(&public, &public_ip, sizeof(public)); /* override */
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),
- htons(us.sin_port), ast_getformatname(sub->owner->readformat),
- sub->owner->readformat);
+ htons(us.sin_port), ast_getformatname(sub->owner->readformat));
ast_verb(0, "Starting phone RTP stack. Our public IP is %s\n",
ast_inet_ntoa(public.sin_addr));
}
if ((sub->owner->readformat == AST_FORMAT_ULAW) ||
(sub->owner->readformat == AST_FORMAT_ALAW)) {
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,
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,
sub->parent->parent->session);
}
@@ -2214,8 +2214,8 @@ static void start_rtp(struct unistim_subchannel *sub)
else if (sub->owner->readformat == AST_FORMAT_G729A)
buffsend[42] = 2; /* 1 = 10ms (10 bytes), 2 = 20ms (20 bytes) */
else
- ast_log(LOG_WARNING, "Unsupported codec %s (%d) !\n",
- ast_getformatname(sub->owner->readformat), sub->owner->readformat);
+ ast_log(LOG_WARNING, "Unsupported codec %s!\n",
+ ast_getformatname(sub->owner->readformat));
/* Source port for transmit RTP and Destination port for receiving RTP */
buffsend[45] = (htons(sin.sin_port) & 0xff00) >> 8;
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)
{
- 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;
sub = pte->device->lines->subs[SUB_REAL];
if (!sub->owner || sub->alreadygone) {
@@ -3936,14 +3936,13 @@ static struct ast_frame *unistim_rtp_read(const struct ast_channel *ast,
if (sub->owner) {
/* We already hold the channel lock */
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 from %s (%d) to %s (%d)\n",
+ "Oooh, format changed from %s to %s\n",
ast_getformatname(sub->owner->nativeformats),
- sub->owner->nativeformats, ast_getformatname(f->subclass),
- f->subclass);
+ 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_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;
}
} else {
- if (!(frame->subclass & ast->nativeformats)) {
+ if (!(frame->subclass.codec & ast->nativeformats)) {
+ char tmp[256];
ast_log(LOG_WARNING,
- "Asked to transmit frame type %s (%d), while native formats is %s (%d) (read/write = %s (%d)/%d)\n",
- ast_getformatname(frame->subclass), frame->subclass,
- ast_getformatname(ast->nativeformats), ast->nativeformats,
- ast_getformatname(ast->readformat), ast->readformat,
- ast->writeformat);
+ "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), ast->nativeformats),
+ ast_getformatname(ast->readformat),
+ ast_getformatname(ast->writeformat));
return -1;
}
}
@@ -4240,7 +4240,7 @@ static int unistim_senddigit_end(struct ast_channel *ast, char digit, unsigned i
send_tone(pte, 0, 0);
f.frametype = AST_FRAME_DTMF;
- f.subclass = digit;
+ f.subclass.integer = digit;
f.src = "unistim";
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)
tmp->nativeformats = CAPABILITY;
fmt = ast_best_codec(tmp->nativeformats);
- if (unistimdebug)
- ast_verb(0, "Best codec = %d from nativeformats %d (line cap=%d global=%d)\n", fmt,
- tmp->nativeformats, l->capability, CAPABILITY);
+ if (unistimdebug) {
+ char tmp1[256], tmp2[256], tmp3[256];
+ 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 (unistimdebug)
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 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 oldformat;
+ format_t oldformat;
struct unistim_subchannel *sub;
struct ast_channel *tmpc = NULL;
char tmp[256];
@@ -4629,12 +4634,14 @@ static struct ast_channel *unistim_request(const char *type, int format, const s
oldformat = format;
format &= CAPABILITY;
ast_log(LOG_NOTICE,
- "Asked to get a channel of format %s while capability is %d result : %s (%d) \n",
- ast_getformatname(oldformat), CAPABILITY, ast_getformatname(format), format);
+ "Asked to get a channel of format %s while capability is %s result : %s\n",
+ ast_getformatname(oldformat),
+ ast_getformatname_multiple(tmp, sizeof(tmp), CAPABILITY),
+ ast_getformatname(format));
if (!format) {
ast_log(LOG_NOTICE,
"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;
}
diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index c9875008c..960207de3 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -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 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_end(struct ast_channel *ast, char digit, unsigned int duration);
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 */
if (break_for_dtmf) {
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;
}
} else {
@@ -838,7 +838,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
switch (e->type) {
case VPB_RING:
if (p->mode == MODE_FXO) {
- f.subclass = AST_CONTROL_RING;
+ f.subclass.integer = AST_CONTROL_RING;
vpb_timer_stop(p->ring_timer);
vpb_timer_start(p->ring_timer);
} 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) {
/* Assume caller has hung up */
vpb_timer_stop(p->ring_timer);
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
} else {
vpb_timer_stop(p->ring_timer);
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;
} else if (p->owner->_state == AST_STATE_UP) {
f.frametype = AST_FRAME_DTMF;
- f.subclass = e->data;
+ f.subclass.integer = e->data;
} else
f.frametype = AST_FRAME_NULL;
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 ) {
ast_debug(4, "%s: handle_owned: got event: BUSY\n", p->dev);
if (p->owner->_state == AST_STATE_UP) {
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
} else {
- f.subclass = AST_CONTROL_BUSY;
+ f.subclass.integer = AST_CONTROL_BUSY;
}
} else if (e->data == VPB_FAX) {
if (!p->faxhandled) {
@@ -923,7 +923,7 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
* Timeout connection */
ast_verb(3, "grunt timeout\n");
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 {
p->lastgrunt = ast_tvnow();
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:
#ifdef DIAL_WITH_CALL_PROGRESS
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) {
- f.subclass = AST_CONTROL_CONGESTION;
+ f.subclass.integer = AST_CONTROL_CONGESTION;
} 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) {
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
}
#else
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;
case VPB_STATION_OFFHOOK:
- f.subclass = AST_CONTROL_ANSWER;
+ f.subclass.integer = AST_CONTROL_ANSWER;
break;
case VPB_DROP:
if ((p->mode == MODE_FXO) && (UseLoopDrop)) { /* ignore loop drop on stations */
if (p->owner->_state == AST_STATE_UP) {
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
} else {
f.frametype = AST_FRAME_NULL;
}
@@ -965,17 +965,17 @@ static inline int monitor_handle_owned(struct vpb_pvt *p, VPB_EVENT *e)
break;
case VPB_LOOP_ONHOOK:
if (p->owner->_state == AST_STATE_UP) {
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
} else {
f.frametype = AST_FRAME_NULL;
}
break;
case VPB_STATION_ONHOOK:
- f.subclass = AST_CONTROL_HANGUP;
+ f.subclass.integer = AST_CONTROL_HANGUP;
break;
case VPB_STATION_FLASH:
- f.subclass = AST_CONTROL_FLASH;
+ f.subclass.integer = AST_CONTROL_FLASH;
break;
/* 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:
if (p->state < 5) {
- f.subclass = AST_CONTROL_ANSWER;
+ f.subclass.integer = AST_CONTROL_ANSWER;
ast_verb(2, "%s: Dialend\n", p->dev);
} else {
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",
- 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
* 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);
} else {
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);
@@ -2097,7 +2097,7 @@ static struct ast_frame *vpb_read(struct ast_channel *ast)
return &f;
}
-static inline AudioCompress ast2vpbformat(int ast_format)
+static inline AudioCompress ast2vpbformat(format_t ast_format)
{
switch (ast_format) {
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) {
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) {
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); */
return 0;
} 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;
/* ast_mutex_unlock(&p->lock); */
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); */
- fmt = ast2vpbformat(frame->subclass);
+ fmt = ast2vpbformat(frame->subclass.codec);
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;
}
@@ -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 */
if (p->lastoutput == -1) {
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;
ast_mutex_unlock(&p->play_lock);
return 0;
@@ -2259,7 +2259,8 @@ static void *do_chanreads(void *pvt)
struct ast_frame *fr = &p->fr;
char *readbuf = ((char *)p->buf) + AST_FRIENDLY_OFFSET;
int bridgerec = 0;
- int afmt, readlen, res, trycnt=0;
+ format_t afmt;
+ int readlen, res, trycnt=0;
AudioCompress fmt;
int ignore_dtmf;
const char * getdtmf_var = NULL;
@@ -2363,7 +2364,7 @@ static void *do_chanreads(void *pvt)
}
fmt = ast2vpbformat(afmt);
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;
}
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));
ast_verb(6, "%s: chanreads: applied gain\n", p->dev);
- fr->subclass = afmt;
+ fr->subclass.codec = afmt;
fr->data.ptr = readbuf;
fr->datalen = readlen;
fr->frametype = AST_FRAME_VOICE;
- if ((use_ast_dtmfdet)&&(p->vad)) {
- fr = ast_dsp_process(p->owner,p->vad,fr);
+ if ((use_ast_dtmfdet) && (p->vad)) {
+ fr = ast_dsp_process(p->owner, p->vad, fr);
if (fr && (fr->frametype == AST_FRAME_DTMF)) {
- ast_debug(1, "%s: chanreads: Detected DTMF '%c'\n", p->dev, fr->subclass);
- } else if (fr->subclass == 'f') {
+ ast_debug(1, "%s: chanreads: Detected DTMF '%c'\n", p->dev, fr->subclass.integer);
+ } else if (fr->subclass.integer == 'f') {
}
}
/* 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;
}
-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 ast_channel *tmp = NULL;
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;
format &= prefformat;
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;
}
diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h
index b17fe5bed..2ae2c84c4 100644
--- a/channels/h323/chan_h323.h
+++ b/channels/h323/chan_h323.h
@@ -30,6 +30,7 @@
#define CHAN_H323_H
#include <arpa/inet.h>
+#include "asterisk/frame_defs.h"
/*
* Enable support for sending/reception of tunnelled Q.SIG messages and
@@ -64,7 +65,7 @@ typedef struct call_options {
int progress_audio;
int dtmfcodec[2];
int dtmfmode;
- int capability;
+ format_t capability;
int bridge;
int nat;
int tunnelOptions;
diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c
index 24c3c57bb..9a105168c 100644
--- a/channels/iax2-parser.c
+++ b/channels/iax2-parser.c
@@ -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(char *output, int maxlen, void *value, int len)
{
@@ -233,7 +248,9 @@ static struct iax2_ie {
{ IAX_IE_USERNAME, "USERNAME", dump_string },
{ IAX_IE_PASSWORD, "PASSWORD", dump_string },
{ IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
+ { IAX_IE_CAPABILITY2, "CAPABILITY2", dump_versioned_codec },
{ IAX_IE_FORMAT, "FORMAT", dump_int },
+ { IAX_IE_FORMAT2, "FORMAT2", dump_versioned_codec },
{ IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
{ IAX_IE_VERSION, "VERSION", 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));
}
+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)
{
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)) {
snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
errorf(tmp);
- } else
- ies->capability = ntohl(get_unaligned_uint32(data + 2));
+ } else if (ies->capability == 0) { /* Don't overwrite capability2, if specified */
+ 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;
case IAX_IE_FORMAT:
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);
errorf(tmp);
- } else
+ } else if (ies->format == 0) { /* Don't overwrite format2, if specified */
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;
case IAX_IE_LANGUAGE:
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)
{
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.datalen = f->datalen;
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
/* 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 */
ast_swapcopy_samples(fr->af.data.ptr, f->data.ptr, copy_len / 2);
} else
diff --git a/channels/iax2-parser.h b/channels/iax2-parser.h
index ca10bc7ae..ec6472e87 100644
--- a/channels/iax2-parser.h
+++ b/channels/iax2-parser.h
@@ -20,6 +20,7 @@
#include "asterisk/linkedlists.h"
#include "asterisk/aes.h"
+#include "asterisk/frame_defs.h"
struct iax_ies {
char *called_number;
@@ -32,8 +33,8 @@ struct iax_ies {
char *called_context;
char *username;
char *password;
- unsigned int capability;
- unsigned int format;
+ format_t capability;
+ format_t format;
char *codec_prefs;
char *language;
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_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_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);
diff --git a/channels/iax2.h b/channels/iax2.h
index 710271096..825efb8cb 100644
--- a/channels/iax2.h
+++ b/channels/iax2.h
@@ -39,7 +39,7 @@
#define IAX_FLAG_SC_LOG 0x80
-#define IAX_MAX_SHIFT 0x1F
+#define IAX_MAX_SHIFT 0x3F
#define IAX_WINDOW 64
@@ -180,6 +180,9 @@ enum iax_frame_subclass {
#define IAX_IE_OSPTOKEN 53 /*!< OSP 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_NUM 4
#define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 29ea11680..aa0d441c9 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -1331,7 +1331,7 @@ int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
static int analog_handles_digit(struct ast_frame *f)
{
- char subclass = toupper(f->subclass);
+ char subclass = toupper(f->subclass.integer);
switch (subclass) {
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
of a DTMF digit */
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;
/* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
analog_set_confirmanswer(p, 0);
}
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");
p->cid.cid_name = p->callwait_name;
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))
p->callwaitcas = 0;
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;
} else {
analog_cb_handle_dtmfup(p, ast, index, dest);
@@ -2117,8 +2117,8 @@ static void *__analog_ss_thread(void *data)
break;
}
if (f->frametype == AST_FRAME_DTMF) {
- dtmfbuf[i++] = f->subclass;
- ast_debug(1, "CID got digit '%c'\n", f->subclass);
+ dtmfbuf[i++] = f->subclass.integer;
+ ast_debug(1, "CID got digit '%c'\n", f->subclass.integer);
res = 2000;
}
ast_frfree(f);
@@ -2354,7 +2354,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
mysig = p->outsigmod;
}
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.samples = 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);
analog_confmute(p, 0);
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);
return f;
}
@@ -2390,7 +2390,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
/* Mute conference */
analog_confmute(p, 1);
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;
}
@@ -2438,7 +2438,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
ast_setstate(ast, AST_STATE_UP);
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;
} else { /* if to state wait for offhook to dial rest */
/* 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) {
ast_setstate(ast, AST_STATE_UP);
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 */
p->polarity = POLARITY_REV;
} else {
@@ -2623,7 +2623,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
analog_set_echocanceller(p, 1);
analog_train_echocanceller(p);
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 */
analog_off_hook(p);
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)) {
/* Ignore answer if "confirm answer" is enabled */
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)) {
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
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 {
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.subclass = 0;
+ p->subs[index].f.subclass.integer = 0;
analog_set_dialing(p, 1);
}
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->rings = 1;
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);
return &p->subs[index].f;
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)) {
ast_debug(1, "Ring detected\n");
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))) {
ast_debug(1, "Line answered\n");
if (analog_check_confirmanswer(p)) {
p->subs[index].f.frametype = AST_FRAME_NULL;
- p->subs[index].f.subclass = 0;
+ p->subs[index].f.subclass.integer = 0;
} else {
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);
}
} 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->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;
case ANALOG_EVENT_RINGERON:
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.mallocd = 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.src = "dahdi_exception";
p->subs[index].f.data.ptr = NULL;
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index dbbeccf78..ee4f9353d 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -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);
}
- f.subclass = subclass;
+ f.subclass.integer = subclass;
pri_queue_frame(p, &f, pri);
}
@@ -1200,7 +1200,7 @@ static void *do_idle_thread(void *vchan)
break;
}
if (f->frametype == AST_FRAME_CONTROL) {
- switch (f->subclass) {
+ switch (f->subclass.integer) {
case AST_CONTROL_ANSWER:
/* Launch the PBX */
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 {
struct ast_frame f = { AST_FRAME_CONTROL, };
- f.subclass = AST_CONTROL_HOLD;
+ f.subclass.integer = AST_CONTROL_HOLD;
ast_queue_frame(owner, &f);
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, };
- f.subclass = AST_CONTROL_UNHOLD;
+ f.subclass.integer = AST_CONTROL_UNHOLD;
pri_queue_frame(pri->pvts[chanpos], &f, pri);
}
sig_pri_unlock_private(pri->pvts[chanpos]);
@@ -2192,7 +2192,7 @@ static void *pri_dchannel(void *vpri)
int 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);
}
@@ -2222,7 +2222,7 @@ static void *pri_dchannel(void *vpri)
int 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);
}
@@ -2685,7 +2685,7 @@ static void *pri_dchannel(void *vpri)
|| (e->proceeding.progress == 8)
#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) {
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");
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
) {
/* Bring voice path up */
- f.subclass = AST_CONTROL_PROGRESS;
+ f.subclass.integer = AST_CONTROL_PROGRESS;
pri_queue_frame(pri->pvts[chanpos], &f, pri);
}
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,
e->proceeding.subcmds, e->proceeding.call);
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",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
@@ -2741,7 +2741,7 @@ static void *pri_dchannel(void *vpri)
#endif
) {
/* Bring voice path up */
- f.subclass = AST_CONTROL_PROGRESS;
+ f.subclass.integer = AST_CONTROL_PROGRESS;
pri_queue_frame(pri->pvts[chanpos], &f, pri);
}
pri->pvts[chanpos]->proceeding = 1;
@@ -3103,7 +3103,7 @@ static void *pri_dchannel(void *vpri)
if (!pri->discardremoteholdretrieval) {
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);
}
break;
@@ -3111,7 +3111,7 @@ static void *pri_dchannel(void *vpri)
if (!pri->discardremoteholdretrieval) {
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);
}
break;