[asterisk-commits] mmichelson: branch mmichelson/realtime-sip-devicestate r99965 - in /team/mmic...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 23 12:49:29 CST 2008
Author: mmichelson
Date: Wed Jan 23 12:49:29 2008
New Revision: 99965
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99965
Log:
Partial implementation of devicestate for realtime peers. I got this working on my realtime peer
but only for changing between "in use" and "not in use" right now. Will work on other states later.
Modified:
team/mmichelson/realtime-sip-devicestate/ (props changed)
team/mmichelson/realtime-sip-devicestate/channels/chan_sip.c
Change Statistics:
0 files changed
Propchange: team/mmichelson/realtime-sip-devicestate/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 23 12:49:29 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-99938
+/branches/1.4:1-99880
Modified: team/mmichelson/realtime-sip-devicestate/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/realtime-sip-devicestate/channels/chan_sip.c?view=diff&rev=99965&r1=99964&r2=99965
==============================================================================
--- team/mmichelson/realtime-sip-devicestate/channels/chan_sip.c (original)
+++ team/mmichelson/realtime-sip-devicestate/channels/chan_sip.c Wed Jan 23 12:49:29 2008
@@ -3276,6 +3276,9 @@
ast_log(LOG_ERROR, "update_call_counter(%s, %d) called with no event!\n", name, event);
}
if (p) {
+ char usestr[20];
+ snprintf(usestr, sizeof(usestr), "%d", *inuse);
+ ast_update_realtime("sippeers", "name", p->name, "inuse", usestr, NULL);
ast_device_state_changed("SIP/%s", p->name);
ASTOBJ_UNREF(p, sip_destroy_peer);
} else /* u must be set */
@@ -15837,9 +15840,10 @@
} else if (p->call_limit && (p->inUse == p->call_limit))
/* check call limit */
res = AST_DEVICE_BUSY;
- else if (p->call_limit && p->inUse)
+ else if (p->call_limit && p->inUse) {
/* Not busy, but we do have a call */
res = AST_DEVICE_INUSE;
+ }
else if (p->maxms && ((p->lastms > p->maxms) || (p->lastms < 0)))
/* We don't have a call. Are we reachable at all? Requires qualify= */
res = AST_DEVICE_UNAVAILABLE;
@@ -16670,6 +16674,12 @@
peer->maxcallbitrate = atoi(v->value);
if (peer->maxcallbitrate < 0)
peer->maxcallbitrate = default_maxcallbitrate;
+ }
+ /*TESTING PURPOSES ONLY MOTHERFUCKER*/
+ else if (realtime && !strcasecmp(v->name, "inuse")) {
+ peer->inUse = atoi(v->value);
+ if (peer->inUse < 0)
+ peer->inUse = 0;
}
}
if (!ast_test_flag(&global_flags[1], SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && realtime) {
More information about the asterisk-commits
mailing list