Expand codec bitfield from 32 bits to 64 bits.
authorTilghman Lesher <tilghman@meg.abyt.es>
Wed, 4 Nov 2009 14:05:12 +0000 (14:05 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Wed, 4 Nov 2009 14:05:12 +0000 (14:05 +0000)
Reviewboard: https://reviewboard.asterisk.org/r/416/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3

124 files changed:
apps/app_alarmreceiver.c
apps/app_amd.c
apps/app_chanspy.c
apps/app_dahdibarge.c
apps/app_dial.c
apps/app_dictate.c
apps/app_disa.c
apps/app_echo.c
apps/app_externalivr.c
apps/app_fax.c
apps/app_festival.c
apps/app_followme.c
apps/app_jack.c
apps/app_meetme.c
apps/app_milliwatt.c
apps/app_mp3.c
apps/app_nbscat.c
apps/app_queue.c
apps/app_record.c
apps/app_sms.c
apps/app_speech_utils.c
apps/app_talkdetect.c
apps/app_test.c
apps/app_url.c
apps/app_waitforring.c
bridges/bridge_softmix.c
channels/chan_agent.c
channels/chan_alsa.c
channels/chan_bridge.c
channels/chan_console.c
channels/chan_dahdi.c
channels/chan_gtalk.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_jingle.c
channels/chan_local.c
channels/chan_mgcp.c
channels/chan_misdn.c
channels/chan_multicast_rtp.c
channels/chan_oss.c
channels/chan_phone.c
channels/chan_sip.c
channels/chan_skinny.c
channels/chan_unistim.c
channels/chan_vpb.cc
channels/h323/chan_h323.h
channels/iax2-parser.c
channels/iax2-parser.h
channels/iax2.h
channels/sig_analog.c
channels/sig_pri.c
codecs/codec_dahdi.c
codecs/codec_ulaw.c
codecs/ex_adpcm.h
codecs/ex_alaw.h
codecs/ex_g722.h
codecs/ex_g726.h
codecs/ex_gsm.h
codecs/ex_ilbc.h
codecs/ex_lpc10.h
codecs/ex_speex.h
codecs/ex_ulaw.h
configure
configure.ac
doc/codec-64bit.txt [new file with mode: 0644]
formats/format_g723.c
formats/format_g726.c
formats/format_g729.c
formats/format_gsm.c
formats/format_h263.c
formats/format_h264.c
formats/format_ilbc.c
formats/format_jpeg.c
formats/format_ogg_vorbis.c
formats/format_pcm.c
formats/format_siren14.c
formats/format_siren7.c
formats/format_sln.c
formats/format_sln16.c
formats/format_vox.c
formats/format_wav.c
formats/format_wav_gsm.c
funcs/func_volume.c
include/asterisk/abstract_jb.h
include/asterisk/audiohook.h
include/asterisk/autoconfig.h.in
include/asterisk/bridging.h
include/asterisk/bridging_technology.h
include/asterisk/channel.h
include/asterisk/compat.h
include/asterisk/frame.h
include/asterisk/frame_defs.h [new file with mode: 0644]
include/asterisk/pbx.h
include/asterisk/rtp_engine.h
include/asterisk/slin.h
include/asterisk/slinfactory.h
include/asterisk/translate.h
include/asterisk/unaligned.h
main/abstract_jb.c
main/app.c
main/asterisk.exports
main/audiohook.c
main/autoservice.c
main/bridging.c
main/channel.c
main/dial.c
main/dsp.c
main/features.c
main/file.c
main/frame.c
main/indications.c
main/manager.c
main/pbx.c
main/rtp_engine.c
main/slinfactory.c
main/strcompat.c
main/translate.c
main/udptl.c
pbx/pbx_spool.c
res/res_adsi.c
res/res_agi.c
res/res_musiconhold.c
res/res_rtp_asterisk.c
res/res_rtp_multicast.c

index 6589ec3..22dd4af 100644 (file)
@@ -191,7 +191,7 @@ static int send_tone_burst(struct ast_channel *chan, float freq, int duration, i
 
                if (f->frametype == AST_FRAME_VOICE) {
                        wf.frametype = AST_FRAME_VOICE;
-                       wf.subclass = AST_FORMAT_ULAW;
+                       wf.subclass.codec = AST_FORMAT_ULAW;
                        wf.offset = AST_FRIENDLY_OFFSET;
                        wf.mallocd = 0;
                        wf.data.ptr = tone_block.buf;
@@ -260,7 +260,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
                }
 
                /* If they hung up, leave */
-               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
                        if (f->data.uint32) {
                                chan->hangupcause = f->data.uint32;
                        }
@@ -275,7 +275,7 @@ static int receive_dtmf_digits(struct ast_channel *chan, char *digit_string, int
                        continue;
                }
 
-               digit_string[i++] = f->subclass;  /* save digit */
+               digit_string[i++] = f->subclass.integer;  /* save digit */
 
                ast_frfree(f);
 
index c5f08ab..bb656cc 100644 (file)
@@ -188,7 +188,7 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
                AST_APP_ARG(argMaximumWordLength);
        );
 
-       ast_verb(3, "AMD: %s %s %s (Fmt: %d)\n", chan->name ,chan->cid.cid_ani, chan->cid.cid_rdnis, chan->readformat);
+       ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, chan->cid.cid_ani, chan->cid.cid_rdnis, ast_getformatname(chan->readformat));
 
        /* Lets parse the arguments. */
        if (!ast_strlen_zero(parse)) {
index ad5ed70..3f0944f 100644 (file)
@@ -611,7 +611,7 @@ static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_auto
                        continue;
                }
                
