[asterisk-commits] tilghman: branch tilghman/compiler_attributes r112030 - in /team/tilghman/com...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 31 12:57:30 CDT 2008
Author: tilghman
Date: Mon Mar 31 12:57:30 2008
New Revision: 112030
URL: http://svn.digium.com/view/asterisk?view=rev&rev=112030
Log:
Fixup remaining attributes
Modified:
team/tilghman/compiler_attributes/channels/chan_iax2.c
team/tilghman/compiler_attributes/channels/chan_sip.c
team/tilghman/compiler_attributes/channels/chan_skinny.c
team/tilghman/compiler_attributes/channels/chan_zap.c
team/tilghman/compiler_attributes/main/asterisk.c
team/tilghman/compiler_attributes/main/channel.c
team/tilghman/compiler_attributes/main/sched.c
Modified: team/tilghman/compiler_attributes/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_iax2.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_iax2.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_iax2.c Mon Mar 31 12:57:30 2008
@@ -8567,13 +8567,13 @@
if (iaxs[fr->callno]->pingtime <= peer->maxms) {
ast_log(LOG_NOTICE, "Peer '%s' is now REACHABLE! Time: %d\n", peer->name, iaxs[fr->callno]->pingtime);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Reachable\r\nTime: %d\r\n", peer->name, iaxs[fr->callno]->pingtime);
- ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", peer->name); /* Activate notification */
}
} else if ((peer->historicms > 0) && (peer->historicms <= peer->maxms)) {
if (iaxs[fr->callno]->pingtime > peer->maxms) {
ast_log(LOG_NOTICE, "Peer '%s' is now TOO LAGGED (%d ms)!\n", peer->name, iaxs[fr->callno]->pingtime);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Lagged\r\nTime: %d\r\n", peer->name, iaxs[fr->callno]->pingtime);
- ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", peer->name); /* Activate notification */
}
}
peer->lastms = iaxs[fr->callno]->pingtime;
@@ -9537,7 +9537,7 @@
if (peer->lastms > -1) {
ast_log(LOG_NOTICE, "Peer '%s' is now UNREACHABLE! Time: %d\n", peer->name, peer->lastms);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms);
- ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "IAX2/%s", peer->name); /* Activate notification */
}
if (peer->callno > 0) {
ast_mutex_lock(&iaxsl[peer->callno]);
Modified: team/tilghman/compiler_attributes/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_sip.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_sip.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_sip.c Mon Mar 31 12:57:30 2008
@@ -4505,7 +4505,8 @@
ast_log(LOG_ERROR, "update_call_counter(%s, %d) called with no event!\n", name, event);
}
if (p) {
- ast_device_state_changed("SIP/%s", p->name);
+ ast_devstate_changed(*inuse > *call_limit ? AST_DEVICE_BUSY :
+ (*inuse == 0 ? AST_DEVICE_NOT_INUSE : AST_DEVICE_INUSE), "SIP/%s", p->name);
unref_peer(p);
} else /* u must be set */
unref_user(u);
@@ -9608,7 +9609,7 @@
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", peer->name);
register_peer_exten(peer, FALSE); /* Remove regexten */
peer->expire = -1;
- ast_device_state_changed("SIP/%s", peer->name);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "SIP/%s", peer->name);
/* Do we need to release this peer from memory?
Only for realtime peers and autocreated peers
@@ -10223,7 +10224,7 @@
ast_atomic_fetchadd_int(&peer->onHold, (hold ? +1 : -1));
/* Request device state update */
- ast_device_state_changed("SIP/%s", peer->name);
+ ast_devstate_changed(hold ? AST_DEVICE_ONHOLD : AST_DEVICE_INUSE, "SIP/%s", peer->name);
return;
}
@@ -10446,7 +10447,7 @@
}
}
if (!res) {
- ast_device_state_changed("SIP/%s", peer->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "SIP/%s", peer->name);
}
if (res < 0) {
switch (res) {
@@ -15103,7 +15104,7 @@
ast_log(LOG_NOTICE, "Peer '%s' is now %s. (%dms / %dms)\n",
peer->name, s, pingtime, peer->maxms);
- ast_device_state_changed("SIP/%s", peer->name);
+ ast_devstate_changed(is_reachable ? AST_DEVICE_NOT_INUSE : AST_DEVICE_UNAVAILABLE, "SIP/%s", peer->name);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
"ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
peer->name, s, pingtime);
@@ -18890,7 +18891,7 @@
if (peer->call)
peer->call = sip_destroy(peer->call);
peer->lastms = -1;
- ast_device_state_changed("SIP/%s", peer->name);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "SIP/%s", peer->name);
/* Try again quickly */
AST_SCHED_REPLACE(peer->pokeexpire, sched,
DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
Modified: team/tilghman/compiler_attributes/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_skinny.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_skinny.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_skinny.c Mon Mar 31 12:57:30 2008
@@ -1755,7 +1755,7 @@
}
for (l = d->lines; l; l = l->next) {
register_exten(l);
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Skinny/%s@%s", l->name, d->name);
}
break;
}
@@ -1785,7 +1785,7 @@
}
for (l = d->lines; l; l = l->next) {
unregister_exten(l);
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Skinny/%s@%s", l->name, d->name);
}
}
@@ -4010,6 +4010,7 @@
int instance;
int callreference;
/*int res = 0;*/
+ enum ast_device_state newstate = AST_DEVICE_INUSE;
event = letohl(req->data.stimulus.stimulus);
instance = letohl(req->data.stimulus.stimulusInstance);
@@ -4126,6 +4127,7 @@
skinny_unhold(sub);
} else {
skinny_hold(sub);
+ newstate = AST_DEVICE_ONHOLD;
}
break;
case STIMULUS_TRANSFER:
@@ -4281,7 +4283,7 @@
l->hookstate = SKINNY_OFFHOOK;
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_BUSY, "Skinny/%s@%s", l->name, d->name);
if (sub && sub->outgoing) {
/* We're answering a ringing call */
@@ -4323,7 +4325,7 @@
ast_debug(1, "RECEIVED UNKNOWN STIMULUS: %d(%d/%d)\n", event, instance, callreference);
break;
}
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(newstate, "Skinny/%s@%s", l->name, d->name);
return 1;
}
@@ -4355,7 +4357,7 @@
transmit_ringer_mode(s, SKINNY_RING_OFF);
l->hookstate = SKINNY_OFFHOOK;
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, "Skinny/%s@%s", l->name, d->name);
if (sub && sub->onhold) {
return 1;
@@ -4423,7 +4425,7 @@
}
l->hookstate = SKINNY_ONHOOK;
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Skinny/%s@%s", l->name, d->name);
if (sub->onhold) {
return 0;
@@ -4948,7 +4950,7 @@
return 0;
}
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, "Skinny/%s@%s", l->name, d->name);
switch(event) {
case SOFTKEY_NONE:
@@ -5045,6 +5047,7 @@
skinny_unhold(sub);
} else {
skinny_hold(sub);
+ ast_devstate_changed(AST_DEVICE_ONHOLD, "Skinny/%s@%s", l->name, d->name);
}
}
@@ -5140,6 +5143,7 @@
sub->cxmode = SKINNY_CX_RECVONLY;
l->hookstate = SKINNY_ONHOOK;
transmit_callstate(s, l->instance, l->hookstate, sub->callid);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Skinny/%s@%s", l->name, d->name);
if (skinnydebug)
ast_debug(1, "Skinny %s@%s went on hook\n", l->name, d->name);
if (l->transfer && (sub->owner && sub->next && sub->next->owner) && ((!sub->outgoing) || (sub->next && !sub->next->outgoing))) {
@@ -5170,6 +5174,7 @@
}
if ((l->hookstate == SKINNY_ONHOOK) && (sub->next && !sub->next->rtp)) {
do_housekeeping(s);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Skinny/%s@%s", l->name, d->name);
}
}
break;
@@ -5233,7 +5238,6 @@
ast_debug(1, "Received unknown Softkey Event: %d(%d/%d)\n", event, instance, callreference);
break;
}
- ast_device_state_changed("Skinny/%s@%s", l->name, d->name);
return 1;
}
Modified: team/tilghman/compiler_attributes/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_zap.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_zap.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_zap.c Mon Mar 31 12:57:30 2008
@@ -5998,7 +5998,7 @@
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
- ast_device_state_changed_literal(tmp->name);
+ ast_devstate_changed(AST_DEVICE_INUSE, "%s", tmp->name);
for (v = i->vars ; v ; v = v->next)
pbx_builtin_setvar_helper(tmp, v->name, v->value);
Modified: team/tilghman/compiler_attributes/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/main/asterisk.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/main/asterisk.c (original)
+++ team/tilghman/compiler_attributes/main/asterisk.c Mon Mar 31 12:57:30 2008
@@ -1118,7 +1118,10 @@
ast_socket = -1;
return -1;
}
- ast_register_verbose(network_verboser);
+ if (ast_register_verbose(network_verboser)) {
+ ast_log(LOG_WARNING, "Unable to register network verboser?\n");
+ }
+
ast_pthread_create_background(<hread, NULL, listener, NULL);
if (!ast_strlen_zero(ast_config_AST_CTL_OWNER)) {
@@ -2915,7 +2918,9 @@
}
if (ast_opt_console || option_verbose || (ast_opt_remote && !ast_opt_exec)) {
- ast_register_verbose(console_verboser);
+ if (ast_register_verbose(console_verboser)) {
+ ast_log(LOG_WARNING, "Unable to register console verboser?\n");
+ }
WELCOME_MESSAGE;
}
Modified: team/tilghman/compiler_attributes/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/main/channel.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/main/channel.c (original)
+++ team/tilghman/compiler_attributes/main/channel.c Mon Mar 31 12:57:30 2008
@@ -1332,7 +1332,7 @@
ast_free(chan);
AST_RWLIST_UNLOCK(&channels);
- ast_device_state_changed_literal(name);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "%s", name);
}
struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
@@ -4031,7 +4031,7 @@
return 0;
chan->_state = state;
- ast_device_state_changed_literal(chan->name);
+ ast_devstate_changed(state == AST_STATE_DOWN ? AST_DEVICE_NOT_INUSE : AST_DEVICE_INUSE, "%s", chan->name);
/* setstate used to conditionally report Newchannel; this is no more */
manager_event(EVENT_FLAG_CALL,
"Newstate",
Modified: team/tilghman/compiler_attributes/main/sched.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/main/sched.c?view=diff&rev=112030&r1=112029&r2=112030
==============================================================================
--- team/tilghman/compiler_attributes/main/sched.c (original)
+++ team/tilghman/compiler_attributes/main/sched.c Mon Mar 31 12:57:30 2008
@@ -204,8 +204,9 @@
int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable)
{
/* 0 means the schedule item is new; do not delete */
- if (old_id > 0)
- ast_sched_del(con, old_id);
+ if (old_id > 0) {
+ AST_SCHED_DEL(con, old_id);
+ }
return ast_sched_add_variable(con, when, callback, data, variable);
}
@@ -247,8 +248,9 @@
int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
{
- if (old_id > -1)
- ast_sched_del(con, old_id);
+ if (old_id > -1) {
+ AST_SCHED_DEL(con, old_id);
+ }
return ast_sched_add(con, when, callback, data);
}
More information about the asterisk-commits
mailing list