[Home]

Summary:ASTERISK-19243: DEVICE_STATE not correct when in h extension
Reporter:David Hajek (hajekd)Labels:
Date Opened:2012-01-25 02:24:10.000-0600Date Closed:2012-02-09 14:15:15.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:
Versions:1.8.8.2 1.8.9.0 Frequency of
Occurrence
Related
Issues:
Environment:Linxu CentOS 5.xAttachments:
Description:Under some circumstances DEVICE_STATE for extension is incorrectly set to NOT_INUSE when still processing h extension. This bug is on 1.6.X and all 1.8.X including latest rc candidates.

Scenario for the bug reproduction:

Extension 502 is calling extension 500

Dialplan:

[from-test]
exten => _X.,1,NoOp(${CALLERID(num)} is calling ${EXTEN})
exten => _X.,n,Dial(SIP/${EXTEN})
exten => _X.,n,Hangup
exten => h,1,NoOp(Now in h extension.....)
exten => h,n,NoOp(My DEVICE_STATE is ${DEVICE_STATE(SIP/${CALLERID(num)})}) ; <<< HERE IT SHOULD BE STILL INUSE
exten => h,n,Wait(10)
exten => h,n,NoOp(Exiting...)

Logs when 502 is calling 500 and 502 does cancel the call before 500 answer

-- Executing [500@from-test:1] NoOp("SIP/502-0000000a", "502 is calling 500") in new stack
   -- Executing [500@from-test:2] Dial("SIP/502-0000000a", "SIP/500") in new stack
 == Using SIP RTP TOS bits 184
 == Using SIP RTP CoS mark 5
   -- Called SIP/500
   -- SIP/500-0000000b is ringing
 == Spawn extension (from-test, 500, 2) exited non-zero on 'SIP/502-0000000a'
   -- Executing [h@from-test:1] NoOp("SIP/502-0000000a", "Now in h extension.....") in new stack
   -- Executing [h@from-test:2] NoOp("SIP/502-0000000a", "My DEVICE_STATE is NOT_INUSE") in new stack <<<<< WRONG!
   -- Executing [h@from-test:3] Wait("SIP/502-0000000a", "10") in new stack

Logs when 502 is calling 500 and call is answered - then all is OK

-- Executing [500@from-test:1] NoOp("SIP/502-0000000c", "502 is calling 500") in new stack
   -- Executing [500@from-test:2] Dial("SIP/502-0000000c", "SIP/500") in new stack
 == Using SIP RTP TOS bits 184
 == Using SIP RTP CoS mark 5
   -- Called SIP/500
   -- SIP/500-0000000d is ringing
   -- SIP/500-0000000d answered SIP/502-0000000c
   -- Locally bridging SIP/502-0000000c and SIP/500-0000000d
   -- Executing [h@from-test:1] NoOp("SIP/502-0000000c", "Now in h extension.....") in new stack
   -- Executing [h@from-test:2] NoOp("SIP/502-0000000c", "My DEVICE_STATE is INUSE") in new stack
   -- Executing [h@from-test:3] Wait("SIP/502-0000000c", "10") in new stack
 == Spawn extension (from-test, h, 3) exited non-zero on 'SIP/502-0000000c'
 == Spawn extension (from-test, 500, 2) exited non-zero on 'SIP/502-0000000c'
Comments:By: David Hajek (hajekd) 2012-01-25 08:17:37.772-0600

Oops, Wait in h does not make sense. But thats not relevant for this bug.

By: Matt Jordan (mjordan) 2012-02-09 14:15:08.570-0600

This is not a bug.

A SIP device is INUSE if it is on an active call.  As the UA 500 never answered, the channel SIP/502 was never bridged with another channel, and thus never put into an INUSE state.

In the other example, the device state is INUSE as the hangup extension occurs prior to channel teardown; hence, since the SIP/502 channel was bridged with the SIP/500 channel, a call did occur.