-               res = (f->frametype == AST_FRAME_DTMF) ? f->subclass : 0;
+               res = (f->frametype == AST_FRAME_DTMF) ? f->subclass.integer : 0;
                ast_frfree(f);
                if (!res)
                        continue;
index 424ba36..d9dd590 100644 (file)
@@ -208,17 +208,17 @@ dahdiretry:
                        f = ast_read(c);
                        if (!f) 
                                break;
-                       if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
+                       if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) {
                                ret = 0;
                                ast_frfree(f);
                                break;
                        } else if (fd != chan->fds[0]) {
                                if (f->frametype == AST_FRAME_VOICE) {
-                                       if (f->subclass == AST_FORMAT_ULAW) {
+                                       if (f->subclass.codec == AST_FORMAT_ULAW) {
                                                /* Carefully write */
                                                careful_write(fd, f->data.ptr, f->datalen);
                                        } else
-                                               ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%d) frame in the conference\n", f->subclass);
+                                               ast_log(LOG_WARNING, "Huh?  Got a non-ulaw (%s) frame in the conference\n", ast_getformatname(f->subclass.codec));
                                }
                        }
                        ast_frfree(f);
@@ -227,7 +227,7 @@ dahdiretry:
                        if (res > 0) {
                                memset(&fr, 0, sizeof(fr));
                                fr.frametype = AST_FRAME_VOICE;
-                               fr.subclass = AST_FORMAT_ULAW;
+                               fr.subclass.codec = AST_FORMAT_ULAW;
                                fr.datalen = res;
                                fr.samples = res;
                                fr.data.ptr = buf;
index 910143d..68a0b04 100644 (file)
@@ -1004,7 +1004,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                continue;
                        }
                        if (f->frametype == AST_FRAME_CONTROL) {
-                               switch(f->subclass) {
+                               switch (f->subclass.integer) {
                                case AST_CONTROL_ANSWER:
                                        /* This is our guy if someone answered. */
                                        if (!peer) {
@@ -1145,7 +1145,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        }
                                        break;
                                default:
-                                       ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
+                                       ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
                                }
                        } else if (single) {
                                switch (f->frametype) {
@@ -1157,7 +1157,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                                }
                                                break;
                                        case AST_FRAME_HTML:
-                                               if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data.ptr, f->datalen) == -1) {
+                                               if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass.integer, f->data.ptr, f->datalen) == -1) {
                                                        ast_log(LOG_WARNING, "Unable to send URL\n");
                                                }
                                                break;
@@ -1175,7 +1175,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                        else if (!f || (f->frametype != AST_FRAME_VOICE))
                                printf("Hangup received on %s\n", in->name);
 #endif
-                       if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
+                       if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
                                /* Got hung up */
                                *to = -1;
                                strcpy(pa->status, "CANCEL");
@@ -1195,11 +1195,11 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        const char *context;
                                        ast_channel_lock(in);
                                        context = pbx_builtin_getvar_helper(in, "EXITCONTEXT");
