[asterisk-commits] seanbright: trunk r136917 - in /trunk: channels/ channels/xpmr/ codecs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Aug 9 09:12:35 CDT 2008
Author: seanbright
Date: Sat Aug 9 09:12:34 2008
New Revision: 136917
URL: http://svn.digium.com/view/asterisk?view=rev&rev=136917
Log:
More RSW merges. This should do it for the channels/ dir.
Modified:
trunk/channels/chan_iax2.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/chan_unistim.c
trunk/channels/iax2-parser.c
trunk/channels/xpmr/xpmr.c
trunk/codecs/codec_dahdi.c
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=136917&r1=136916&r2=136917
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sat Aug 9 09:12:34 2008
@@ -135,8 +135,8 @@
static int global_max_trunk_mtu; /*!< Maximum MTU, 0 if not used */
static int trunk_timed, trunk_untimed, trunk_maxmtu, trunk_nmaxmtu ; /*!< Trunk MTU statistics */
-
-static char context[80] = "default";
+#define DEFAULT_CONTEXT "default"
+
static char default_parkinglot[AST_MAX_CONTEXT];
static char language[MAX_LANGUAGE] = "";
@@ -164,9 +164,10 @@
static int iaxdefaulttimeout = 5; /* Default to wait no more than 5 seconds for a reply to come back */
-static unsigned int tos = 0;
-
-static unsigned int cos = 0;
+static struct {
+ unsigned int tos;
+ unsigned int cos;
+} qos = { 0, 0 };
static int min_reg_expire;
static int max_reg_expire;
@@ -2793,7 +2794,7 @@
struct iax2_dpcache *dp = NULL;
char tmp[1024], *pc = NULL;
int s, x, y;
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
switch (cmd) {
case CLI_INIT:
@@ -2811,7 +2812,7 @@
ast_cli(a->fd, "%-20.20s %-12.12s %-9.9s %-8.8s %s\n", "Peer/Context", "Exten", "Exp.", "Wait.", "Flags");
AST_LIST_TRAVERSE(&dpcache, dp, cache_list) {
- s = dp->expiry.tv_sec - tv.tv_sec;
+ s = dp->expiry.tv_sec - now.tv_sec;
tmp[0] = '\0';
if (dp->flags & CACHE_FLAG_EXISTS)
strncat(tmp, "EXISTS|", sizeof(tmp) - strlen(tmp) - 1);
@@ -2919,9 +2920,9 @@
struct iax_frame *fr;
jb_frame frame;
int ret;
- long now;
+ long ms;
long next;
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
/* Make sure we have a valid private structure before going on */
ast_mutex_lock(&iaxsl[callno]);
@@ -2937,12 +2938,12 @@
/* round up a millisecond since ast_sched_runq does; */
/* prevents us from spinning while waiting for our now */
/* to catch up with runq's now */
- tv.tv_usec += 1000;
+ now.tv_usec += 1000;
- now = ast_tvdiff_ms(tv, pvt->rxcore);
+ ms = ast_tvdiff_ms(now, pvt->rxcore);
- if(now >= (next = jb_next(pvt->jb))) {
- ret = jb_get(pvt->jb,&frame,now,ast_codec_interp_len(pvt->voiceformat));
+ if(ms >= (next = jb_next(pvt->jb))) {
+ ret = jb_get(pvt->jb,&frame,ms,ast_codec_interp_len(pvt->voiceformat));
switch(ret) {
case JB_OK:
fr = frame.data;
@@ -3938,7 +3939,7 @@
struct ast_frame *f;
unsigned short callno0 = PTR_TO_CALLNO(c0->tech_pvt);
unsigned short callno1 = PTR_TO_CALLNO(c1->tech_pvt);
- struct timeval waittimer = {0, 0}, tv;
+ struct timeval waittimer = {0, 0};
/* We currently do not support native bridging if a timeoutms value has been provided */
if (timeoutms > 0) {
@@ -4008,10 +4009,10 @@
}
if ((iaxs[callno0]->transferring == TRANSFER_RELEASED) && (iaxs[callno1]->transferring == TRANSFER_RELEASED)) {
/* Call has been transferred. We're no longer involved */
- tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
if (ast_tvzero(waittimer)) {
- waittimer = tv;
- } else if (tv.tv_sec - waittimer.tv_sec > IAX_LINGER_TIMEOUT) {
+ waittimer = now;
+ } else if (now.tv_sec - waittimer.tv_sec > IAX_LINGER_TIMEOUT) {
c0->_softhangup |= AST_SOFTHANGUP_DEV;
c1->_softhangup |= AST_SOFTHANGUP_DEV;
*fo = NULL;
@@ -4264,23 +4265,23 @@
return tmp;
}
-static unsigned int calc_txpeerstamp(struct iax2_trunk_peer *tpeer, int sampms, struct timeval *tv)
+static unsigned int calc_txpeerstamp(struct iax2_trunk_peer *tpeer, int sampms, struct timeval *now)
{
unsigned long int mssincetx; /* unsigned to handle overflows */
long int ms, pred;
- tpeer->trunkact = *tv;
- mssincetx = ast_tvdiff_ms(*tv, tpeer->lasttxtime);
+ tpeer->trunkact = *now;
+ mssincetx = ast_tvdiff_ms(*now, tpeer->lasttxtime);
if (mssincetx > 5000 || ast_tvzero(tpeer->txtrunktime)) {
/* If it's been at least 5 seconds since the last time we transmitted on this trunk, reset our timers */
- tpeer->txtrunktime = *tv;
+ tpeer->txtrunktime = *now;
tpeer->lastsent = 999999;
}
/* Update last transmit time now */
- tpeer->lasttxtime = *tv;
+ tpeer->lasttxtime = *now;
/* Calculate ms offset */
- ms = ast_tvdiff_ms(*tv, tpeer->txtrunktime);
+ ms = ast_tvdiff_ms(*now, tpeer->txtrunktime);
/* Predict from last value */
pred = tpeer->lastsent + sampms;
if (abs(ms - pred) < MAX_TIMESTAMP_SKEW)
@@ -4293,7 +4294,7 @@
return ms;
}
-static unsigned int fix_peerts(struct timeval *tv, int callno, unsigned int ts)
+static unsigned int fix_peerts(struct timeval *rxtrunktime, int callno, unsigned int ts)
{
long ms; /* NOT unsigned */
if (ast_tvzero(iaxs[callno]->rxcore)) {
@@ -4303,7 +4304,7 @@
iaxs[callno]->rxcore.tv_usec -= iaxs[callno]->rxcore.tv_usec % 20000;
}
/* Calculate difference between trunk and channel */
- ms = ast_tvdiff_ms(*tv, iaxs[callno]->rxcore);
+ ms = ast_tvdiff_ms(*rxtrunktime, iaxs[callno]->rxcore);
/* Return as the sum of trunk time and the difference between trunk and real time */
return ms + ts;
}
@@ -5017,7 +5018,7 @@
pstr = ast_test_flag(user,IAX_CODEC_USER_FIRST) ? "Caller" : "Host";
ast_cli(a->fd, FORMAT2, user->name, auth, user->authmethods,
- user->contexts ? user->contexts->context : context,
+ user->contexts ? user->contexts->context : DEFAULT_CONTEXT,
user->ha ? "Yes" : "No", pstr);
}
@@ -5989,7 +5990,7 @@
if (user->contexts)
ast_string_field_set(iaxs[callno], context, user->contexts->context);
else
- ast_string_field_set(iaxs[callno], context, context);
+ ast_string_field_set(iaxs[callno], context, DEFAULT_CONTEXT);
}
/* And any input keys */
ast_string_field_set(iaxs[callno], inkeys, user->inkeys);
@@ -8466,10 +8467,10 @@
ast_set_flag(iaxs[fr->callno], IAX_QUELCH);
if (ies.musiconhold) {
if (iaxs[fr->callno]->owner && ast_bridged_channel(iaxs[fr->callno]->owner)) {
- const char *mohsuggest = iaxs[fr->callno]->mohsuggest;
+ const char *moh_suggest = iaxs[fr->callno]->mohsuggest;
iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD,
- S_OR(mohsuggest, NULL),
- !ast_strlen_zero(mohsuggest) ? strlen(mohsuggest) + 1 : 0);
+ S_OR(moh_suggest, NULL),
+ !ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
if (!iaxs[fr->callno]) {
ast_mutex_unlock(&iaxsl[fr->callno]);
return 1;
@@ -9647,7 +9648,7 @@
static void *iax2_process_thread(void *data)
{
struct iax2_thread *thread = data;
- struct timeval tv;
+ struct timeval wait;
struct timespec ts;
int put_into_idle = 0;
@@ -9667,9 +9668,9 @@
if (thread->type == IAX_THREAD_TYPE_DYNAMIC) {
struct iax2_thread *t = NULL;
/* Wait to be signalled or time out */
- tv = ast_tvadd(ast_tvnow(), ast_samp2tv(30000, 1000));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(ast_tvnow(), ast_samp2tv(30000, 1000));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
if (ast_cond_timedwait(&thread->cond, &thread->lock, &ts) == ETIMEDOUT) {
/* This thread was never put back into the available dynamic
* thread list, so just go away. */
@@ -9692,9 +9693,9 @@
/* Someone grabbed our thread *right* after we timed out.
* Wait for them to set us up with something to do and signal
* us to continue. */
- tv = ast_tvadd(ast_tvnow(), ast_samp2tv(30000, 1000));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(ast_tvnow(), ast_samp2tv(30000, 1000));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
if (ast_cond_timedwait(&thread->cond, &thread->lock, &ts) == ETIMEDOUT)
{
ast_mutex_unlock(&thread->lock);
@@ -10147,16 +10148,16 @@
{
int count;
int res;
- struct timeval tv;
+ struct timeval wait;
struct timespec ts;
for (;;) {
res = ast_sched_wait(sched);
if ((res > 1000) || (res < 0))
res = 1000;
- tv = ast_tvadd(ast_tvnow(), ast_samp2tv(res, 1000));
- ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * 1000;
+ wait = ast_tvadd(ast_tvnow(), ast_samp2tv(res, 1000));
+ ts.tv_sec = wait.tv_sec;
+ ts.tv_nsec = wait.tv_usec * 1000;
pthread_testcancel();
ast_mutex_lock(&sched_lock);
@@ -10359,7 +10360,7 @@
sin.sin_addr.s_addr = INADDR_ANY;
if (ast_netsock_find(netsock, &sin)) {
sin.sin_addr.s_addr = orig_saddr;
- sock = ast_netsock_bind(outsock, io, srcaddr, port, tos, cos, socket_read, NULL);
+ sock = ast_netsock_bind(outsock, io, srcaddr, port, qos.tos, qos.cos, socket_read, NULL);
if (sock) {
sockfd = ast_netsock_sockfd(sock);
ast_netsock_unref(sock);
@@ -11035,13 +11036,13 @@
/* Seed initial tos value */
tosval = ast_variable_retrieve(cfg, "general", "tos");
if (tosval) {
- if (ast_str2tos(tosval, &tos))
+ if (ast_str2tos(tosval, &qos.tos))
ast_log(LOG_WARNING, "Invalid tos value, refer to QoS documentation\n");
}
/* Seed initial cos value */
tosval = ast_variable_retrieve(cfg, "general", "cos");
if (tosval) {
- if (ast_str2cos(tosval, &cos))
+ if (ast_str2cos(tosval, &qos.cos))
ast_log(LOG_WARNING, "Invalid cos value, refer to QoS documentation\n");
}
while(v) {
@@ -11110,7 +11111,7 @@
if (reload) {
ast_log(LOG_NOTICE, "Ignoring bindaddr on reload\n");
} else {
- if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, tos, cos, socket_read, NULL))) {
+ if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, qos.tos, qos.cos, socket_read, NULL))) {
ast_log(LOG_WARNING, "Unable apply binding to '%s' at line %d\n", v->value, v->lineno);
} else {
if (strchr(v->value, ':'))
@@ -11220,10 +11221,10 @@
/* Create context if it doesn't exist already */
ast_context_find_or_create(NULL, NULL, regcontext, "IAX2");
} else if (!strcasecmp(v->name, "tos")) {
- if (ast_str2tos(v->value, &tos))
+ if (ast_str2tos(v->value, &qos.tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos")) {
- if (ast_str2cos(v->value, &cos))
+ if (ast_str2cos(v->value, &qos.cos))
ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "parkinglot")) {
ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
@@ -11256,7 +11257,7 @@
}
if (defaultsockfd < 0) {
- if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, tos, cos, socket_read, NULL))) {
+ if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, qos.tos, qos.cos, socket_read, NULL))) {
ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno));
} else {
ast_verb(2, "Binding IAX2 to default address 0.0.0.0:%d\n", portno);
@@ -11504,13 +11505,13 @@
static struct iax2_dpcache *find_cache(struct ast_channel *chan, const char *data, const char *context, const char *exten, int priority)
{
struct iax2_dpcache *dp = NULL;
- struct timeval tv = ast_tvnow();
- int x, com[2], timeout, old = 0, outfd, abort, callno;
+ struct timeval now = ast_tvnow();
+ int x, com[2], timeout, old = 0, outfd, doabort, callno;
struct ast_channel *c = NULL;
struct ast_frame *f = NULL;
AST_LIST_TRAVERSE_SAFE_BEGIN(&dpcache, dp, cache_list) {
- if (ast_tvcmp(tv, dp->expiry) > 0) {
+ if (ast_tvcmp(now, dp->expiry) > 0) {
AST_LIST_REMOVE_CURRENT(cache_list);
if ((dp->flags & CACHE_FLAG_PENDING) || dp->callno)
ast_log(LOG_WARNING, "DP still has peer field or pending or callno (flags = %d, peer = blah, callno = %d)\n", dp->flags, dp->callno);
@@ -11577,7 +11578,7 @@
/* Defer any dtmf */
if (chan)
old = ast_channel_defer_dtmf(chan);
- abort = 0;
+ doabort = 0;
while(timeout) {
c = ast_waitfor_nandfds(&chan, chan ? 1 : 0, &com[0], 1, NULL, &outfd, &timeout);
if (outfd > -1)
@@ -11585,7 +11586,7 @@
if (!c)
continue;
if (!(f = ast_read(c))) {
- abort = 1;
+ doabort = 1;
break;
}
ast_frfree(f);
@@ -11597,7 +11598,7 @@
dp->waiters[x] = -1;
close(com[1]);
close(com[0]);
- if (abort) {
+ if (doabort) {
/* Don't interpret anything, just abort. Not sure what th epoint
of undeferring dtmf on a hung up channel is but hey whatever */
if (!old && chan)
@@ -11793,7 +11794,7 @@
ast_getformatname_multiple(buf, len -1, peer->capability);
} else if (!strncasecmp(colname, "codec[", 6)) {
char *codecnum, *ptr;
- int index = 0, codec = 0;
+ int codec = 0;
codecnum = strchr(colname, '[');
*codecnum = '\0';
@@ -11801,8 +11802,7 @@
if ((ptr = strchr(codecnum, ']'))) {
*ptr = '\0';
}
- index = atoi(codecnum);
- if((codec = ast_codec_pref_index(&peer->prefs, index))) {
+ if((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) {
ast_copy_string(buf, ast_getformatname(codec), len);
}
}
Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=136917&r1=136916&r2=136917
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Sat Aug 9 09:12:34 2008
@@ -153,10 +153,12 @@
static ast_group_t cur_callergroup = 0;
static ast_group_t cur_pickupgroup = 0;
-static unsigned int tos = 0;
-static unsigned int tos_audio = 0;
-static unsigned int cos = 0;
-static unsigned int cos_audio = 0;
+static struct {
+ unsigned int tos;
+ unsigned int tos_audio;
+ unsigned int cos;
+ unsigned int cos_audio;
+} qos = { 0, 0, 0, 0 };
static int immediate = 0;
@@ -460,16 +462,16 @@
{
int new_msgs;
struct ast_event *event;
- char *mailbox, *context;
-
- context = mailbox = ast_strdupa(p->mailbox);
- strsep(&context, "@");
- if (ast_strlen_zero(context))
- context = "default";
+ char *mbox, *cntx;
+
+ cntx = mbox = ast_strdupa(p->mailbox);
+ strsep(&cntx, "@");
+ if (ast_strlen_zero(cntx))
+ cntx = "default";
event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
@@ -694,7 +696,7 @@
struct mgcp_message *msg;
struct mgcp_message *cur;
struct mgcp_gateway *gw;
- struct timeval tv;
+ struct timeval now;
msg = ast_malloc(sizeof(*msg) + len);
if (!msg) {
@@ -731,8 +733,8 @@
gw->msgs = msg;
}
- tv = ast_tvnow();
- msg->expire = tv.tv_sec * 1000 + tv.tv_usec / 1000 + DEFAULT_RETRANS;
+ now = ast_tvnow();
+ msg->expire = now.tv_sec * 1000 + now.tv_usec / 1000 + DEFAULT_RETRANS;
if (gw->retransid == -1)
gw->retransid = ast_sched_add(sched, DEFAULT_RETRANS, retrans_pkt, (void *)gw);
@@ -2644,7 +2646,7 @@
if (sub->rtp && sub->owner)
ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
if (sub->rtp) {
- ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "MGCP RTP");
+ ast_rtp_setqos(sub->rtp, qos.tos_audio, qos.cos_audio, "MGCP RTP");
ast_rtp_setnat(sub->rtp, sub->nat);
}
#if 0
@@ -3750,14 +3752,14 @@
ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox));
ast_copy_string(e->parkinglot, parkinglot, sizeof(e->parkinglot));
if (!ast_strlen_zero(e->mailbox)) {
- char *mailbox, *context;
- context = mailbox = ast_strdupa(e->mailbox);
- strsep(&context, "@");
- if (ast_strlen_zero(context))
- context = "default";
+ char *mbox, *cntx;
+ cntx = mbox = ast_strdupa(e->mailbox);
+ strsep(&cntx, "@");
+ if (ast_strlen_zero(cntx))
+ cntx = "default";
e->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
}
@@ -4155,16 +4157,16 @@
else
capability &= ~format;
} else if (!strcasecmp(v->name, "tos")) {
- if (ast_str2tos(v->value, &tos))
+ if (ast_str2tos(v->value, &qos.tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "tos_audio")) {
- if (ast_str2tos(v->value, &tos_audio))
+ if (ast_str2tos(v->value, &qos.tos_audio))
ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos")) {
- if (ast_str2cos(v->value, &cos))
+ if (ast_str2cos(v->value, &qos.cos))
ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos_audio")) {
- if (ast_str2cos(v->value, &cos_audio))
+ if (ast_str2cos(v->value, &qos.cos_audio))
ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "port")) {
if (sscanf(v->value, "%d", &ourport) == 1) {
@@ -4249,7 +4251,7 @@
} else {
ast_verb(2, "MGCP Listening on %s:%d\n",
ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
- ast_netsock_set_qos(mgcpsock, tos, cos, "MGCP");
+ ast_netsock_set_qos(mgcpsock, qos.tos, qos.cos, "MGCP");
}
}
ast_mutex_unlock(&netlock);
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=136917&r1=136916&r2=136917
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Aug 9 09:12:34 2008
@@ -2073,7 +2073,7 @@
/* Realtime device support */
static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, const char *useragent, int expirey, int deprecated_username);
-static void update_peer(struct sip_peer *p, int expiry);
+static void update_peer(struct sip_peer *p, int expire);
static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
static const char *get_name_from_variable(struct ast_variable *var, const char *newpeername);
static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *sin);
@@ -3814,26 +3814,26 @@
}
/*! \brief Update peer data in database (if used) */
-static void update_peer(struct sip_peer *p, int expiry)
+static void update_peer(struct sip_peer *p, int expire)
{
int rtcachefriends = ast_test_flag(&p->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
if (sip_cfg.peer_rtupdate &&
(p->is_realtime || rtcachefriends)) {
- realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, p->useragent, expiry, p->deprecated_username);
- }
-}
-
-static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config)
+ realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, p->useragent, expire, p->deprecated_username);
+ }
+}
+
+static struct ast_variable *get_insecure_variable_from_config(struct ast_config *cfg)
{
struct ast_variable *var = NULL;
struct ast_flags flags = {0};
char *cat = NULL;
const char *insecure;
- while ((cat = ast_category_browse(config, cat))) {
- insecure = ast_variable_retrieve(config, cat, "insecure");
+ while ((cat = ast_category_browse(cfg, cat))) {
+ insecure = ast_variable_retrieve(cfg, cat, "insecure");
set_insecure_flags(&flags, insecure, -1);
if (ast_test_flag(&flags, SIP_INSECURE_PORT)) {
- var = ast_category_root(config, cat);
+ var = ast_category_root(cfg, cat);
break;
}
}
@@ -6132,9 +6132,9 @@
* code to determine whether this is the pvt that we are looking for.
* Return FALSE if not found, true otherwise. p is unlocked.
*/
-static int find_call_cb(void *__p, void *__arg, int flags)
-{
- struct sip_pvt *p = __p;
+static int find_call_cb(void *__pvt, void *__arg, int flags)
+{
+ struct sip_pvt *p = __pvt;
struct find_call_cb_arg *arg = __arg;
/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
int found = FALSE;
@@ -6302,7 +6302,7 @@
enum sip_transport transport = SIP_TRANSPORT_UDP;
char buf[256] = "";
char *username = NULL;
- char *hostname=NULL, *secret=NULL, *authuser=NULL, *expiry=NULL;
+ char *hostname=NULL, *secret=NULL, *authuser=NULL, *expire=NULL;
char *callback=NULL;
if (!value)
@@ -6329,9 +6329,9 @@
*authuser++ = '\0';
}
/* split host[:port][/contact] */
- expiry = strchr(hostname, '~');
- if (expiry)
- *expiry++ = '\0';
+ expire = strchr(hostname, '~');
+ if (expire)
+ *expire++ = '\0';
callback = strchr(hostname, '/');
if (callback)
*callback++ = '\0';
@@ -6361,7 +6361,7 @@
ast_string_field_set(reg, secret, secret);
reg->transport = transport;
reg->expire = -1;
- reg->expiry = (expiry ? atoi(expiry) : default_expiry);
+ reg->expiry = (expire ? atoi(expire) : default_expiry);
reg->timeout = -1;
reg->refresh = reg->expiry;
reg->portno = portnum;
@@ -8355,7 +8355,7 @@
char subject[256]; /* Subject of the session */
char owner[256]; /* Session owner/creator */
char connection[256]; /* Connection data */
- char *stime = "t=0 0\r\n"; /* Time the session is active */
+ char *session_time = "t=0 0\r\n"; /* Time the session is active */
char bandwidth[256] = ""; /* Max bitrate */
char *hold;
struct ast_str *m_audio = ast_str_alloca(256); /* Media declaration line for audio */
@@ -8584,7 +8584,7 @@
ast_str_append(&m_text, 0, "\r\n");
len = strlen(version) + strlen(subject) + strlen(owner) +
- strlen(connection) + strlen(stime);
+ strlen(connection) + strlen(session_time);
if (needaudio)
len += m_audio->used + a_audio->used + strlen(hold);
if (needvideo) /* only if video response is appropriate */
@@ -8600,7 +8600,7 @@
add_line(resp, connection);
if (needvideo) /* only if video response is appropriate */
add_line(resp, bandwidth);
- add_line(resp, stime);
+ add_line(resp, session_time);
if (needaudio) {
add_line(resp, m_audio->str);
add_line(resp, a_audio->str);
@@ -8651,11 +8651,11 @@
{
long offset;
int x;
- struct ast_str *dup = dst->data;
+ struct ast_str *duplicate = dst->data;
/* First copy stuff */
memcpy(dst, src, sizeof(*dst));
- dst->data = dup;
+ dst->data = duplicate;
/* All these + 1's are to account for the need to include the NULL terminator
* Using typical string functions like ast_copy_string or ast_str_set will not
@@ -10110,7 +10110,7 @@
{
char data[256];
struct in_addr in;
- int expiry;
+ int expire;
int port;
char *scan, *addr, *port_str, *expiry_str, *username, *contact;
@@ -10135,7 +10135,7 @@
return;
if (expiry_str)
- expiry = atoi(expiry_str);
+ expire = atoi(expiry_str);
else
return;
@@ -10145,7 +10145,7 @@
ast_copy_string(peer->fullcontact, contact, sizeof(peer->fullcontact));
ast_debug(2, "SIP Seeding peer from astdb: '%s' at %s@%s:%d for %d\n",
- peer->name, peer->username, ast_inet_ntoa(in), port, expiry);
+ peer->name, peer->username, ast_inet_ntoa(in), port, expire);
memset(&peer->addr, 0, sizeof(peer->addr));
peer->addr.sin_family = AF_INET;
@@ -10157,7 +10157,7 @@
} else {
sip_poke_peer(peer, 0);
}
- AST_SCHED_REPLACE(peer->expire, sched, (expiry + 10) * 1000, expire_register, peer);
+ AST_SCHED_REPLACE(peer->expire, sched, (expire + 10) * 1000, expire_register, peer);
register_peer_exten(peer, TRUE);
}
@@ -10245,7 +10245,7 @@
char contact[SIPBUFSIZE];
char data[SIPBUFSIZE];
const char *expires = get_header(req, "Expires");
- int expiry = atoi(expires);
+ int expire = atoi(expires);
char *curi, *host, *pt, *curi2;
int port;
const char *useragent;
@@ -10259,11 +10259,11 @@
char *s = strcasestr(contact, ";expires=");
if (s) {
expires = strsep(&s, ";"); /* trim ; and beyond */
- if (sscanf(expires + 9, "%d", &expiry) != 1)
- expiry = default_expiry;
+ if (sscanf(expires + 9, "%d", &expire) != 1)
+ expire = default_expiry;
} else {
/* Nothing has been specified */
- expiry = default_expiry;
+ expire = default_expiry;
}
}
@@ -10287,7 +10287,7 @@
if (peer->expire > -1 && !ast_strlen_zero(peer->fullcontact))
pvt->expiry = ast_sched_when(sched, peer->expire);
return PARSE_REGISTER_QUERY;
- } else if (!strcasecmp(curi, "*") || !expiry) { /* Unregister this peer */
+ } else if (!strcasecmp(curi, "*") || !expire) { /* Unregister this peer */
/* This means remove all registrations and return OK */
memset(&peer->addr, 0, sizeof(peer->addr));
AST_SCHED_DEL(sched, peer->expire);
@@ -10348,14 +10348,14 @@
ast_copy_string(peer->username, curi, sizeof(peer->username));
AST_SCHED_DEL(sched, peer->expire);
- if (expiry > max_expiry)
- expiry = max_expiry;
- if (expiry < min_expiry)
- expiry = min_expiry;
+ if (expire > max_expiry)
+ expire = max_expiry;
+ if (expire < min_expiry)
+ expire = min_expiry;
peer->expire = peer->is_realtime && !ast_test_flag(&peer->flags[1], SIP_PAGE2_RTCACHEFRIENDS) ? -1 :
- ast_sched_add(sched, (expiry + 10) * 1000, expire_register, peer);
- pvt->expiry = expiry;
- snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry, peer->username, peer->fullcontact);
+ ast_sched_add(sched, (expire + 10) * 1000, expire_register, peer);
+ pvt->expiry = expire;
+ snprintf(data, sizeof(data), "%s:%d:%d:%s:%s", ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expire, peer->username, peer->fullcontact);
/* Saving TCP connections is useless, we won't be able to reconnect
XXX WHY???? XXX
\todo check this
@@ -10367,7 +10367,7 @@
/* Is this a new IP address for us? */
if (inaddrcmp(&peer->addr, &oldsin)) {
sip_poke_peer(peer, 0);
- ast_verb(3, "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry);
+ ast_verb(3, "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expire);
register_peer_exten(peer, TRUE);
}
@@ -13178,7 +13178,7 @@
ast_cli(fd, "\n");
peer = unref_peer(peer, "sip_show_peer: unref_peer: done with peer ptr");
} else if (peer && type == 1) { /* manager listing */
- char buf[256];
+ char buffer[256];
struct ast_str *mailbox_str = ast_str_alloca(512);
astman_append(s, "Channeltype: SIP\r\n");
astman_append(s, "ObjectName: %s\r\n", peer->name);
@@ -13196,9 +13196,9 @@
if (!ast_strlen_zero(peer->fromdomain))
astman_append(s, "SIP-FromDomain: %s\r\n", peer->fromdomain);
astman_append(s, "Callgroup: ");
- astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->callgroup));
+ astman_append(s, "%s\r\n", ast_print_group(buffer, sizeof(buffer), peer->callgroup));
astman_append(s, "Pickupgroup: ");
- astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->pickupgroup));
+ astman_append(s, "%s\r\n", ast_print_group(buffer, sizeof(buffer), peer->pickupgroup));
peer_mailboxes_to_str(&mailbox_str, peer);
astman_append(s, "VoiceMailbox: %s\r\n", mailbox_str->str);
astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
@@ -14893,12 +14893,11 @@
ast_copy_string(buf, v->value, len);
} else if (!strncasecmp(colname, "codec[", 6)) {
char *codecnum;
- int index = 0, codec = 0;
+ int codec = 0;
codecnum = colname + 6; /* move past the '[' */
codecnum = strsep(&codecnum, "]"); /* trim trailing ']' if any */
- index = atoi(codecnum);
- if((codec = ast_codec_pref_index(&peer->prefs, index))) {
+ if((codec = ast_codec_pref_index(&peer->prefs, atoi(codecnum)))) {
ast_copy_string(buf, ast_getformatname(codec), len);
}
}
@@ -17579,11 +17578,11 @@
p->invitestate = INV_PROCEEDING;
ast_setstate(c, AST_STATE_RING);
if (strcmp(p->exten, ast_pickup_ext())) { /* Call to extension -start pbx on this call */
- enum ast_pbx_result res;
-
- res = ast_pbx_start(c);
-
- switch(res) {
+ enum ast_pbx_result result;
+
+ result = ast_pbx_start(c);
+
+ switch(result) {
case AST_PBX_FAILED:
ast_log(LOG_WARNING, "Failed to start PBX :(\n");
p->invitestate = INV_COMPLETED;
@@ -17599,7 +17598,7 @@
break;
}
- if (res) {
+ if (result) {
/* Unlock locks so ast_hangup can do its magic */
ast_channel_unlock(c);
@@ -18471,7 +18470,7 @@
int firststate = AST_EXTENSION_REMOVED;
struct sip_peer *authpeer = NULL;
const char *eventheader = get_header(req, "Event"); /* Get Event package name */
- const char *accept = get_header(req, "Accept");
+ const char *acceptheader = get_header(req, "Accept");
int resubscribe = (p->subscribed != NONE);
char *temp, *event;
struct ao2_iterator i;
@@ -18602,16 +18601,16 @@
*/
if (strstr(p->useragent, "Polycom")) {
p->subscribed = XPIDF_XML;
- } else if (strstr(accept, "application/pidf+xml")) {
+ } else if (strstr(acceptheader, "application/pidf+xml")) {
p->subscribed = PIDF_XML; /* RFC 3863 format */
- } else if (strstr(accept, "application/dialog-info+xml")) {
+ } else if (strstr(acceptheader, "application/dialog-info+xml")) {
p->subscribed = DIALOG_INFO_XML;
/* IETF draft: draft-ietf-sipping-dialog-package-05.txt */
- } else if (strstr(accept, "application/cpim-pidf+xml")) {
+ } else if (strstr(acceptheader, "application/cpim-pidf+xml")) {
p->subscribed = CPIM_PIDF_XML; /* RFC 3863 format */
- } else if (strstr(accept, "application/xpidf+xml")) {
+ } else if (strstr(acceptheader, "application/xpidf+xml")) {
p->subscribed = XPIDF_XML; /* Early pre-RFC 3863 format with MSN additions (Microsoft Messenger) */
- } else if (ast_strlen_zero(accept)) {
+ } else if (ast_strlen_zero(acceptheader)) {
if (p->subscribed == NONE) { /* if the subscribed field is not already set, and there is no accept header... */
transmit_response(p, "489 Bad Event", req);
@@ -18625,19 +18624,19 @@
} else {
/* Can't find a format for events that we know about */
char mybuf[200];
- snprintf(mybuf, sizeof(mybuf), "489 Bad Event (format %s)", accept);
+ snprintf(mybuf, sizeof(mybuf), "489 Bad Event (format %s)", acceptheader);
transmit_response(p, mybuf, req);
ast_log(LOG_WARNING, "SUBSCRIBE failure: unrecognized format: '%s' pvt: subscribed: %d, stateid: %d, laststate: %d, dialogver: %d, subscribecont: '%s', subscribeuri: '%s'\n",
- accept, (int)p->subscribed, p->stateid, p->laststate, p->dialogver, p->subscribecontext, p->subscribeuri);
+ acceptheader, (int)p->subscribed, p->stateid, p->laststate, p->dialogver, p->subscribecontext, p->subscribeuri);
p->needdestroy = 1;
return 0;
}
} else if (!strcmp(event, "message-summary")) {
- if (!ast_strlen_zero(accept) && strcmp(accept, "application/simple-message-summary")) {
+ if (!ast_strlen_zero(acceptheader) && strcmp(acceptheader, "application/simple-message-summary")) {
/* Format requested that we do not support */
transmit_response(p, "406 Not Acceptable", req);
- ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", accept);
+ ast_debug(2, "Received SIP mailbox subscription for unknown format: %s\n", acceptheader);
p->needdestroy = 1;
if (authpeer)
unref_peer(authpeer, "unref_peer, from handle_request_subscribe (authpeer 3)");
@@ -21569,17 +21568,17 @@
auto_sip_domains = ast_true(v->value);
} else if (!strcasecmp(v->name, "domain")) {
char *domain = ast_strdupa(v->value);
- char *context = strchr(domain, ',');
-
- if (context)
- *context++ = '\0';
-
- if (ast_strlen_zero(context))
+ char *cntx = strchr(domain, ',');
+
+ if (cntx)
+ *cntx++ = '\0';
+
+ if (ast_strlen_zero(cntx))
ast_debug(1, "No context specified at line %d for domain '%s'\n", v->lineno, domain);
if (ast_strlen_zero(domain))
ast_log(LOG_WARNING, "Empty domain specified at line %d\n", v->lineno);
else
- add_sip_domain(ast_strip(domain), SIP_DOMAIN_CONFIG, context ? ast_strip(context) : "");
+ add_sip_domain(ast_strip(domain), SIP_DOMAIN_CONFIG, cntx ? ast_strip(cntx) : "");
} else if (!strcasecmp(v->name, "register")) {
if (sip_register(v->value, v->lineno) == 0)
registry_count++;
Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=136917&r1=136916&r2=136917
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sat Aug 9 09:12:34 2008
@@ -93,12 +93,14 @@
#define DEFAULT_SKINNY_BACKLOG 2
#define SKINNY_MAX_PACKET 1000
-static unsigned int tos = 0;
-static unsigned int tos_audio = 0;
-static unsigned int tos_video = 0;
-static unsigned int cos = 0;
-static unsigned int cos_audio = 0;
-static unsigned int cos_video = 0;
+static struct {
+ unsigned int tos;
+ unsigned int tos_audio;
+ unsigned int tos_video;
+ unsigned int cos;
+ unsigned int cos_audio;
+ unsigned int cos_video;
+} qos = { 0, 0, 0, 0, 0, 0 };
static int keep_alive = 120;
static char vmexten[AST_MAX_EXTENSION]; /* Voicemail pilot number */
@@ -965,7 +967,7 @@
struct hostent *hp;
static int skinnysock = -1;
static pthread_t accept_t;
-static char context[AST_MAX_CONTEXT] = "default";
+static char global_context[AST_MAX_CONTEXT] = "default";
static char language[MAX_LANGUAGE] = "";
static char mohinterpret[MAX_MUSICCLASS] = "default";
static char mohsuggest[MAX_MUSICCLASS] = "";
@@ -2305,15 +2307,15 @@
{
int new_msgs;
struct ast_event *event;
- char *mailbox, *context;
-
- context = mailbox = ast_strdupa(l->mailbox);
+ char *mbox, *context;
+
+ context = mbox = ast_strdupa(l->mailbox);
strsep(&context, "@");
if (ast_strlen_zero(context))
context = "default";
event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox,
AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
@@ -3040,7 +3042,7 @@
} else if (!strcasecmp(v->name, "vmexten")) {
ast_copy_string(device_vmexten, v->value, sizeof(device_vmexten));
} else if (!strcasecmp(v->name, "context")) {
- ast_copy_string(context, v->value, sizeof(context));
+ ast_copy_string(global_context, v->value, sizeof(global_context));
} else if (!strcasecmp(v->name, "regexten")) {
ast_copy_string(regexten, v->value, sizeof(regexten));
} else if (!strcasecmp(v->name, "allow")) {
@@ -3154,7 +3156,7 @@
ast_copy_string(l->name, v->value, sizeof(l->name));
/* XXX Should we check for uniqueness?? XXX */
- ast_copy_string(l->context, context, sizeof(l->context));
+ ast_copy_string(l->context, global_context, sizeof(l->context));
ast_copy_string(l->cid_num, cid_num, sizeof(l->cid_num));
ast_copy_string(l->cid_name, cid_name, sizeof(l->cid_name));
ast_copy_string(l->label, linelabel, sizeof(l->label));
@@ -3249,11 +3251,11 @@
ast_channel_set_fd(sub->owner, 3, ast_rtcp_fd(sub->vrtp));
}
if (sub->rtp) {
- ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "Skinny RTP");
+ ast_rtp_setqos(sub->rtp, qos.tos_audio, qos.cos_audio, "Skinny RTP");
ast_rtp_setnat(sub->rtp, l->nat);
}
if (sub->vrtp) {
- ast_rtp_setqos(sub->vrtp, tos_video, cos_video, "Skinny VRTP");
+ ast_rtp_setqos(sub->vrtp, qos.tos_video, qos.cos_video, "Skinny VRTP");
ast_rtp_setnat(sub->vrtp, l->nat);
}
/* Set Frame packetization */
@@ -4940,13 +4942,13 @@
static int handle_time_date_req_message(struct skinny_req *req, struct skinnysession *s)
{
- struct timeval tv = ast_tvnow();
+ struct timeval now = ast_tvnow();
struct ast_tm cmtime;
if (!(req = req_alloc(sizeof(struct definetimedate_message), DEFINETIMEDATE_MESSAGE)))
return -1;
- ast_localtime(&tv, &cmtime, NULL);
+ ast_localtime(&now, &cmtime, NULL);
req->data.definetimedate.year = htolel(cmtime.tm_year+1900);
req->data.definetimedate.month = htolel(cmtime.tm_mon+1);
req->data.definetimedate.dayofweek = htolel(cmtime.tm_wday);
@@ -4955,7 +4957,7 @@
req->data.definetimedate.minute = htolel(cmtime.tm_min);
req->data.definetimedate.seconds = htolel(cmtime.tm_sec);
req->data.definetimedate.milliseconds = htolel(cmtime.tm_usec / 1000);
- req->data.definetimedate.timestamp = htolel(tv.tv_sec);
+ req->data.definetimedate.timestamp = htolel(now.tv_sec);
transmit_response(s->device, req);
return 1;
}
@@ -6211,22 +6213,22 @@
} else if (!strcasecmp(v->name, "dateformat")) {
memcpy(date_format, v->value, sizeof(date_format));
} else if (!strcasecmp(v->name, "tos")) {
- if (ast_str2tos(v->value, &tos))
+ if (ast_str2tos(v->value, &qos.tos))
ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "tos_audio")) {
- if (ast_str2tos(v->value, &tos_audio))
+ if (ast_str2tos(v->value, &qos.tos_audio))
ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "tos_video")) {
- if (ast_str2tos(v->value, &tos_video))
+ if (ast_str2tos(v->value, &qos.tos_video))
ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos")) {
- if (ast_str2cos(v->value, &cos))
+ if (ast_str2cos(v->value, &qos.cos))
ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos_audio")) {
- if (ast_str2cos(v->value, &cos_audio))
+ if (ast_str2cos(v->value, &qos.cos_audio))
ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "cos_video")) {
- if (ast_str2cos(v->value, &cos_video))
+ if (ast_str2cos(v->value, &qos.cos_video))
ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
} else if (!strcasecmp(v->name, "allow")) {
ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 1);
@@ -6312,7 +6314,7 @@
}
ast_verb(2, "Skinny listening on %s:%d\n",
ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
- ast_netsock_set_qos(skinnysock, tos, cos, "Skinny");
+ ast_netsock_set_qos(skinnysock, qos.tos, qos.cos, "Skinny");
ast_pthread_create_background(&accept_t, NULL, accept_thread, NULL);
}
}
Modified: trunk/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=136917&r1=136916&r2=136917
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Sat Aug 9 09:12:34 2008
@@ -180,7 +180,7 @@
#define FAV_MAX_LENGTH 0x0A
[... 453 lines stripped ...]
More information about the asterisk-commits
mailing list