[asterisk-commits] trunk r17365 - in /trunk: channels/chan_sip.c
devicestate.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Apr 4 11:24:44 MST 2006
Author: oej
Date: Tue Apr 4 13:24:41 2006
New Revision: 17365
URL: http://svn.digium.com/view/asterisk?rev=17365&view=rev
Log:
- Don't return AST_DEVICE_UNKNOWN to devicestate engine, since this will
cause a channel walk...
- Doxygen fixed for devicestate.c
Modified:
trunk/channels/chan_sip.c
trunk/devicestate.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=17365&r1=17364&r2=17365&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Apr 4 13:24:41 2006
@@ -11835,12 +11835,16 @@
For peers with call limit:
- not registered AST_DEVICE_UNAVAILABLE
- - registered, no call AST_DEVICE_NOT_INUSE
- - registered, calls possible AST_DEVICE_INUSE
+ - registered, no call AST_DEVICE_NOT_INUSE
+ - registered, active calls AST_DEVICE_INUSE
- registered, call limit reached AST_DEVICE_BUSY
For peers without call limit:
- not registered AST_DEVICE_UNAVAILABLE
- - registered AST_DEVICE_UNKNOWN
+ - registered AST_DEVICE_NOT_INUSE
+ - fixed IP (!dynamic) AST_DEVICE_NOT_INUSE
+
+ If we return AST_DEVICE_UNKNOWN, the device state engine will try to find
+ out a state by walking the channel list.
*/
static int sip_devicestate(void *data)
{
@@ -11873,10 +11877,8 @@
res = AST_DEVICE_BUSY;
else if (p->call_limit && p->inUse)
res = AST_DEVICE_INUSE;
- else if (p->call_limit)
+ else
res = AST_DEVICE_NOT_INUSE;
- else
- res = AST_DEVICE_UNKNOWN;
}
} else {
/* there is no address, it's unavailable */
Modified: trunk/devicestate.c
URL: http://svn.digium.com/view/asterisk/trunk/devicestate.c?rev=17365&r1=17364&r2=17365&view=diff
==============================================================================
--- trunk/devicestate.c (original)
+++ trunk/devicestate.c Tue Apr 4 13:24:41 2006
@@ -42,17 +42,18 @@
#include "asterisk/pbx.h"
#include "asterisk/options.h"
+/*! \brief Device state strings for printing */
static const char *devstatestring[] = {
- /* 0 AST_DEVICE_UNKNOWN */ "Unknown", /* Valid, but unknown state */
- /* 1 AST_DEVICE_NOT_INUSE */ "Not in use", /* Not used */
- /* 2 AST_DEVICE IN USE */ "In use", /* In use */
- /* 3 AST_DEVICE_BUSY */ "Busy", /* Busy */
- /* 4 AST_DEVICE_INVALID */ "Invalid", /* Invalid - not known to Asterisk */
- /* 5 AST_DEVICE_UNAVAILABLE */ "Unavailable", /* Unavailable (not registred) */
- /* 6 AST_DEVICE_RINGING */ "Ringing" /* Ring, ring, ring */
+ /* 0 AST_DEVICE_UNKNOWN */ "Unknown", /*!< Valid, but unknown state */
+ /* 1 AST_DEVICE_NOT_INUSE */ "Not in use", /*!< Not used */
+ /* 2 AST_DEVICE IN USE */ "In use", /*!< In use */
+ /* 3 AST_DEVICE_BUSY */ "Busy", /*!< Busy */
+ /* 4 AST_DEVICE_INVALID */ "Invalid", /*!< Invalid - not known to Asterisk */
+ /* 5 AST_DEVICE_UNAVAILABLE */ "Unavailable", /*!< Unavailable (not registred) */
+ /* 6 AST_DEVICE_RINGING */ "Ringing" /*!< Ring, ring, ring */
};
-/* ast_devstate_cb: A device state watcher (callback) */
+/*! \brief A device state watcher (callback) */
struct devstate_cb {
void *data;
ast_devstate_cb_type callback;
@@ -77,7 +78,11 @@
return devstatestring[devstate];
}
-/*! \brief Find out if device is active in a call or not */
+/*! \brief Find out if device is active in a call or not
+\note find channels with the device's name in it
+This function is only used for channels that does not implement
+devicestate natively
+*/
int ast_parse_device_state(const char *device)
{
struct ast_channel *chan;
More information about the asterisk-commits
mailing list