-                                       if (onedigit_goto(in, context, (char) f->subclass, 1)) {
-                                               ast_verb(3, "User hit %c to disconnect call.\n", f->subclass);
+                                       if (onedigit_goto(in, context, (char) f->subclass.integer, 1)) {
+                                               ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
                                                *to = 0;
                                                ast_cdr_noanswer(in->cdr);
-                                               *result = f->subclass;
+                                               *result = f->subclass.integer;
                                                strcpy(pa->status, "CANCEL");
                                                ast_frfree(f);
                                                ast_channel_unlock(in);
@@ -1209,7 +1209,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                }
 
                                if (ast_test_flag64(peerflags, OPT_CALLER_HANGUP) &&
-                                       detect_disconnect(in, f->subclass, featurecode)) {
+                                       detect_disconnect(in, f->subclass.integer, featurecode)) {
                                        ast_verb(3, "User requested call disconnect.\n");
                                        *to = 0;
                                        strcpy(pa->status, "CANCEL");
@@ -1221,7 +1221,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
 
                        /* Forward HTML stuff */
                        if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML))
-                               if (ast_channel_sendhtml(outgoing->chan, f->subclass, f->data.ptr, f->datalen) == -1)
+                               if (ast_channel_sendhtml(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen) == -1)
                                        ast_log(LOG_WARNING, "Unable to send URL\n");
 
                        if (single && ((f->frametype == AST_FRAME_VOICE) || (f->frametype == AST_FRAME_DTMF_BEGIN) || (f->frametype == AST_FRAME_DTMF_END)))  {
@@ -1229,16 +1229,16 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                                        ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
                        }
                        if (single && (f->frametype == AST_FRAME_CONTROL)) { 
-                               if ((f->subclass == AST_CONTROL_HOLD) ||
-                                   (f->subclass == AST_CONTROL_UNHOLD) ||
-                                   (f->subclass == AST_CONTROL_VIDUPDATE) ||
-                                   (f->subclass == AST_CONTROL_SRCUPDATE) ||
-                                   (f->subclass == AST_CONTROL_REDIRECTING)) {
-                                       ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
-                                       ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
-                               } else if (f->subclass == AST_CONTROL_CONNECTED_LINE) {
+                               if ((f->subclass.integer == AST_CONTROL_HOLD) ||
+                                   (f->subclass.integer == AST_CONTROL_UNHOLD) ||
+                                   (f->subclass.integer == AST_CONTROL_VIDUPDATE) ||
+                                   (f->subclass.integer == AST_CONTROL_SRCUPDATE) ||
+                                   (f->subclass.integer == AST_CONTROL_REDIRECTING)) {
+                                       ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass.integer, outgoing->chan->name);
+                                       ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
+                               } else if (f->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
                                        if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
-                                               ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+                                               ast_indicate_data(outgoing->chan, f->subclass.integer, f->data.ptr, f->datalen);
                                        }
                                }
                        }
