[asterisk-commits] branch oej/jitterbuffer r9033 - in
/team/oej/jitterbuffer: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Feb 1 03:35:17 MST 2006
Author: oej
Date: Wed Feb 1 04:35:07 2006
New Revision: 9033
URL: http://svn.digium.com/view/asterisk?rev=9033&view=rev
Log:
Merged revisions 8991,9001,9004,9013 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r8991 | oej | 2006-01-31 17:02:35 +0100 (Tue, 31 Jan 2006) | 4 lines
- Moving two session (PVT) flags to peer PAGE2 (DYNAMIC and SELFDESTRUCT) to make room for more session-related flags
This is needed for integrating patches in the bug tracker
- Adding doxygen comments
........
r9001 | russell | 2006-01-31 18:18:58 +0100 (Tue, 31 Jan 2006) | 3 lines
define a global null_frame object so when queueing a null frame, you don't
have to allocate one on the stack
........
r9004 | russell | 2006-01-31 18:57:12 +0100 (Tue, 31 Jan 2006) | 2 lines
remove some more local declarations of null frames
........
r9013 | oej | 2006-01-31 19:40:07 +0100 (Tue, 31 Jan 2006) | 3 lines
Optimize settings of defaults for a new peer object and make sure
we set the same defaults for autocreated peers and other peers.
........
Modified:
team/oej/jitterbuffer/ (props changed)
team/oej/jitterbuffer/apps/app_meetme.c
team/oej/jitterbuffer/channel.c
team/oej/jitterbuffer/channels/chan_agent.c
team/oej/jitterbuffer/channels/chan_features.c
team/oej/jitterbuffer/channels/chan_h323.c
team/oej/jitterbuffer/channels/chan_iax2.c
team/oej/jitterbuffer/channels/chan_local.c
team/oej/jitterbuffer/channels/chan_mgcp.c
team/oej/jitterbuffer/channels/chan_sip.c
team/oej/jitterbuffer/channels/chan_zap.c
team/oej/jitterbuffer/frame.c
team/oej/jitterbuffer/include/asterisk/frame.h
team/oej/jitterbuffer/rtp.c
team/oej/jitterbuffer/udptl.c
Propchange: team/oej/jitterbuffer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 1 04:35:07 2006
@@ -1,1 +1,1 @@
-/trunk:1-8986
+/trunk:1-9032
Modified: team/oej/jitterbuffer/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/apps/app_meetme.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/apps/app_meetme.c (original)
+++ team/oej/jitterbuffer/apps/app_meetme.c Wed Feb 1 04:35:07 2006
@@ -206,7 +206,6 @@
};
static int admin_exec(struct ast_channel *chan, void *data);
-static struct ast_frame null_frame = { AST_FRAME_NULL, };
static void *recordthread(void *args);
@@ -1574,7 +1573,7 @@
if (conf->transpath[index]) {
conf->transframe[index] = ast_translate(conf->transpath[index], conf->origframe, 0);
if (!conf->transframe[index])
- conf->transframe[index] = &null_frame;
+ conf->transframe[index] = &ast_null_frame;
}
}
}
Modified: team/oej/jitterbuffer/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channel.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channel.c (original)
+++ team/oej/jitterbuffer/channel.c Wed Feb 1 04:35:07 2006
@@ -1765,17 +1765,13 @@
void *data;
int res;
#endif
- static struct ast_frame null_frame = {
- AST_FRAME_NULL,
- };
-
ast_mutex_lock(&chan->lock);
if (chan->masq) {
if (ast_do_masquerade(chan)) {
ast_log(LOG_WARNING, "Failed to perform masquerade\n");
f = NULL;
} else
- f = &null_frame;
+ f = &ast_null_frame;
ast_mutex_unlock(&chan->lock);
return f;
}
@@ -1843,8 +1839,7 @@
chan->timingdata = NULL;
ast_mutex_unlock(&chan->lock);
}
- f = &null_frame;
- return f;
+ return &ast_null_frame;
} else
ast_log(LOG_NOTICE, "No/unknown event '%d' on timer for '%s'?\n", blah, chan->name);
} else
@@ -1856,8 +1851,7 @@
chan->generatordata = NULL; /* reset to let ast_write get through */
chan->generator->generate(chan, tmp, -1, -1);
chan->generatordata = tmp;
- f = &null_frame;
- return f;
+ return &ast_null_frame;
}
/* Check for pending read queue */
@@ -1877,7 +1871,7 @@
f = chan->tech->exception(chan);
else {
ast_log(LOG_WARNING, "Exception flag set on '%s', but no exception handler\n", chan->name);
- f = &null_frame;
+ f = &ast_null_frame;
}
/* Clear the exception flag */
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
@@ -1903,7 +1897,7 @@
if (f->subclass == AST_CONTROL_ANSWER) {
if (prestate == AST_STATE_UP) {
ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
- f = &null_frame;
+ f = &ast_null_frame;
}
/* Answer the CDR */
ast_setstate(chan, AST_STATE_UP);
@@ -1917,7 +1911,7 @@
chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
else
ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
- f = &null_frame;
+ f = &ast_null_frame;
}
break;
case AST_FRAME_DTMF_BEGIN:
@@ -1929,14 +1923,14 @@
case AST_FRAME_VOICE:
if (dropaudio) {
ast_frfree(f);
- f = &null_frame;
+ f = &ast_null_frame;
} else if (!(f->subclass & chan->nativeformats)) {
/* This frame can't be from the current native formats -- drop it on the
floor */
ast_log(LOG_NOTICE, "Dropping incompatible voice frame on %s of format %s since our native format has changed to %s\n",
chan->name, ast_getformatname(f->subclass), ast_getformatname(chan->nativeformats));
ast_frfree(f);
- f = &null_frame;
+ f = &ast_null_frame;
} else {
if (chan->spies)
queue_frame_to_spies(chan, f, SPY_READ);
@@ -1967,7 +1961,7 @@
if (chan->readtrans) {
if (!(f = ast_translate(chan->readtrans, f, 1)))
- f = &null_frame;
+ f = &ast_null_frame;
}
/* Run any generator sitting on the channel */
@@ -3126,10 +3120,9 @@
);
ast_channel_free(clone);
} else {
- struct ast_frame null_frame = { AST_FRAME_NULL, };
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
ast_set_flag(clone, AST_FLAG_ZOMBIE);
- ast_queue_frame(clone, &null_frame);
+ ast_queue_frame(clone, &ast_null_frame);
ast_mutex_unlock(&clone->lock);
}
Modified: team/oej/jitterbuffer/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_agent.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_agent.c (original)
+++ team/oej/jitterbuffer/channels/chan_agent.c Wed Feb 1 04:35:07 2006
@@ -438,7 +438,6 @@
{
struct agent_pvt *p = ast->tech_pvt;
struct ast_frame *f = NULL;
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
static struct ast_frame answer_frame = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
const char *status;
ast_mutex_lock(&p->lock);
@@ -448,7 +447,7 @@
p->chan->fdno = (ast->fdno == AST_AGENT_FD) ? AST_TIMING_FD : ast->fdno;
f = ast_read(p->chan);
} else
- f = &null_frame;
+ f = &ast_null_frame;
if (!f) {
/* If there's a channel, hang it up (if it's on a callback) make it NULL */
if (p->chan) {
@@ -486,7 +485,7 @@
ast_verbose(VERBOSE_PREFIX_3 "%s answered, waiting for '#' to acknowledge\n", p->chan->name);
/* Don't pass answer along */
ast_frfree(f);
- f = &null_frame;
+ f = &ast_null_frame;
} else {
p->acknowledged = 1;
/* Use the builtin answer frame for the
@@ -513,7 +512,7 @@
/* don't pass voice until the call is acknowledged */
if (!p->acknowledged) {
ast_frfree(f);
- f = &null_frame;
+ f = &ast_null_frame;
}
break;
}
@@ -899,7 +898,6 @@
static struct ast_channel *agent_new(struct agent_pvt *p, int state)
{
struct ast_channel *tmp;
- struct ast_frame null_frame = { AST_FRAME_NULL };
#if 0
if (!p->chan) {
ast_log(LOG_WARNING, "No channel? :(\n");
@@ -950,7 +948,7 @@
if( ast_mutex_trylock(&p->app_lock) )
{
if (p->chan) {
- ast_queue_frame(p->chan, &null_frame);
+ ast_queue_frame(p->chan, &ast_null_frame);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
ast_mutex_lock(&p->app_lock);
ast_mutex_lock(&p->lock);
Modified: team/oej/jitterbuffer/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_features.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_features.c (original)
+++ team/oej/jitterbuffer/channels/chan_features.c Wed Feb 1 04:35:07 2006
@@ -241,12 +241,11 @@
static struct ast_frame *features_read(struct ast_channel *ast)
{
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
struct feature_pvt *p = ast->tech_pvt;
struct ast_frame *f;
int x;
- f = &null_frame;
+ f = &ast_null_frame;
ast_mutex_lock(&p->lock);
x = indexof(p, ast, 0);
if (!x && p->subchan) {
Modified: team/oej/jitterbuffer/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_h323.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_h323.c (original)
+++ team/oej/jitterbuffer/channels/chan_h323.c Wed Feb 1 04:35:07 2006
@@ -543,7 +543,6 @@
{
/* Retrieve audio/etc from channel. Assumes pvt->lock is already held. */
struct ast_frame *f;
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
/* Only apply it for the first packet, we just need the correct ip/port */
if (pvt->options.nat) {
@@ -554,7 +553,7 @@
f = ast_rtp_read(pvt->rtp);
/* Don't send RFC2833 if we're not supposed to */
if (f && (f->frametype == AST_FRAME_DTMF) && !(pvt->options.dtmfmode & H323_DTMF_RFC2833)) {
- return &null_frame;
+ return &ast_null_frame;
}
if (pvt->owner) {
/* We already hold the channel lock */
@@ -563,7 +562,7 @@
/* Try to avoid deadlock */
if (ast_mutex_trylock(&pvt->owner->lock)) {
ast_log(LOG_NOTICE, "Format changed but channel is locked. Ignoring frame...\n");
- return &null_frame;
+ return &ast_null_frame;
}
ast_log(LOG_DEBUG, "Oooh, format changed to %d\n", f->subclass);
pvt->owner->nativeformats = f->subclass;
Modified: team/oej/jitterbuffer/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_iax2.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_iax2.c (original)
+++ team/oej/jitterbuffer/channels/chan_iax2.c Wed Feb 1 04:35:07 2006
@@ -3106,9 +3106,8 @@
static struct ast_frame *iax2_read(struct ast_channel *c)
{
- static struct ast_frame f = { AST_FRAME_NULL, };
ast_log(LOG_NOTICE, "I should never be called!\n");
- return &f;
+ return &ast_null_frame;
}
static int iax2_start_transfer(unsigned short callno0, unsigned short callno1)
Modified: team/oej/jitterbuffer/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_local.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_local.c (original)
+++ team/oej/jitterbuffer/channels/chan_local.c Wed Feb 1 04:35:07 2006
@@ -224,9 +224,7 @@
static struct ast_frame *local_read(struct ast_channel *ast)
{
- static struct ast_frame null = { AST_FRAME_NULL, };
-
- return &null;
+ return &ast_null_frame;
}
static int local_write(struct ast_channel *ast, struct ast_frame *f)
Modified: team/oej/jitterbuffer/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_mgcp.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_mgcp.c (original)
+++ team/oej/jitterbuffer/channels/chan_mgcp.c Wed Feb 1 04:35:07 2006
@@ -1219,12 +1219,11 @@
{
/* Retrieve audio/etc from channel. Assumes sub->lock is already held. */
struct ast_frame *f;
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
f = ast_rtp_read(sub->rtp);
/* Don't send RFC2833 if we're not supposed to */
if (f && (f->frametype == AST_FRAME_DTMF) && !(sub->parent->dtmfmode & MGCP_DTMF_RFC2833))
- return &null_frame;
+ return &ast_null_frame;
if (sub->owner) {
/* We already hold the channel lock */
if (f->frametype == AST_FRAME_VOICE) {
Modified: team/oej/jitterbuffer/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_sip.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_sip.c (original)
+++ team/oej/jitterbuffer/channels/chan_sip.c Wed Feb 1 04:35:07 2006
@@ -34,6 +34,7 @@
* \todo Better support of forking
*
* \ingroup channel_drivers
+ *
*/
@@ -500,11 +501,13 @@
enum sip_auth_type auth_type; /*!< Authentication type */
};
+/*! \brief Structure to save routing information for a SIP session */
struct sip_route {
struct sip_route *next;
char hop[0];
};
+/*! \brief Modes for SIP domain handling in the PBX */
enum domain_mode {
SIP_DOMAIN_AUTO, /*!< This domain is auto-configured */
SIP_DOMAIN_CONFIG, /*!< This domain is from configuration */
@@ -537,7 +540,9 @@
struct sip_auth *next; /*!< Next auth structure in list */
};
-/*--- Various flags for the flags field in the pvt structure */
+/*--- Various flags for the flags field in the pvt structure
+ Peer only flags should be set in PAGE2 below
+*/
#define SIP_ALREADYGONE (1 << 0) /*!< Whether or not we've already been destroyed by our peer */
#define SIP_NEEDDESTROY (1 << 1) /*!< if we need to be destroyed */
#define SIP_NOVIDEO (1 << 2) /*!< Didn't get video in invite, don't offer */
@@ -552,14 +557,13 @@
#define SIP_REALTIME (1 << 11) /*!< Flag for realtime users */
#define SIP_USECLIENTCODE (1 << 12) /*!< Trust X-ClientCode info message */
#define SIP_OUTGOING (1 << 13) /*!< Is this an outgoing call? */
-#define SIP_SELFDESTRUCT (1 << 14)
-#define SIP_DYNAMIC (1 << 15) /*!< Is this a dynamic peer? */
-/* --- Choices for DTMF support in SIP channel */
-#define SIP_DTMF (3 << 16) /*!< three settings, uses two bits */
-#define SIP_DTMF_RFC2833 (0 << 16) /*!< RTP DTMF */
-#define SIP_DTMF_INBAND (1 << 16) /*!< Inband audio, only for ULAW/ALAW */
-#define SIP_DTMF_INFO (2 << 16) /*!< SIP Info messages */
-#define SIP_DTMF_AUTO (3 << 16) /*!< AUTO switch between rfc2833 and in-band DTMF */
+#define SIP_FREEBIT (1 << 14) /*!< Free for session-related use */
+#define SIP_FREEBIT3 (1 << 15) /*!< Free for session-related use */
+#define SIP_DTMF (3 << 16) /*!< DTMF Support: four settings, uses two bits */
+#define SIP_DTMF_RFC2833 (0 << 16) /*!< DTMF Support: RTP DTMF - "rfc2833" */
+#define SIP_DTMF_INBAND (1 << 16) /*!< DTMF Support: Inband audio, only for ULAW/ALAW - "inband" */
+#define SIP_DTMF_INFO (2 << 16) /*!< DTMF Support: SIP Info messages - "info" */
+#define SIP_DTMF_AUTO (3 << 16) /*!< DTMF Support: AUTO switch between rfc2833 and in-band DTMF */
/* NAT settings */
#define SIP_NAT (3 << 18) /*!< four settings, uses two bits */
#define SIP_NAT_NEVER (0 << 18) /*!< No nat support */
@@ -597,7 +601,7 @@
SIP_PROG_INBAND | SIP_OSPAUTH | SIP_USECLIENTCODE | SIP_NAT | \
SIP_INSECURE_PORT | SIP_INSECURE_INVITE)
-/* a new page of flags for peer */
+/* a new page of flags for peers */
#define SIP_PAGE2_RTCACHEFRIENDS (1 << 0)
#define SIP_PAGE2_RTUPDATE (1 << 1)
#define SIP_PAGE2_RTAUTOCLEAR (1 << 2)
@@ -606,6 +610,8 @@
#define SIP_PAGE2_DEBUG (3 << 5)
#define SIP_PAGE2_DEBUG_CONFIG (1 << 5)
#define SIP_PAGE2_DEBUG_CONSOLE (1 << 6)
+#define SIP_PAGE2_DYNAMIC (1 << 7) /*!< Dynamic Peers register with Asterisk */
+#define SIP_PAGE2_SELFDESTRUCT (1 << 8) /*!< Automatic peers need to destruct themselves */
/* SIP packet flags */
#define SIP_PKT_DEBUG (1 << 0) /*!< Debug this packet */
@@ -977,6 +983,9 @@
static int sip_poke_peer(struct sip_peer *peer);
static int __sip_do_register(struct sip_registry *r);
static int restart_monitor(void);
+static void set_peer_defaults(struct sip_peer *peer);
+static struct sip_peer *temp_peer(const char *name);
+
/*----- RTP interface functions */
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);
@@ -1333,7 +1342,9 @@
return 0;
}
-/*! \brief Transmit packet with retransmits */
+/*! \brief Transmit packet with retransmits
+ \return 0 on success, -1 on failure to allocate packet
+*/
static int __sip_reliable_xmit(struct sip_pvt *p, int seqno, int resp, char *data, int len, int fatal, int sipmethod)
{
struct sip_pkt *pkt;
@@ -1700,7 +1711,7 @@
ast_sched_del(sched, peer->pokeexpire);
register_peer_exten(peer, 0);
ast_free_ha(peer->ha);
- if (ast_test_flag(peer, SIP_SELFDESTRUCT))
+ if (ast_test_flag((&peer->flags_page2), SIP_PAGE2_SELFDESTRUCT))
apeerobjs--;
else if (ast_test_flag(peer, SIP_REALTIME))
rpeerobjs--;
@@ -3071,11 +3082,10 @@
{
/* Retrieve audio/etc from channel. Assumes p->lock is already held. */
struct ast_frame *f;
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
if (!p->rtp) {
/* We have no RTP allocated for this channel */
- return &null_frame;
+ return &ast_null_frame;
}
switch(ast->fdno) {
@@ -3092,11 +3102,11 @@
f = ast_rtcp_read(p->vrtp); /* RTCP Control Channel for video */
break;
default:
- f = &null_frame;
+ f = &ast_null_frame;
}
/* Don't forward RFC2833 if we're not supposed to */
if (f && (f->frametype == AST_FRAME_DTMF) && (ast_test_flag(p, SIP_DTMF) != SIP_DTMF_RFC2833))
- return &null_frame;
+ return &ast_null_frame;
if (p->owner) {
/* We already hold the channel lock */
@@ -3784,12 +3794,11 @@
if ((bridgepeer=ast_bridged_channel(p->owner))) {
/* We have a bridge */
/* Turn on/off music on hold if we are holding/unholding */
- struct ast_frame af = { AST_FRAME_NULL, };
if (sin.sin_addr.s_addr && !sendonly) {
ast_moh_stop(bridgepeer);
/* Activate a re-invite */
- ast_queue_frame(p->owner, &af);
+ ast_queue_frame(p->owner, &ast_null_frame);
} else {
/* No address for RTP, we're on hold */
@@ -3797,7 +3806,7 @@
if (sendonly)
ast_rtp_stop(p->rtp);
/* Activate a re-invite */
- ast_queue_frame(p->owner, &af);
+ ast_queue_frame(p->owner, &ast_null_frame);
}
}
@@ -5791,7 +5800,7 @@
register_peer_exten(peer, 0);
peer->expire = -1;
ast_device_state_changed("SIP/%s", peer->name);
- if (ast_test_flag(peer, SIP_SELFDESTRUCT) || ast_test_flag((&peer->flags_page2), SIP_PAGE2_RTAUTOCLEAR)) {
+ if (ast_test_flag((&peer->flags_page2), SIP_PAGE2_SELFDESTRUCT) || ast_test_flag((&peer->flags_page2), SIP_PAGE2_RTAUTOCLEAR)) {
peer = ASTOBJ_CONTAINER_UNLINK(&peerl, peer);
ASTOBJ_UNREF(peer, sip_destroy_peer);
}
@@ -6523,7 +6532,7 @@
ASTOBJ_UNREF(peer, sip_destroy_peer);
}
if (peer) {
- if (!ast_test_flag(peer, SIP_DYNAMIC)) {
+ if (!ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC)) {
ast_log(LOG_ERROR, "Peer '%s' is trying to register, but not configured as host=dynamic\n", peer->name);
} else {
ast_copy_flags(p, peer, SIP_NAT);
@@ -7683,7 +7692,7 @@
snprintf(srch, sizeof(srch), FORMAT, name,
iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
- ast_test_flag(iterator, SIP_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
+ ast_test_flag((&iterator->flags_page2), SIP_PAGE2_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? " N " : " ", /* NAT=yes? */
iterator->ha ? " A " : " ", /* permit/deny */
ntohs(iterator->addr.sin_port), status);
@@ -7691,7 +7700,7 @@
if (!s) {/* Normal CLI list */
ast_cli(fd, FORMAT, name,
iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "(Unspecified)",
- ast_test_flag(iterator, SIP_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
+ ast_test_flag((&iterator->flags_page2), SIP_PAGE2_DYNAMIC) ? " D " : " ", /* Dynamic or not? */
(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? " N " : " ", /* NAT=yes? */
iterator->ha ? " A " : " ", /* permit/deny */
@@ -7713,7 +7722,7 @@
iterator->name,
iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iterator->addr.sin_addr) : "-none-",
ntohs(iterator->addr.sin_port),
- ast_test_flag(iterator, SIP_DYNAMIC) ? "yes" : "no", /* Dynamic or not? */
+ ast_test_flag((&iterator->flags_page2), SIP_PAGE2_DYNAMIC) ? "yes" : "no", /* Dynamic or not? */
(ast_test_flag(iterator, SIP_NAT) & SIP_NAT_ROUTE) ? "yes" : "no", /* NAT=yes? */
iterator->ha ? "yes" : "no", /* permit/deny */
status);
@@ -8086,7 +8095,7 @@
ast_cli(fd, " VM Extension : %s\n", peer->vmexten);
ast_cli(fd, " LastMsgsSent : %d\n", peer->lastmsgssent);
ast_cli(fd, " Call limit : %d\n", peer->call_limit);
- ast_cli(fd, " Dynamic : %s\n", (ast_test_flag(peer, SIP_DYNAMIC)?"Yes":"No"));
+ ast_cli(fd, " Dynamic : %s\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC)?"Yes":"No"));
ast_cli(fd, " Callerid : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
ast_cli(fd, " Expire : %d\n", peer->expire);
ast_cli(fd, " Insecure : %s\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
@@ -8162,7 +8171,7 @@
ast_cli(fd, "VoiceMailbox: %s\r\n", peer->mailbox);
ast_cli(fd, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
ast_cli(fd, "Call limit: %d\r\n", peer->call_limit);
- ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag(peer, SIP_DYNAMIC)?"Y":"N"));
+ ast_cli(fd, "Dynamic: %s\r\n", (ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC)?"Y":"N"));
ast_cli(fd, "Callerid: %s\r\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, ""));
ast_cli(fd, "RegExpire: %ld seconds\r\n", ast_sched_when(sched,peer->expire));
ast_cli(fd, "SIP-AuthInsecure: %s\r\n", insecure2str(ast_test_flag(peer, SIP_INSECURE_PORT), ast_test_flag(peer, SIP_INSECURE_INVITE)));
@@ -9401,7 +9410,7 @@
} else if (!strcasecmp(colname, "expire")) {
snprintf(buf, len, "%d", peer->expire);
} else if (!strcasecmp(colname, "dynamic")) {
- ast_copy_string(buf, (ast_test_flag(peer, SIP_DYNAMIC) ? "yes" : "no"), len);
+ ast_copy_string(buf, (ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC) ? "yes" : "no"), len);
} else if (!strcasecmp(colname, "callerid_name")) {
ast_copy_string(buf, peer->cid_name, len);
} else if (!strcasecmp(colname, "callerid_num")) {
@@ -9644,8 +9653,7 @@
#endif
ast_queue_control(p->owner, AST_CONTROL_ANSWER);
} else { /* RE-invite */
- struct ast_frame af = { AST_FRAME_NULL, };
- ast_queue_frame(p->owner, &af);
+ ast_queue_frame(p->owner, &ast_null_frame);
}
} else {
/* It's possible we're getting an ACK after we've tried to disconnect
@@ -10379,7 +10387,6 @@
int res = 1;
struct ast_channel *c=NULL;
int gotdest;
- struct ast_frame af = { AST_FRAME_NULL, };
char *supported;
char *required;
unsigned int required_profile = 0;
@@ -10471,7 +10478,7 @@
/* Queue NULL frame to prod ast_rtp_bridge if appropriate */
if (p->owner)
- ast_queue_frame(p->owner, &af);
+ ast_queue_frame(p->owner, &ast_null_frame);
/* Initialize the context if it hasn't been already */
if (ast_strlen_zero(p->context))
@@ -12077,20 +12084,11 @@
return user;
}
-/*! \brief Create temporary peer (used in autocreatepeer mode) */
-static struct sip_peer *temp_peer(const char *name)
-{
- struct sip_peer *peer;
-
- if (!(peer = ast_calloc(1, sizeof(*peer))))
- return NULL;
-
- apeerobjs++;
- ASTOBJ_INIT(peer);
-
+/*! \brief Set peer defaults before configuring specific configurations */
+static void set_peer_defaults(struct sip_peer *peer)
+{
peer->expire = -1;
peer->pokeexpire = -1;
- ast_copy_string(peer->name, name, sizeof(peer->name));
ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY);
strcpy(peer->context, default_context);
strcpy(peer->subscribecontext, default_subscribecontext);
@@ -12098,76 +12096,12 @@
strcpy(peer->musicclass, default_musicclass);
peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
peer->addr.sin_family = AF_INET;
+ peer->defaddr.sin_family = AF_INET;
peer->capability = global_capability;
peer->rtptimeout = global_rtptimeout;
peer->rtpholdtimeout = global_rtpholdtimeout;
peer->rtpkeepalive = global_rtpkeepalive;
- ast_set_flag(peer, SIP_SELFDESTRUCT);
- ast_set_flag(peer, SIP_DYNAMIC);
- peer->prefs = default_prefs;
- reg_source_db(peer);
-
- return peer;
-}
-
-/*! \brief Build peer from configuration (file or realtime static/dynamic) */
-static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int realtime)
-{
- struct sip_peer *peer = NULL;
- struct ast_ha *oldha = NULL;
- int obproxyfound=0;
- int found=0;
- int format=0; /* Ama flags */
- time_t regseconds;
- char *varname = NULL, *varval = NULL;
- struct ast_variable *tmpvar = NULL;
- struct ast_flags peerflags = {(0)};
- struct ast_flags mask = {(0)};
-
-
- if (!realtime)
- /* Note we do NOT use find_peer here, to avoid realtime recursion */
- /* We also use a case-sensitive comparison (unlike find_peer) so
- that case changes made to the peer name will be properly handled
- during reload
- */
- peer = ASTOBJ_CONTAINER_FIND_UNLINK_FULL(&peerl, name, name, 0, 0, strcmp);
-
- if (peer) {
- /* Already in the list, remove it and it will be added back (or FREE'd) */
- found++;
- } else {
- if (!(peer = ast_calloc(1, sizeof(*peer))))
- return NULL;
-
- if (realtime)
- rpeerobjs++;
- else
- speerobjs++;
- ASTOBJ_INIT(peer);
- peer->expire = -1;
- peer->pokeexpire = -1;
- }
- /* Note that our peer HAS had its reference count incrased */
-
- peer->lastmsgssent = -1;
- if (!found) {
- if (name)
- ast_copy_string(peer->name, name, sizeof(peer->name));
- peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
- peer->addr.sin_family = AF_INET;
- peer->defaddr.sin_family = AF_INET;
- }
- /* If we have channel variables, remove them (reload) */
- if (peer->chanvars) {
- ast_variables_destroy(peer->chanvars);
- peer->chanvars = NULL;
- }
- strcpy(peer->context, default_context);
- strcpy(peer->subscribecontext, default_subscribecontext);
strcpy(peer->vmexten, default_vmexten);
- strcpy(peer->language, default_language);
- strcpy(peer->musicclass, default_musicclass);
ast_copy_flags(peer, &global_flags, SIP_USEREQPHONE);
peer->secret[0] = '\0';
peer->md5secret[0] = '\0';
@@ -12179,16 +12113,87 @@
peer->mailbox[0] = '\0';
peer->callgroup = 0;
peer->pickupgroup = 0;
- peer->rtpkeepalive = global_rtpkeepalive;
peer->maxms = default_qualify;
peer->prefs = default_prefs;
+}
+
+/*! \brief Create temporary peer (used in autocreatepeer mode) */
+static struct sip_peer *temp_peer(const char *name)
+{
+ struct sip_peer *peer;
+
+ if (!(peer = ast_calloc(1, sizeof(*peer))))
+ return NULL;
+
+ apeerobjs++;
+ ASTOBJ_INIT(peer);
+ set_peer_defaults(peer);
+
+ ast_copy_string(peer->name, name, sizeof(peer->name));
+
+ ast_set_flag((&peer->flags_page2), SIP_PAGE2_SELFDESTRUCT);
+ ast_set_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC);
+ peer->prefs = default_prefs;
+ reg_source_db(peer);
+
+ return peer;
+}
+
+/*! \brief Build peer from configuration (file or realtime static/dynamic) */
+static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int realtime)
+{
+ struct sip_peer *peer = NULL;
+ struct ast_ha *oldha = NULL;
+ int obproxyfound=0;
+ int found=0;
+ int format=0; /* Ama flags */
+ time_t regseconds;
+ char *varname = NULL, *varval = NULL;
+ struct ast_variable *tmpvar = NULL;
+ struct ast_flags peerflags = {(0)};
+ struct ast_flags mask = {(0)};
+
+
+ if (!realtime)
+ /* Note we do NOT use find_peer here, to avoid realtime recursion */
+ /* We also use a case-sensitive comparison (unlike find_peer) so
+ that case changes made to the peer name will be properly handled
+ during reload
+ */
+ peer = ASTOBJ_CONTAINER_FIND_UNLINK_FULL(&peerl, name, name, 0, 0, strcmp);
+
+ if (peer) {
+ /* Already in the list, remove it and it will be added back (or FREE'd) */
+ found++;
+ } else {
+ if (!(peer = ast_calloc(1, sizeof(*peer))))
+ return NULL;
+
+ if (realtime)
+ rpeerobjs++;
+ else
+ speerobjs++;
+ ASTOBJ_INIT(peer);
+ peer->expire = -1;
+ peer->pokeexpire = -1;
+ }
+ /* Note that our peer HAS had its reference count incrased */
+
+ peer->lastmsgssent = -1;
oldha = peer->ha;
peer->ha = NULL;
- peer->addr.sin_family = AF_INET;
- ast_copy_flags(peer, &global_flags, SIP_FLAGS_TO_COPY);
- peer->capability = global_capability;
- peer->rtptimeout = global_rtptimeout;
- peer->rtpholdtimeout = global_rtpholdtimeout;
+ set_peer_defaults(peer); /* Set peer defaults */
+ if (!found) {
+ if (name)
+ ast_copy_string(peer->name, name, sizeof(peer->name));
+ peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
+ peer->addr.sin_family = AF_INET;
+ }
+ /* If we have channel variables, remove them (reload) */
+ if (peer->chanvars) {
+ ast_variables_destroy(peer->chanvars);
+ peer->chanvars = NULL;
+ }
while(v) {
if (handle_common_options(&peerflags, &mask, v)) {
v = v->next;
@@ -12237,7 +12242,7 @@
ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno);
} else {
/* They'll register with us */
- ast_set_flag(peer, SIP_DYNAMIC);
+ ast_set_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC);
if (!found) {
/* Initialize stuff iff we're not found, otherwise
we keep going with what we had */
@@ -12254,7 +12259,7 @@
if (peer->expire > -1)
ast_sched_del(sched, peer->expire);
peer->expire = -1;
- ast_clear_flag(peer, SIP_DYNAMIC);
+ ast_clear_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC);
if (!obproxyfound || !strcasecmp(v->name, "outboundproxy")) {
if (ast_get_ip_or_srv(&peer->addr, v->value, "_sip._udp")) {
ASTOBJ_UNREF(peer, sip_destroy_peer);
@@ -12277,7 +12282,7 @@
} else if (!strcasecmp(v->name, "permit") || !strcasecmp(v->name, "deny")) {
peer->ha = ast_append_ha(v->name, v->value, peer->ha);
} else if (!strcasecmp(v->name, "port")) {
- if (!realtime && ast_test_flag(peer, SIP_DYNAMIC))
+ if (!realtime && ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC))
peer->defaddr.sin_port = htons(atoi(v->value));
else
peer->addr.sin_port = htons(atoi(v->value));
@@ -12359,7 +12364,7 @@
*/
v=v->next;
}
- if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(peer, SIP_DYNAMIC) && realtime) {
+ if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC) && realtime) {
time_t nowtime;
time(&nowtime);
@@ -12371,7 +12376,7 @@
}
}
ast_copy_flags(peer, &peerflags, mask.flags);
- if (!found && ast_test_flag(peer, SIP_DYNAMIC) && !ast_test_flag(peer, SIP_REALTIME))
+ if (!found && ast_test_flag((&peer->flags_page2), SIP_PAGE2_DYNAMIC) && !ast_test_flag(peer, SIP_REALTIME))
reg_source_db(peer);
ASTOBJ_UNMARK(peer);
ast_free_ha(oldha);
Modified: team/oej/jitterbuffer/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/channels/chan_zap.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/channels/chan_zap.c (original)
+++ team/oej/jitterbuffer/channels/chan_zap.c Wed Feb 1 04:35:07 2006
@@ -824,7 +824,6 @@
static void wakeup_sub(struct zt_pvt *p, int a, void *pri)
#endif
{
- struct ast_frame null = { AST_FRAME_NULL, };
#ifdef ZAPATA_PRI
if (pri)
ast_mutex_unlock(&pri->lock);
@@ -836,7 +835,7 @@
usleep(1);
ast_mutex_lock(&p->lock);
} else {
- ast_queue_frame(p->subs[a].owner, &null);
+ ast_queue_frame(p->subs[a].owner, &ast_null_frame);
ast_mutex_unlock(&p->subs[a].owner->lock);
break;
}
Modified: team/oej/jitterbuffer/frame.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/frame.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/frame.c (original)
+++ team/oej/jitterbuffer/frame.c Wed Feb 1 04:35:07 2006
@@ -56,13 +56,6 @@
#define TYPE_DONTSEND 0x3
#define TYPE_MASK 0x3
-struct ast_format_list {
- int visible; /*!< Can we see this entry */
- int bits; /*!< bitmask value */
- char *name; /*!< short name */
- char *desc; /*!< Description */
-};
-
struct ast_smoother {
int size;
int format;
@@ -79,7 +72,12 @@
};
/*! \brief Definition of supported media formats (codecs) */
-static struct ast_format_list AST_FORMAT_LIST[] = {
+static struct ast_format_list {
+ int visible; /*!< Can we see this entry */
+ int bits; /*!< bitmask value */
+ char *name; /*!< short name */
+ char *desc; /*!< Description */
+} AST_FORMAT_LIST[] = {
{ 1, AST_FORMAT_G723_1 , "g723" , "G.723.1"}, /*!< codec_g723_1.c */
{ 1, AST_FORMAT_GSM, "gsm" , "GSM"}, /*!< codec_gsm.c */
{ 1, AST_FORMAT_ULAW, "ulaw", "G.711 u-law" }, /*!< codec_ulaw.c */
@@ -107,6 +105,8 @@
{ 0, 0, "nothing", "undefined" },
{ 0, AST_FORMAT_MAX_VIDEO, "maxvideo", "Maximum video format" },
};
+
+struct ast_frame ast_null_frame = { AST_FRAME_NULL, };
void ast_smoother_reset(struct ast_smoother *s, int size)
{
Modified: team/oej/jitterbuffer/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/include/asterisk/frame.h?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/include/asterisk/frame.h (original)
+++ team/oej/jitterbuffer/include/asterisk/frame.h Wed Feb 1 04:35:07 2006
@@ -120,6 +120,10 @@
int seqno;
#endif /* AST_JB */
};
+
+/*! Queueing a null frame is fairly common, so we declare a global null frame object
+ for this purpose instead of having to declare one on the stack */
+extern struct ast_frame ast_null_frame;
#define AST_FRIENDLY_OFFSET 64 /*! It's polite for a a new frame to
have this number of bytes for additional
Modified: team/oej/jitterbuffer/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/rtp.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/rtp.c (original)
+++ team/oej/jitterbuffer/rtp.c Wed Feb 1 04:35:07 2006
@@ -174,7 +174,6 @@
static struct ast_frame *send_dtmf(struct ast_rtp *rtp)
{
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
char iabuf[INET_ADDRSTRLEN];
if (ast_tvcmp(ast_tvnow(), rtp->dtmfmute) < 0) {
@@ -182,7 +181,7 @@
ast_log(LOG_DEBUG, "Ignore potential DTMF echo from '%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr));
rtp->resp = 0;
rtp->dtmfduration = 0;
- return &null_frame;
+ return &ast_null_frame;
}
if (option_debug)
ast_log(LOG_DEBUG, "Sending dtmf: %d (%c), at %s\n", rtp->resp, rtp->resp, ast_inet_ntoa(iabuf, sizeof(iabuf), rtp->them.sin_addr));
@@ -364,7 +363,6 @@
struct ast_frame *ast_rtcp_read(struct ast_rtp *rtp)
{
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
socklen_t len;
int hdrlen = 8;
int res;
@@ -373,7 +371,7 @@
char iabuf[INET_ADDRSTRLEN];
if (!rtp || !rtp->rtcp)
- return &null_frame;
+ return &ast_null_frame;
len = sizeof(sin);
@@ -385,12 +383,12 @@
ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
if (errno == EBADF)
CRASH;
- return &null_frame;
+ return &ast_null_frame;
}
if (res < hdrlen) {
ast_log(LOG_WARNING, "RTP Read too short\n");
- return &null_frame;
+ return &ast_null_frame;
}
if (rtp->nat) {
@@ -404,7 +402,7 @@
}
if (option_debug)
ast_log(LOG_DEBUG, "Got RTCP report of %d bytes\n", res);
- return &null_frame;
+ return &ast_null_frame;
}
static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark)
@@ -437,7 +435,7 @@
char iabuf[INET_ADDRSTRLEN];
unsigned int timestamp;
unsigned int *rtpheader;
- static struct ast_frame *f, null_frame = { AST_FRAME_NULL, };
+ static struct ast_frame *f;
struct rtpPayloadType rtpPT;
len = sizeof(sin);
@@ -453,17 +451,17 @@
ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
if (errno == EBADF)
CRASH;
- return &null_frame;
+ return &ast_null_frame;
}
if (res < hdrlen) {
ast_log(LOG_WARNING, "RTP Read too short\n");
- return &null_frame;
+ return &ast_null_frame;
}
/* Ignore if the other side hasn't been given an address
yet. */
if (!rtp->them.sin_addr.s_addr || !rtp->them.sin_port)
- return &null_frame;
+ return &ast_null_frame;
if (rtp->nat) {
/* Send to whoever sent to us */
@@ -483,7 +481,7 @@
/* Check RTP version */
version = (seqno & 0xC0000000) >> 30;
if (version != 2)
- return &null_frame;
+ return &ast_null_frame;
payloadtype = (seqno & 0x7f0000) >> 16;
padding = seqno & (1 << 29);
@@ -505,7 +503,7 @@
if (res < hdrlen) {
ast_log(LOG_WARNING, "RTP Read too short (%d, expecting %d)\n", res, hdrlen);
- return &null_frame;
+ return &ast_null_frame;
}
if(rtp_debug_test_addr(&sin))
@@ -540,7 +538,7 @@
if (f)
return f;
else
- return &null_frame;
+ return &ast_null_frame;
} else if (rtpPT.code == AST_RTP_CISCO_DTMF) {
/* It's really special -- process it the Cisco way */
if (rtp->lasteventseqn <= seqno || rtp->resp == 0 || (rtp->lasteventseqn >= 65530 && seqno <= 6)) {
@@ -551,17 +549,17 @@
if (f)
return f;
else
- return &null_frame;
+ return &ast_null_frame;
} else if (rtpPT.code == AST_RTP_CN) {
/* Comfort Noise */
f = process_rfc3389(rtp, rtp->rawdata + AST_FRIENDLY_OFFSET + hdrlen, res - hdrlen);
if (f)
return f;
else
- return &null_frame;
+ return &ast_null_frame;
} else {
ast_log(LOG_NOTICE, "Unknown RTP codec %d received\n", payloadtype);
- return &null_frame;
+ return &ast_null_frame;
}
}
rtp->f.subclass = rtpPT.code;
Modified: team/oej/jitterbuffer/udptl.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/udptl.c?rev=9033&r1=9032&r2=9033&view=diff
==============================================================================
--- team/oej/jitterbuffer/udptl.c (original)
+++ team/oej/jitterbuffer/udptl.c Wed Feb 1 04:35:07 2006
@@ -645,7 +645,6 @@
uint16_t seqno = 0;
char iabuf[INET_ADDRSTRLEN];
uint16_t *udptlheader;
- static struct ast_frame null_frame = { AST_FRAME_NULL, };
len = sizeof(sin);
@@ -662,12 +661,12 @@
ast_log(LOG_WARNING, "UDPTL read error: %s\n", strerror(errno));
if (errno == EBADF)
CRASH;
- return &null_frame;
+ return &ast_null_frame;
}
/* Ignore if the other side hasn't been given an address yet. */
if (!udptl->them.sin_addr.s_addr || !udptl->them.sin_port)
- return &null_frame;
+ return &ast_null_frame;
if (udptl->nat) {
/* Send to whoever sent to us */
More information about the asterisk-commits
mailing list