[asterisk-commits] tilghman: branch tilghman/codec_bits3 r223799 - in /team/tilghman/codec_bits3...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 12 17:04:33 CDT 2009
Author: tilghman
Date: Mon Oct 12 17:04:27 2009
New Revision: 223799
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223799
Log:
Commit first session. Not a full pass, doesn't fully compile, but it's a start.
Modified:
team/tilghman/codec_bits3/channels/chan_agent.c
team/tilghman/codec_bits3/channels/chan_bridge.c
team/tilghman/codec_bits3/channels/chan_h323.c
team/tilghman/codec_bits3/channels/chan_iax2.c
team/tilghman/codec_bits3/channels/chan_local.c
team/tilghman/codec_bits3/channels/chan_mgcp.c
team/tilghman/codec_bits3/channels/h323/chan_h323.h
team/tilghman/codec_bits3/include/asterisk/channel.h
team/tilghman/codec_bits3/include/asterisk/frame.h
team/tilghman/codec_bits3/include/asterisk/rtp_engine.h
Modified: team/tilghman/codec_bits3/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_agent.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_agent.c (original)
+++ team/tilghman/codec_bits3/channels/chan_agent.c Mon Oct 12 17:04:27 2009
@@ -280,10 +280,11 @@
#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 @@
} 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);
@@ -1334,7 +1335,7 @@
}
/*! \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;
Modified: team/tilghman/codec_bits3/channels/chan_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_bridge.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_bridge.c (original)
+++ team/tilghman/codec_bits3/channels/chan_bridge.c Mon Oct 12 17:04:27 2009
@@ -46,7 +46,7 @@
#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 @@
}
/*! \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;
Modified: team/tilghman/codec_bits3/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_h323.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_h323.c (original)
+++ team/tilghman/codec_bits3/channels/chan_h323.c Mon Oct 12 17:04:27 2009
@@ -230,7 +230,7 @@
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);
@@ -768,7 +768,7 @@
return &ast_null_frame;
}
if (h323debug)
- ast_debug(1, "Oooh, format changed to %d\n", f->subclass);
+ ast_debug(1, "Oooh, format changed to '%s'\n", ast_getformatname(f->subclass));
pvt->owner->nativeformats = f->subclass;
pvt->nativeformats = f->subclass;
ast_set_read_format(pvt->owner, pvt->owner->readformat);
@@ -790,7 +790,7 @@
}
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", (char) f->subclass);
}
}
}
@@ -836,8 +836,9 @@
}
} 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);
+ 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), ast_getformatname_multiple(tmp, sizeof(tmp), c->nativeformats), ast_getformatname(c->readformat), ast_getformatname(c->writeformat));
return 0;
}
}
@@ -1717,9 +1718,9 @@
return 0;
}
}
-static struct ast_channel *oh323_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-{
- int oldformat;
+static struct ast_channel *oh323_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+{
+ format_t oldformat;
struct oh323_pvt *pvt;
struct ast_channel *tmpc = NULL;
char *dest = (char *)data;
@@ -1728,7 +1729,7 @@
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 @@
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;
@@ -1983,7 +1984,7 @@
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 @@
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 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;
Modified: team/tilghman/codec_bits3/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_iax2.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_iax2.c (original)
+++ team/tilghman/codec_bits3/channels/chan_iax2.c Mon Oct 12 17:04:27 2009
@@ -352,7 +352,7 @@
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 @@
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 @@
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 @@
/*! 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 @@
/*! 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 */
@@ -1169,7 +1169,7 @@
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);
@@ -3308,7 +3308,7 @@
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 = %llu, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, (unsigned long long) f->af.subclass, 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 };
@@ -4322,7 +4322,7 @@
}
struct create_addr_info {
- int capability;
+ format_t capability;
uint64_t flags;
int maxtime;
int encmethods;
@@ -4388,7 +4388,7 @@
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);
@@ -5231,11 +5231,11 @@
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])
@@ -5431,7 +5431,7 @@
}
/*! \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;
@@ -9712,7 +9712,7 @@
}
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, %llu)\n", fh->oseqno, f.frametype, (unsigned long long) f.subclass);
/* Check if it's out of order (and not an ACK or INVAL) */
fr->oseqno = fh->oseqno;
fr->iseqno = fh->iseqno;
@@ -9752,8 +9752,8 @@
(f.subclass != 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);
+ ast_debug(1, "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %llu)\n",
+ iaxs[fr->callno]->iseqno, fr->oseqno, f.frametype, (unsigned long long) f.subclass);
/* 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) {
@@ -9923,7 +9923,7 @@
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);
+ ast_debug(1, "Ooh, voice format changed to '%s'\n", ast_getformatname(f.subclass));
if (iaxs[fr->callno]->owner) {
int orignative;
retryowner:
@@ -9956,7 +9956,7 @@
}
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);
+ ast_debug(1, "Ooh, video format changed to %llu\n", (unsigned long long) f.subclass & ~0x1);
iaxs[fr->callno]->videoformat = f.subclass & ~0x1;
}
}
@@ -9971,7 +9971,7 @@
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 %llu received\n", (unsigned long long) f.subclass);
/* Update last ts unless the frame's timestamp originated with us. */
if (iaxs[fr->callno]->last < fr->ts &&
@@ -10166,10 +10166,19 @@
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... */
@@ -10200,17 +10209,23 @@
}
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;
}
@@ -10385,8 +10400,13 @@
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) {
@@ -10590,16 +10610,26 @@
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");
@@ -10638,12 +10668,22 @@
}
}
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");
@@ -10747,8 +10787,11 @@
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)))
@@ -11014,7 +11057,7 @@
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 %llu on %d/%d\n", (unsigned long long) f.subclass, fr->callno, iaxs[fr->callno]->peercallno);
memset(&ied0, 0, sizeof(ied0));
iax_ie_append_byte(&ied0, IAX_IE_IAX_UNKNOWN, f.subclass);
send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_UNSUPPORT, 0, ied0.buf, ied0.pos, -1);
@@ -11141,7 +11184,7 @@
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 %llu, ts = %d, last = %d)\n", f.frametype, (unsigned long long) f.subclass, fr->ts, iaxs[fr->callno]->last);
fr->outoforder = -1;
}
fr->cacheable = ((f.frametype == AST_FRAME_VOICE) || (f.frametype == AST_FRAME_VIDEO));
@@ -11599,7 +11642,7 @@
}
}
-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;
@@ -12508,7 +12551,7 @@
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;
Modified: team/tilghman/codec_bits3/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_local.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_local.c (original)
+++ team/tilghman/codec_bits3/channels/chan_local.c Mon Oct 12 17:04:27 2009
@@ -60,7 +60,7 @@
.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);
@@ -846,7 +846,7 @@
}
/*! \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;
Modified: team/tilghman/codec_bits3/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/chan_mgcp.c?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/chan_mgcp.c (original)
+++ team/tilghman/codec_bits3/channels/chan_mgcp.c Mon Oct 12 17:04:27 2009
@@ -211,7 +211,7 @@
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];
@@ -344,7 +344,7 @@
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 */
@@ -410,7 +410,7 @@
static int transmit_notify_request(struct mgcp_subchannel *sub, char *tone);
static int transmit_modify_request(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);
@@ -420,7 +420,7 @@
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);
@@ -1859,7 +1859,8 @@
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;
@@ -1925,8 +1926,11 @@
ast_rtp_codecs_payload_formats(ast_rtp_instance_get_codecs(sub->rtp), &peercapability, &peerNonCodecCapability);
p->capability = capability & peercapability;
if (mgcpdebug) {
- ast_verbose("Capabilities: us - %d, them - %d, combined - %d\n",
- capability, peercapability, p->capability);
+ char tmp1[256], tmp2[256], tmp3[256];
+ ast_verbose("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_verbose("Non-codec capabilities: us - %d, them - %d, combined - %d\n",
nonCodecCapability, peerNonCodecCapability, p->nonCodecCapability);
}
@@ -2073,7 +2077,7 @@
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
@@ -2107,9 +2111,13 @@
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) {
+ if (!(x & AST_FORMAT_AUDIO_MASK)) {
+ /* Audio is now discontiguous */
+ continue;
+ }
if (p->capability & x) {
if (mgcpdebug) {
- ast_verbose("Answering with capability %d\n", x);
+ ast_verbose("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) {
@@ -2123,7 +2131,7 @@
for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
if (p->nonCodecCapability & x) {
if (mgcpdebug) {
- ast_verbose("Answering with non-codec capability %d\n", x);
+ ast_verbose("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) {
@@ -2153,12 +2161,12 @@
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];
- int x;
+ format_t x;
struct mgcp_endpoint *p = sub->parent;
if (ast_strlen_zero(sub->cxident) && rtp) {
@@ -2169,6 +2177,10 @@
}
ast_copy_string(local, "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);
@@ -2199,6 +2211,10 @@
ast_copy_string(local, "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);
@@ -3507,9 +3523,9 @@
return 0;
}
-static struct ast_channel *mgcp_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause)
-{
- int oldformat;
+static struct ast_channel *mgcp_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
+{
+ format_t oldformat;
struct mgcp_subchannel *sub;
struct ast_channel *tmpc = NULL;
char tmp[256];
@@ -3998,7 +4014,7 @@
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;
Modified: team/tilghman/codec_bits3/channels/h323/chan_h323.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/channels/h323/chan_h323.h?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/channels/h323/chan_h323.h (original)
+++ team/tilghman/codec_bits3/channels/h323/chan_h323.h Mon Oct 12 17:04:27 2009
@@ -64,7 +64,7 @@
int progress_audio;
int dtmfcodec[2];
int dtmfmode;
- int capability;
+ uint64_t capability;
int bridge;
int nat;
int tunnelOptions;
Modified: team/tilghman/codec_bits3/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/codec_bits3/include/asterisk/channel.h?view=diff&rev=223799&r1=223798&r2=223799
==============================================================================
--- team/tilghman/codec_bits3/include/asterisk/channel.h (original)
+++ team/tilghman/codec_bits3/include/asterisk/channel.h Mon Oct 12 17:04:27 2009
@@ -373,12 +373,12 @@
const char * const type;
const char * const description;
- int capabilities; /*!< Bitmap of formats this channel can handle */
-
- int properties; /*!< Technology Properties */
+ format_t capabilities; /*!< Bitmap of formats this channel can handle */
+
+ int properties; /*!< Technology Properties */
/*! \brief Requester - to set up call data structures (pvt's) */
- struct ast_channel *(* const requester)(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+ struct ast_channel *(* const requester)(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
int (* const devicestate)(void *data); /*!< Devicestate call back */
@@ -702,11 +702,11 @@
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
int alertpipe[2];
- int nativeformats; /*!< Kinds of data this channel can natively handle */
- int readformat; /*!< Requested read format */
- int writeformat; /*!< Requested write format */
- int rawreadformat; /*!< Raw read format */
- int rawwriteformat; /*!< Raw write format */
+ format_t nativeformats; /*!< Kinds of data this channel can natively handle */
+ format_t readformat; /*!< Requested read format */
+ format_t writeformat; /*!< Requested write format */
+ format_t rawreadformat; /*!< Raw read format */
+ format_t rawwriteformat; /*!< Raw write format */
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
#ifdef HAVE_EPOLL
int epfd;
@@ -1547,7 +1547,7 @@
* \param format format to change to
* \return Returns 0 on success, -1 on failure
*/
-int ast_set_read_format(struct ast_channel *chan, int format);
[... 293 lines stripped ...]
More information about the asterisk-commits
mailing list