index 816f15a..e9e5f0d 100644 (file)
@@ -165,7 +165,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
                samples = 0;
                while (!done && ((res = ast_waitfor(chan, -1)) > -1) && fs && (f = ast_read(chan))) {
                        if (digit) {
-                               struct ast_frame fr = {AST_FRAME_DTMF, digit};
+                               struct ast_frame fr = {AST_FRAME_DTMF, { .integer = digit } };
                                ast_queue_frame(chan, &fr);
                                digit = 0;
                        }
@@ -173,7 +173,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
                                int got = 1;
                                switch(mode) {
                                case DMODE_PLAY:
-                                       switch(f->subclass) {
+                                       switch (f->subclass.integer) {
                                        case '1':
                                                ast_set_flag(&flags, DFLAG_PAUSE);
                                                mode = DMODE_RECORD;
@@ -202,7 +202,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
                                        }
                                        break;
                                case DMODE_RECORD:
-                                       switch(f->subclass) {
+                                       switch (f->subclass.integer) {
                                        case '1':
                                                ast_set_flag(&flags, DFLAG_PAUSE);
                                                mode = DMODE_PLAY;
@@ -219,7 +219,7 @@ static int dictate_exec(struct ast_channel *chan, const char *data)
                                        got = 0;
                                }
                                if (!got) {
-                                       switch(f->subclass) {
+                                       switch (f->subclass.integer) {
                                        case '#':
                                                done = 1;
                                                continue;
index 49c7ad5..a64d053 100644 (file)
@@ -220,7 +220,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                        return -1;
                }
 
-               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
                        if (f->data.uint32)
                                chan->hangupcause = f->data.uint32;
                        ast_frfree(f);
@@ -234,7 +234,7 @@ static int disa_exec(struct ast_channel *chan, const char *data)
                        continue;
                }
 
-               j = f->subclass;  /* save digit */
+               j = f->subclass.integer;  /* save digit */
                ast_frfree(f);
 
                if (!i) {
index ac718b8..1c72110 100644 (file)
@@ -51,7 +51,7 @@ static const char app[] = "Echo";
 static int echo_exec(struct ast_channel *chan, const char *data)
 {
        int res = -1;
-       int format;
+       format_t format;
 
        format = ast_best_codec(chan->nativeformats);
        ast_set_write_format(chan, format);
@@ -68,7 +68,7 @@ static int echo_exec(struct ast_channel *chan, const char *data)
                        ast_frfree(f);
                        goto end;
                }
-               if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
+               if ((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '#')) {
                        res = 0;
                        ast_frfree(f);
                        goto end;
index 1dd1fc4..7258181 100644 (file)
@@ -627,7 +627,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
                                break;
                        }
                        if (f->frametype == AST_FRAME_DTMF) {
-                               send_eivr_event(eivr_events, f->subclass, NULL, chan);
+                               send_eivr_event(eivr_events, f->subclass.integer, NULL, chan);
                                if (u->option_autoclear) {
                                        if (!u->abort_current_sound && !u->playing_silence)
                                                send_eivr_event(eivr_events, 'T', NULL, chan);
@@ -640,7 +640,7 @@ static int eivr_comm(struct ast_channel *chan, struct ivr_localuser *u,
                                                u->abort_current_sound = 1;
                                        AST_LIST_UNLOCK(&u->playlist);
                                }
-                       } else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
+                       } else if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP)) {
                                ast_chan_log(LOG_NOTICE, chan, "Got AST_CONTROL_HANGUP\n");
                                send_eivr_event(eivr_events, 'H', NULL, chan);
                                if (f->data.uint32) {
index 39e0064..6f61116 100644 (file)
@@ -180,7 +180,7 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin
 
        struct ast_frame outf = {
                .frametype = AST_FRAME_MODEM,
-               .subclass = AST_MODEM_T38,
+               .subclass.integer = AST_MODEM_T38,
                .src = __FUNCTION__,
        };
 
@@ -327,7 +327,7 @@ static int fax_generator_generate(struct ast_channel *chan, void *data, int len,
     
        struct ast_frame outf = {
                .frametype = AST_FRAME_VOICE,
-               .subclass = AST_FORMAT_SLINEAR,
+               .subclass.codec = AST_FORMAT_SLINEAR,
                .src = __FUNCTION__,
        };
 
@@ -413,7 +413,7 @@ static int transmit_audio(fax_session *s)
                                        return -1;
                                }
                                if ((inf->frametype == AST_FRAME_CONTROL) &&
-                                   (inf->subclass == AST_CONTROL_T38_PARAMETERS) &&
+                                   (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
                                    (inf->datalen == sizeof(t38_parameters))) {
                                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
                                        
@@ -517,12 +517,12 @@ static int transmit_audio(fax_session *s)
                        break;
                }
 
-               ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
+               ast_debug(10, "frame %d/%llu, len=%d\n", inf->frametype, (unsigned long long) inf->subclass.codec, inf->datalen);
 
                /* Check the frame type. Format also must be checked because there is a chance
                   that a frame in old format was already queued before we set channel format
                   to slinear so it will still be received by ast_read */
-               if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
+               if (inf->frametype == AST_FRAME_VOICE && inf->subclass.codec == AST_FORMAT_SLINEAR) {
                        if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
                                /* I know fax_rx never returns errors. The check here is for good style only */
                                ast_log(LOG_WARNING, "fax_rx returned error\n");
@@ -534,7 +534,7 @@ static int transmit_audio(fax_session *s)
                                last_state = t30state->state;
                        }
                } else if ((inf->frametype == AST_FRAME_CONTROL) &&
-                          (inf->subclass == AST_CONTROL_T38_PARAMETERS)) {
+                          (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS)) {
                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
 
                        if (parameters->request_response == AST_T38_NEGOTIATED) {
@@ -678,15 +678,15 @@ static int transmit_t38(fax_session *s)
                        break;
                }
 
-               ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass, inf->datalen);
+               ast_debug(10, "frame %d/%d, len=%d\n", inf->frametype, inf->subclass.integer, inf->datalen);
 
-               if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
+               if (inf->frametype == AST_FRAME_MODEM && inf->subclass.integer == AST_MODEM_T38) {
                        t38_core_rx_ifp_packet(t38state, inf->data.ptr, inf->datalen, inf->seqno);
                        if (last_state != t30state->state) {
                                state_change = ast_tvnow();
                                last_state = t30state->state;
                        }
-               } else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38_PARAMETERS) {
+               } else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) {
                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
                        if (parameters->request_response == AST_T38_TERMINATED) {
                                ast_debug(1, "T38 down, finishing\n");
@@ -733,7 +733,7 @@ disable_t38:
                                        return -1;
                                }
                                if ((inf->frametype == AST_FRAME_CONTROL) &&
-                                   (inf->subclass == AST_CONTROL_T38_PARAMETERS) &&
+                                   (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) &&
                                    (inf->datalen == sizeof(t38_parameters))) {
                                        struct ast_control_t38_parameters *parameters = inf->data.ptr;
                                        
index 0b917a7..c547cfc 100644 (file)
@@ -211,8 +211,8 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
                        }
                        if (f->frametype == AST_FRAME_DTMF) {
                                ast_debug(1, "User pressed a key\n");
-                               if (intkeys && strchr(intkeys, f->subclass)) {
-                                       res = f->subclass;
+                               if (intkeys && strchr(intkeys, f->subclass.integer)) {
+                                       res = f->subclass.integer;
                                        ast_frfree(f);
                                        break;
                                }
@@ -228,7 +228,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
                                res = read(fds[0], myf.frdata, needed);
                                if (res > 0) {
                                        myf.f.frametype = AST_FRAME_VOICE;
-                                       myf.f.subclass = AST_FORMAT_SLINEAR;
+                                       myf.f.subclass.codec = AST_FORMAT_SLINEAR;
                                        myf.f.datalen = res;
                                        myf.f.samples = res / 2;
                                        myf.f.offset = AST_FRIENDLY_OFFSET;
index 363abb5..db2d984 100644 (file)
@@ -643,7 +643,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                        f = ast_read(winner);
                        if (f) {
                                if (f->frametype == AST_FRAME_CONTROL) {
-                                       switch(f->subclass) {
+                                       switch (f->subclass.integer) {
                                        case AST_CONTROL_HANGUP:
                                                ast_verb(3, "%s received a hangup frame.\n", winner->name);
                                                if (f->data.uint32) {
@@ -718,7 +718,7 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                                ast_verb(3, "%s stopped sounds\n", winner->name);
                                                break;
                                        default:
-                                               ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
+                                               ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
                                                break;
                                        }
                                } 
@@ -726,8 +726,8 @@ static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_us
                                        if (winner->stream)
                                                ast_stopstream(winner);
                                        tmpuser->digts = 0;
-                                       ast_debug(1, "DTMF received: %c\n",(char) f->subclass);
-                                       tmpuser->yn[tmpuser->ynidx] = (char) f->subclass;
+                                       ast_debug(1, "DTMF received: %c\n", (char) f->subclass.integer);
+                                       tmpuser->yn[tmpuser->ynidx] = (char) f->subclass.integer;
                                        tmpuser->ynidx++;
                                        ast_debug(1, "DTMF string: %s\n", tmpuser->yn);
                                        if (tmpuser->ynidx >= ynlongest) {
index 8d8c1f8..e8f717b 100644 (file)
@@ -604,7 +604,7 @@ static void handle_jack_audio(struct ast_channel *chan, struct jack_data *jack_d
        short buf[160];
        struct ast_frame f = {
                .frametype = AST_FRAME_VOICE,
-               .subclass = AST_FORMAT_SLINEAR,
+               .subclass.codec = AST_FORMAT_SLINEAR,
                .src = "JACK",
                .data.ptr = buf,
                .datalen = sizeof(buf),
@@ -781,7 +781,7 @@ static int jack_exec(struct ast_channel *chan, const char *data)
 
                switch (f->frametype) {
                case AST_FRAME_CONTROL:
-                       if (f->subclass == AST_CONTROL_HANGUP)
+                       if (f->subclass.integer == AST_CONTROL_HANGUP)
                                jack_data->stop = 1;
                        break;
                case AST_FRAME_VOICE:
@@ -827,9 +827,9 @@ static int jack_hook_callback(struct ast_audiohook *audiohook, struct ast_channe
        if (frame->frametype != AST_FRAME_VOICE)
                return 0;
 
-       if (frame->subclass != AST_FORMAT_SLINEAR) {
-               ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %d\n",
-                       frame->subclass);
+       if (frame->subclass.codec != AST_FORMAT_SLINEAR) {
+               ast_log(LOG_WARNING, "Expected frame in SLINEAR for the audiohook, but got format %s\n",
+                       ast_getformatname(frame->subclass.codec));
                return 0;
        }
 
index 7636836..dedb7d1 100644 (file)
@@ -2931,11 +2931,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                        break;
                                }
                                if (f->frametype == AST_FRAME_DTMF) {
-                                       dtmfstr[0] = f->subclass;
+                                       dtmfstr[0] = f->subclass.integer;
                                        dtmfstr[1] = '\0';
                                }
 
-                               if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
+                               if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
                                        if (user->talk.actual) {
                                                ast_frame_adjust_volume(f, user->talk.actual);
                                        }
@@ -2987,7 +2987,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                        careful_write(fd, f->data.ptr, f->datalen, 0);
                                                }
                                        }
-                               } else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
+                               } else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass.integer == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
                                        if (confflags & CONFFLAG_PASS_DTMF) {
                                                conf_queue_dtmf(conf, user, f);
                                        }
@@ -3020,7 +3020,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                                dtmf = 0;
                                                        }
                                                } else {
-                                                       dtmf = f->subclass;
+                                                       dtmf = f->subclass.integer;
                                                }
                                                if (dtmf) {
                                                        switch(dtmf) {
@@ -3121,7 +3121,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                                dtmf = 0;
                                                        }
                                                } else {
-                                                       dtmf = f->subclass;
+                                                       dtmf = f->subclass.integer;
                                                }
                                                if (dtmf) {
                                                        switch (dtmf) {
@@ -3211,7 +3211,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                        } else {
                                                ast_debug(2, "Exit by single digit did not work in meetme. Extension %s does not exist in context %s\n", dtmfstr, exitcontext);
                                        }
-                               } else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass))) {
+                               } else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass.integer))) {
                                        pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr);
                                                
                                        if (confflags & CONFFLAG_PASS_DTMF) {
@@ -3224,7 +3224,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                        && confflags & CONFFLAG_PASS_DTMF) {
                                        conf_queue_dtmf(conf, user, f);
                                } else if ((confflags & CONFFLAG_SLA_STATION) && f->frametype == AST_FRAME_CONTROL) {
-                                       switch (f->subclass) {
+                                       switch (f->subclass.integer) {
                                        case AST_CONTROL_HOLD:
                                                sla_queue_event_conf(SLA_EVENT_HOLD, chan, conf);
                                                break;
@@ -3236,7 +3236,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                } else {
                                        ast_debug(1, 
                                                "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
-                                               chan->name, f->frametype, f->subclass);
+                                               chan->name, f->frametype, f->subclass.integer);
                                }
                                ast_frfree(f);
                        } else if (outfd > -1) {
@@ -3244,7 +3244,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                if (res > 0) {
                                        memset(&fr, 0, sizeof(fr));
                                        fr.frametype = AST_FRAME_VOICE;
-                                       fr.subclass = AST_FORMAT_SLINEAR;
+                                       fr.subclass.codec = AST_FORMAT_SLINEAR;
                                        fr.datalen = res;
                                        fr.samples = res / 2;
                                        fr.data.ptr = buf;
index b6d9403..2413760 100644 (file)
@@ -78,7 +78,7 @@ static int milliwatt_generate(struct ast_channel *chan, void *data, int len, int
        int i, *indexp = (int *) data;
        struct ast_frame wf = {
                .frametype = AST_FRAME_VOICE,
-               .subclass = AST_FORMAT_ULAW,
+               .subclass.codec = AST_FORMAT_ULAW,
                .offset = AST_FRIENDLY_OFFSET,
                .src = __FUNCTION__,
        };
index 1cea8e3..b177fb0 100644 (file)
@@ -169,7 +169,7 @@ static int mp3_exec(struct ast_channel *chan, const char *data)
                                res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata), timeout);
                                if (res > 0) {
                                        myf.f.frametype = AST_FRAME_VOICE;
-                                       myf.f.subclass = AST_FORMAT_SLINEAR;
+                                       myf.f.subclass.codec = AST_FORMAT_SLINEAR;
                                        myf.f.datalen = res;
                                        myf.f.samples = res / 2;
                                        myf.f.mallocd = 0;
index ec93478..dd7637a 100644 (file)
@@ -148,7 +148,7 @@ static int NBScat_exec(struct ast_channel *chan, const char *data)
                                res = timed_read(fds[0], myf.frdata, sizeof(myf.frdata));
                                if (res > 0) {
                                        myf.f.frametype = AST_FRAME_VOICE;
-                                       myf.f.subclass = AST_FORMAT_SLINEAR;
+                                       myf.f.subclass.codec = AST_FORMAT_SLINEAR;
                                        myf.f.datalen = res;
                                        myf.f.samples = res / 2;
                                        myf.f.mallocd = 0;
index 883b3d6..bdbb915 100644 (file)
@@ -3299,7 +3299,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
                                f = ast_read(winner);
                                if (f) {
                                        if (f->frametype == AST_FRAME_CONTROL) {
-                                               switch (f->subclass) {
+                                               switch (f->subclass.integer) {
                                                case AST_CONTROL_ANSWER:
                                                        /* This is our guy if someone answered. */
                                                        if (!peer) {
@@ -3389,7 +3389,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
                                                        }
                                                        break;
                                                default:
-                                                       ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
+                                                       ast_debug(1, "Dunno what to do with control type %d\n", f->subclass.integer);
                                                        break;
                                                }
                                        }
@@ -3413,7 +3413,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
                /* If we received an event from the caller, deal with it. */
                if (winner == in) {
                        f = ast_read(in);
-                       if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
+                       if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
                                /* Got hung up */
                                *to = -1;
                                if (f) {
@@ -3424,16 +3424,16 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
                                }
                                return NULL;
                        }
-                       if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass == '*')) {
-                               ast_verb(3, "User hit %c to disconnect call.\n", f->subclass);
+                       if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
+                               ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
                                *to = 0;
                                ast_frfree(f);
                                return NULL;
                        }
-                       if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass)) {
-                               ast_verb(3, "User pressed digit: %c\n", f->subclass);
+                       if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
+                               ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
                                *to = 0;
-                               *digit = f->subclass;
+                               *digit = f->subclass.integer;
                                ast_frfree(f);
                                return NULL;
                        }
index f6e067c..ce4181d 100644 (file)
@@ -372,7 +372,7 @@ static int record_exec(struct ast_channel *chan, const char *data)
                                break;
                        }
                } else if ((f->frametype == AST_FRAME_DTMF) &&
-                   (f->subclass == terminator)) {
+                   (f->subclass.integer == terminator)) {
                        ast_frfree(f);
                        pbx_builtin_setvar_helper(chan, "RECORD_STATUS", "DTMF");
                        break;
index bed9f5c..6a2b0c0 100644 (file)
@@ -1603,7 +1603,7 @@ static int sms_generate(struct ast_channel *chan, void *data, int len, int sampl
        buf = alloca(len);
 
        f.frametype = AST_FRAME_VOICE;
-       f.subclass = __OUT_FMT;
+       f.subclass.codec = __OUT_FMT;
        f.datalen = samples * sizeof(*buf);
        f.offset = AST_FRIENDLY_OFFSET;
        f.mallocd = 0;
index cd1c4d1..28c37a3 100644 (file)
@@ -824,7 +824,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
                        /* Free the frame we received */
                        switch (f->frametype) {
                        case AST_FRAME_DTMF:
-                               if (dtmf_terminator != '\0' && f->subclass == dtmf_terminator) {
+                               if (dtmf_terminator != '\0' && f->subclass.integer == dtmf_terminator) {
                                        done = 1;
                                } else {
                                        if (chan->stream != NULL) {
@@ -836,7 +836,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
                                                started = 1;
                                        }
                                        start = ast_tvnow();
-                                       snprintf(tmp, sizeof(tmp), "%c", f->subclass);
+                                       snprintf(tmp, sizeof(tmp), "%c", f->subclass.integer);
                                        strncat(dtmf, tmp, sizeof(dtmf) - strlen(dtmf) - 1);
                                        /* If the maximum length of the DTMF has been reached, stop now */
                                        if (max_dtmf_len && strlen(dtmf) == max_dtmf_len)
@@ -844,7 +844,7 @@ static int speech_background(struct ast_channel *chan, const char *data)
                                }
                                break;
                        case AST_FRAME_CONTROL:
-                               switch (f->subclass) {
+                               switch (f->subclass.integer) {
                                case AST_CONTROL_HANGUP:
                                        /* Since they hung up we should destroy the speech structure */
                                        done = 3;
index 83b8886..0db0012 100644 (file)
@@ -173,15 +173,15 @@ static int background_detect_exec(struct ast_channel *chan, const char *data)
                                        break;
                                } else if (fr->frametype == AST_FRAME_DTMF) {
                                        char t[2];
-                                       t[0] = fr->subclass;
+                                       t[0] = fr->subclass.integer;
                                        t[1] = '\0';
                                        if (ast_canmatch_extension(chan, chan->context, t, 1, chan->cid.cid_num)) {
                                                /* They entered a valid  extension, or might be anyhow */
-                                               res = fr->subclass;
+                                               res = fr->subclass.integer;
                                                ast_frfree(fr);
                                                break;
                                        }
-                               } else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass == AST_FORMAT_SLINEAR) && continue_analysis) {
+                               } else if ((fr->frametype == AST_FRAME_VOICE) && (fr->subclass.codec == AST_FORMAT_SLINEAR) && continue_analysis) {
                                        int totalsilence;
                                        int ms;
                                        res = ast_dsp_silence(dsp, fr, &totalsilence);
index 64ce7b4..a7aa7b6 100644 (file)
@@ -106,7 +106,7 @@ static int measurenoise(struct ast_channel *chan, int ms, char *who)
                        res = -1;
                        break;
                }
-               if ((f->frametype == AST_FRAME_VOICE) && (f->subclass == AST_FORMAT_SLINEAR)) {
+               if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.codec == AST_FORMAT_SLINEAR)) {
                        foo = (short *)f->data.ptr;
                        for (x=0;x<f->samples;x++) {
                                noise += abs(foo[x]);
index a36daa2..533c112 100644 (file)
@@ -139,7 +139,7 @@ static int sendurl_exec(struct ast_channel *chan, const char *data)
                                break;
                        }
                        if (f->frametype == AST_FRAME_HTML) {
-                               switch(f->subclass) {
+                               switch (f->subclass.integer) {
                                case AST_HTML_LDCOMPLETE:
                                        res = 0;
                                        ast_frfree(f);
@@ -154,7 +154,7 @@ static int sendurl_exec(struct ast_channel *chan, const char *data)
                                        goto out;
                                        break;
                                default:
-                                       ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass);
+                                       ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass.integer);
                                };
                        }
                        ast_frfree(f);
index dfe33db..1df6079 100644 (file)
@@ -78,7 +78,7 @@ static int waitforring_exec(struct ast_channel *chan, const char *data)
                                res = -1;
                                break;
                        }
-                       if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_RING)) {
+                       if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_RING)) {
                                ast_verb(3, "Got a ring but still waiting for timeout\n");
                        }
                        ast_frfree(f);
