[asterisk-commits] branch oej/astum r9035 - in /team/oej/astum: ./
apps/ channels/ configs/ incl...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Feb 1 06:46:05 MST 2006
Author: oej
Date: Wed Feb 1 07:45:53 2006
New Revision: 9035
URL: http://svn.digium.com/view/asterisk?rev=9035&view=rev
Log:
Merged revisions 8991,9001,9004,9013,9034 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.
........
r9034 | oej | 2006-02-01 14:23:59 +0100 (Wed, 01 Feb 2006) | 3 lines
- Clarify default setting of canreinvite (thanks royk)
- Add some extra headers and reference to other doc/ files for realtime
........
Modified:
team/oej/astum/ (props changed)
team/oej/astum/apps/app_meetme.c
team/oej/astum/channel.c
team/oej/astum/channels/chan_agent.c
team/oej/astum/channels/chan_features.c
team/oej/astum/channels/chan_h323.c
team/oej/astum/channels/chan_iax2.c
team/oej/astum/channels/chan_local.c
team/oej/astum/channels/chan_mgcp.c
team/oej/astum/channels/chan_sip.c
team/oej/astum/channels/chan_zap.c
team/oej/astum/configs/sip.conf.sample
team/oej/astum/frame.c
team/oej/astum/include/asterisk/frame.h
team/oej/astum/rtp.c
team/oej/astum/udptl.c
Propchange: team/oej/astum/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Feb 1 07:45:53 2006
@@ -1,1 +1,1 @@
-/trunk:1-8980
+/trunk:1-9034
Modified: team/oej/astum/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_meetme.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/apps/app_meetme.c (original)
+++ team/oej/astum/apps/app_meetme.c Wed Feb 1 07:45:53 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/astum/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channel.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channel.c (original)
+++ team/oej/astum/channel.c Wed Feb 1 07:45:53 2006
@@ -1760,17 +1760,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;
}
@@ -1838,8 +1834,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
@@ -1851,8 +1846,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 */
@@ -1872,7 +1866,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);
@@ -1898,7 +1892,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);
@@ -1912,7 +1906,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:
@@ -1924,14 +1918,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);
@@ -1962,7 +1956,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 */
@@ -3121,10 +3115,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/astum/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_agent.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_agent.c (original)
+++ team/oej/astum/channels/chan_agent.c Wed Feb 1 07:45:53 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/astum/channels/chan_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_features.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_features.c (original)
+++ team/oej/astum/channels/chan_features.c Wed Feb 1 07:45:53 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/astum/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_h323.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_h323.c (original)
+++ team/oej/astum/channels/chan_h323.c Wed Feb 1 07:45:53 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/astum/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_iax2.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_iax2.c (original)
+++ team/oej/astum/channels/chan_iax2.c Wed Feb 1 07:45:53 2006
@@ -3103,9 +3103,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/astum/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_local.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_local.c (original)
+++ team/oej/astum/channels/chan_local.c Wed Feb 1 07:45:53 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/astum/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_mgcp.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_mgcp.c (original)
+++ team/oej/astum/channels/chan_mgcp.c Wed Feb 1 07:45:53 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/astum/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_sip.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_sip.c (original)
+++ team/oej/astum/channels/chan_sip.c Wed Feb 1 07:45:53 2006
@@ -34,6 +34,7 @@
* \todo Better support of forking
*
* \ingroup channel_drivers
+ *
*/
@@ -487,11 +488,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 */
@@ -524,7 +527,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 */
@@ -539,14 +544,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 */
@@ -584,7 +588,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)
@@ -593,6 +597,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 */
@@ -961,6 +967,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);
@@ -1313,7 +1322,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;
@@ -1680,7 +1691,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--;
@@ -3043,11 +3054,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) {
@@ -3064,11 +3074,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 */
@@ -3751,12 +3761,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 */
@@ -3764,7 +3773,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);
}
}
@@ -5758,7 +5767,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);
}
@@ -6490,7 +6499,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);
@@ -7650,7 +7659,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);
@@ -7658,7 +7667,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 */
@@ -7680,7 +7689,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);
@@ -8053,7 +8062,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)));
@@ -8129,7 +8138,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)));
@@ -9368,7 +9377,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")) {
@@ -9611,8 +9620,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
@@ -10346,7 +10354,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;
@@ -10438,7 +10445,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))
@@ -12044,20 +12051,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);
@@ -12065,76 +12063,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';
@@ -12146,16 +12080,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;
@@ -12196,7 +12201,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 */
@@ -12213,7 +12218,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);
@@ -12236,7 +12241,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));
@@ -12318,7 +12323,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);
@@ -12330,7 +12335,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/astum/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_zap.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/channels/chan_zap.c (original)
+++ team/oej/astum/channels/chan_zap.c Wed Feb 1 07:45:53 2006
@@ -808,7 +808,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);
@@ -820,7 +819,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/astum/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/astum/configs/sip.conf.sample?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/configs/sip.conf.sample (original)
+++ team/oej/astum/configs/sip.conf.sample Wed Feb 1 07:45:53 2006
@@ -109,6 +109,7 @@
; Useful to limit subscriptions to local extensions
; Settable per peer/user also
;notifyringing = yes ; Notify subscriptions on RINGING state
+;callevents=no ; generate manager events when sip ua performs events (e.g. hold)
;
; If regcontext is specified, Asterisk will dynamically create and destroy a
@@ -119,6 +120,7 @@
;
;regcontext=sipregistrations
;
+;----------------------------------------- OUTBOUND SIP REGISTRATIONS ------------------------
; Asterisk can register as a SIP user agent to a SIP proxy (provider)
; Format for the register statement is:
; register => user[:secret[:authuser]]@host[:port][/extension]
@@ -152,7 +154,6 @@
; 0 = continue forever, hammering the other server until it
; accepts the registration
; Default is 0 tries, continue forever
-;callevents=no ; generate manager events when sip ua performs events (e.g. hold)
;----------------------------------------- NAT SUPPORT ------------------------
; The externip, externhost and localnet settings are used if you use Asterisk
@@ -191,6 +192,21 @@
; route = Assume NAT, don't send rport
; (work around more UNIDEN bugs)
+;canreinvite=yes ; Asterisk by default tries to redirect the
+ ; RTP media stream (audio) to go directly from
+ ; the caller to the callee. Some devices do not
+ ; support this (especially if one of them is
+ ; behind a NAT).
+ ; The default setting is YES. If you have all clients
+ ; behind a NAT, or for some other reason wants
+ ; Asterisk to stay in the audio path,
+ ; you may want to turn this off
+
+;----------------------------------------- REALTIME SUPPORT ------------------------
+; For additional information on ARA, the Asterisk Realtime Architecture,
+; please read README.realtime and README.extconfig in the /doc directory of the
+; source code.
+;
;rtcachefriends=yes ; Cache realtime friends by adding them to the internal list
; just like friends added from the config file only on a
; as-needed basis? (yes|no)
@@ -199,7 +215,6 @@
; If set to yes, when a SIP UA registers successfully, the ip address,
; the origination port, the registration period, and the username of
; the UA will be set to database via realtime. If not present, defaults to 'yes'.
-
;rtautoclear=yes ; Auto-Expire friends created on the fly on the same schedule
; as if it had just registered? (yes|no|<seconds>)
; If set to yes, when the registration expires, the friend will vanish from
@@ -220,6 +235,7 @@
; memory (due to caching or other reasons), the information will not be
; removed from realtime storage
+;----------------------------------------- SIP DOMAIN SUPPORT ------------------------
; Incoming INVITE and REFER messages can be matched against a list of 'allowed'
; domains, each of which can direct the call to a specific context if desired.
; By default, all domains are accepted and sent to the default context or the
Modified: team/oej/astum/frame.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/frame.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/frame.c (original)
+++ team/oej/astum/frame.c Wed Feb 1 07:45:53 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/astum/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/oej/astum/include/asterisk/frame.h?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/include/asterisk/frame.h (original)
+++ team/oej/astum/include/asterisk/frame.h Wed Feb 1 07:45:53 2006
@@ -110,6 +110,10 @@
/*! Next/Prev for linking stand alone frames */
struct ast_frame *next;
};
+
+/*! 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/astum/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/rtp.c?rev=9035&r1=9034&r2=9035&view=diff
==============================================================================
--- team/oej/astum/rtp.c (original)
+++ team/oej/astum/rtp.c Wed Feb 1 07:45:53 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)
@@ -434,7 +432,7 @@
char iabuf[INET_ADDRSTRLEN];
unsigned int timestamp;
unsigned int *rtpheader;
[... 104 lines stripped ...]
More information about the asterisk-commits
mailing list