[svn-commits] tilghman: branch tilghman/compiler_attributes r133857 - in /team/tilghman/com...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jul 25 16:08:53 CDT 2008
Author: tilghman
Date: Fri Jul 25 16:08:52 2008
New Revision: 133857
URL: http://svn.digium.com/view/asterisk?view=rev&rev=133857
Log:
Improve upon device state settings
Modified:
team/tilghman/compiler_attributes/channels/chan_agent.c
team/tilghman/compiler_attributes/channels/chan_dahdi.c
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/main/channel.c
team/tilghman/compiler_attributes/main/devicestate.c
Modified: team/tilghman/compiler_attributes/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_agent.c?view=diff&rev=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_agent.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_agent.c Fri Jul 25 16:08:52 2008
@@ -303,7 +303,7 @@
}
if (strcasecmp(p->chan->name, device) == 0 || strcasecmp(basename, device) == 0) {
p->inherited_devicestate = state;
- ast_device_state_changed("Agent/%s", p->agent);
+ ast_devstate_changed(state, "Agent/%s", p->agent);
}
}
ast_mutex_unlock(&p->lock);
@@ -518,7 +518,7 @@
}
p->chan = NULL;
p->inherited_devicestate = -1;
- ast_device_state_changed("Agent/%s", p->agent);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
p->acknowledged = 0;
}
} else {
@@ -734,7 +734,7 @@
/* Agent hung-up */
p->chan = NULL;
p->inherited_devicestate = -1;
- ast_device_state_changed("Agent/%s", p->agent);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
}
if (!res) {
@@ -856,7 +856,7 @@
ast_hangup(p->chan);
p->chan = NULL;
p->inherited_devicestate = -1;
- ast_device_state_changed("Agent/%s", p->agent);
+ ast_devstate_changed(AST_DEVICE_UNAVAILABLE, "Agent/%s", p->agent);
}
ast_debug(1, "Hungup, howlong is %d, autologoff is %d\n", howlong, p->autologoff);
if ((p->deferlogoff) || (howlong && p->autologoff && (howlong > p->autologoff))) {
Modified: team/tilghman/compiler_attributes/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/channels/chan_dahdi.c?view=diff&rev=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_dahdi.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_dahdi.c Fri Jul 25 16:08:52 2008
@@ -6001,7 +6001,7 @@
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
- ast_devstate_changed_literal(state == AST_STATE_DOWN ? AST_DEVICE_NOT_INUSE : AST_DEVICE_INUSE, tmp->name);
+ ast_devstate_changed_literal(ast_state_chan2dev(state), tmp->name);
for (v = i->vars ; v ; v = v->next)
pbx_builtin_setvar_helper(tmp, v->name, v->value);
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=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_iax2.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_iax2.c Fri Jul 25 16:08:52 2008
@@ -6253,7 +6253,7 @@
if (expire && (expire < iaxs[callno]->expiry))
iaxs[callno]->expiry = expire;
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
res = 0;
@@ -6812,10 +6812,9 @@
if (!ast_sched_del(sched, p->expire)) {
p->expire = -1;
peer_unref(p);
- /* XXX Should we exit here? XXX */
}
}
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
p->expire = iax2_sched_add(sched, (p->expiry + 10) * 1000, expire_registry, peer_ref(p));
if (p->expire == -1)
peer_unref(p);
@@ -6882,7 +6881,7 @@
ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: IAX2\r\nPeer: IAX2/%s\r\nPeerStatus: Registered\r\n", p->name);
register_peer_exten(p, 1);
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "IAX2/%s", p->name); /* Activate notification */
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
} else if (!ast_test_flag(p, IAX_TEMPONLY)) {
ast_verb(3, "Unregistered IAX2 '%s' (%s)\n", p->name,
ast_test_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED) ? "AUTHENTICATED" : "UNAUTHENTICATED");
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=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_sip.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_sip.c Fri Jul 25 16:08:52 2008
@@ -4691,8 +4691,7 @@
ast_log(LOG_ERROR, "update_call_counter(%s, %d) called with no event!\n", name, event);
}
if (p) {
- ast_devstate_changed(*inuse > *call_limit ? AST_DEVICE_BUSY :
- (*inuse == 0 ? AST_DEVICE_NOT_INUSE : AST_DEVICE_INUSE), "SIP/%s", p->name);
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", p->name);
unref_peer(p, "update_call_counter: unref_peer from call counter");
}
return 0;
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=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/channels/chan_skinny.c (original)
+++ team/tilghman/compiler_attributes/channels/chan_skinny.c Fri Jul 25 16:08:52 2008
@@ -4339,7 +4339,6 @@
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);
@@ -4623,8 +4622,6 @@
transmit_lamp_indication(s, STIMULUS_LINE, l->instance, SKINNY_LAMP_ON);
l->hookstate = SKINNY_OFFHOOK;
-
- ast_devstate_changed(AST_DEVICE_BUSY, "Skinny/%s@%s", l->name, d->name);
if (sub && sub->outgoing) {
/* We're answering a ringing call */
@@ -4666,7 +4663,7 @@
ast_verb(1, "RECEIVED UNKNOWN STIMULUS: %d(%d/%d)\n", event, instance, callreference);
break;
}
- ast_devstate_changed(newstate, "Skinny/%s@%s", l->name, d->name);
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "Skinny/%s@%s", l->name, d->name);
return 1;
}
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=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/main/channel.c (original)
+++ team/tilghman/compiler_attributes/main/channel.c Fri Jul 25 16:08:52 2008
@@ -1364,7 +1364,7 @@
ast_free(chan);
AST_RWLIST_UNLOCK(&channels);
- ast_devstate_changed(AST_DEVICE_NOT_INUSE, "%s", name);
+ ast_devstate_changed_literal(AST_DEVICE_NOT_INUSE, name);
}
struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
@@ -4100,7 +4100,7 @@
}
chan->_state = state;
- ast_devstate_changed(ast_state_chan2dev(state), "%s", name);
+ ast_devstate_changed_literal(ast_state_chan2dev(state), name);
/* setstate used to conditionally report Newchannel; this is no more */
manager_event(EVENT_FLAG_CALL,
"Newstate",
Modified: team/tilghman/compiler_attributes/main/devicestate.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/compiler_attributes/main/devicestate.c?view=diff&rev=133857&r1=133856&r2=133857
==============================================================================
--- team/tilghman/compiler_attributes/main/devicestate.c (original)
+++ team/tilghman/compiler_attributes/main/devicestate.c Fri Jul 25 16:08:52 2008
@@ -155,7 +155,7 @@
{ AST_STATE_BUSY, AST_DEVICE_BUSY },
{ AST_STATE_DIALING_OFFHOOK, AST_DEVICE_INUSE },
{ AST_STATE_PRERING, AST_DEVICE_RINGING },
- { NULL, NULL },
+ { -100, -100 },
};
/*! \brief A device state provider (not a channel) */
@@ -224,7 +224,7 @@
{
int i;
chanstate &= 0xFFFF;
- for (i = 0; chan2dev[i].chan != NULL; i++) {
+ for (i = 0; chan2dev[i].chan != -100; i++) {
if (chan2dev[i].chan == chanstate) {
return chan2dev[i].dev;
}
More information about the svn-commits
mailing list