@@ -99,7 +99,7 @@ static int waitforring_exec(struct ast_channel *chan, const char *data)
                                        res = -1;
                                        break;
                                }
-                               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_RING)) {
+                               if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_RING)) {
                                        ast_verb(3, "Got a ring after the timeout\n");
                                        ast_frfree(f);
                                        break;
index a980386..3cddc42 100644 (file)
@@ -123,9 +123,9 @@ static int softmix_bridge_join(struct ast_bridge *bridge, struct ast_bridge_chan
        /* Setup frame parameters */
        sc->frame.frametype = AST_FRAME_VOICE;
 #ifdef SOFTMIX_16_SUPPORT
-       sc->frame.subclass = AST_FORMAT_SLINEAR16;
+       sc->frame.subclass.codec = AST_FORMAT_SLINEAR16;
 #else
-       sc->frame.subclass = AST_FORMAT_SLINEAR;
+       sc->frame.subclass.codec = AST_FORMAT_SLINEAR;
 #endif
        sc->frame.data.ptr = sc->final_buf;
        sc->frame.datalen = SOFTMIX_DATALEN;
@@ -168,9 +168,9 @@ static enum ast_bridge_write_result softmix_bridge_write(struct ast_bridge *brid
 
        /* If a frame was provided add it to the smoother */
 #ifdef SOFTMIX_16_SUPPORT
-       if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR16) {
+       if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR16) {
 #else
-       if (frame->frametype == AST_FRAME_VOICE && frame->subclass == AST_FORMAT_SLINEAR) {
+       if (frame->frametype == AST_FRAME_VOICE && frame->subclass.codec == AST_FORMAT_SLINEAR) {
 #endif
                ast_slinfactory_feed(&sc->factory, frame);
        }
index 0d0159c..0bc35c0 100644 (file)
@@ -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)
index ffc62c8..ca6c078 100644 (file)
@@ -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);
                                }
index be823cd..db26466 100644 (file)
@@ -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;
 
index ead0b12..9141c3d 100644 (file)
@@ -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);
 
index b81c7a8..77caff8 100644 (file)
@@ -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");
index 25fdc2c..8655806 100644 (file)
@@ -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;
index 897416a..3ccfde2 100644 (file)
@@ -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;
index d6deac7..1948bc5 100644 (file)
@@ -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;
index 1461b83..c1181db 100644 (file)
@@ -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;
index c699a5c..f26084b 100644 (file)
@@ -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;
index a03de42..e3cc64e 100644 (file)
@@ -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;
index 3adcf7b..fdf4cf2 100644 (file)
@@ -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;
index d2bbc68..24c0732 100644 (file)
@@ -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)) {
index d7b6cc3..6e1fff8 100644 (file)
@@ -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;
index 736fb27..b84c39c 100644 (file)
@@ -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;
                }
        }
index 8934c1a..438df8f 100644 (file)
@@ -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;