mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Merged revisions 53079 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r53079 | oej | 2007-02-01 21:28:54 +0100 (Thu, 01 Feb 2007) | 2 lines Cleaning up the devicestate callback function ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53080 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -15355,8 +15355,12 @@ static int sip_poke_peer(struct sip_peer *peer)
|
|||||||
- registered AST_DEVICE_NOT_INUSE
|
- registered AST_DEVICE_NOT_INUSE
|
||||||
- fixed IP (!dynamic) AST_DEVICE_NOT_INUSE
|
- fixed IP (!dynamic) AST_DEVICE_NOT_INUSE
|
||||||
|
|
||||||
|
Peers that does not have a known call and can't be reached by OPTIONS
|
||||||
|
- unreachable AST_DEVICE_UNAVAILABLE
|
||||||
|
|
||||||
If we return AST_DEVICE_UNKNOWN, the device state engine will try to find
|
If we return AST_DEVICE_UNKNOWN, the device state engine will try to find
|
||||||
out a state by walking the channel list.
|
out a state by walking the channel list.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static int sip_devicestate(void *data)
|
static int sip_devicestate(void *data)
|
||||||
{
|
{
|
||||||
@@ -15380,27 +15384,35 @@ static int sip_devicestate(void *data)
|
|||||||
if ((p = find_peer(host, NULL, 1))) {
|
if ((p = find_peer(host, NULL, 1))) {
|
||||||
if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
|
if (p->addr.sin_addr.s_addr || p->defaddr.sin_addr.s_addr) {
|
||||||
/* we have an address for the peer */
|
/* we have an address for the peer */
|
||||||
/* if qualify is turned on, check the status */
|
|
||||||
if (p->maxms && (p->lastms > p->maxms)) {
|
/* Check status in this order
|
||||||
res = AST_DEVICE_UNAVAILABLE;
|
- Hold
|
||||||
} else {
|
- Ringing
|
||||||
/* qualify is not on, or the peer is responding properly */
|
- Busy (enforced only by call limit)
|
||||||
/* check call limit */
|
- Inuse (we have a call)
|
||||||
if (p->call_limit && (p->inUse == p->call_limit))
|
- Unreachable (qualify)
|
||||||
res = AST_DEVICE_BUSY;
|
If we don't find any of these state, report AST_DEVICE_NOT_INUSE
|
||||||
else if (p->call_limit && p->inUse)
|
for registered devices */
|
||||||
res = AST_DEVICE_INUSE;
|
|
||||||
else
|
|
||||||
res = AST_DEVICE_NOT_INUSE;
|
|
||||||
if (p->onHold)
|
if (p->onHold)
|
||||||
|
/* First check for hold or ring states */
|
||||||
res = AST_DEVICE_ONHOLD;
|
res = AST_DEVICE_ONHOLD;
|
||||||
else if (p->inRinging) {
|
else if (p->inRinging) {
|
||||||
if (p->inRinging == p->inUse)
|
if (p->inRinging == p->inUse)
|
||||||
res = AST_DEVICE_RINGING;
|
res = AST_DEVICE_RINGING;
|
||||||
else
|
else
|
||||||
res = AST_DEVICE_RINGINUSE;
|
res = AST_DEVICE_RINGINUSE;
|
||||||
}
|
} else if (p->call_limit && (p->inUse == p->call_limit))
|
||||||
}
|
/* check call limit */
|
||||||
|
res = AST_DEVICE_BUSY;
|
||||||
|
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))
|
||||||
|
/* We don't have a call. Are we reachable at all? Requires qualify= */
|
||||||
|
res = AST_DEVICE_UNAVAILABLE;
|
||||||
|
else /* Default reply if we're registered and have no other data */
|
||||||
|
res = AST_DEVICE_NOT_INUSE;
|
||||||
} else {
|
} else {
|
||||||
/* there is no address, it's unavailable */
|
/* there is no address, it's unavailable */
|
||||||
res = AST_DEVICE_UNAVAILABLE;
|
res = AST_DEVICE_UNAVAILABLE;
|
||||||
|
Reference in New Issue
Block a user