[Home]

Summary:ASTERISK-12758: hint change state to Idle when peer reregisters
Reporter:pj (pj)Labels:
Date Opened:2008-09-20 05:25:36Date Closed:2008-12-12 10:55:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Subscriptions
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:- peer make call and asterisk changes extension state to InUse.
- peers sip registration expires after specified interval in sip.conf
- peer refreshes sip registration using sip register
- asterisk changes extension state for that peer from InUse to Idle.  

Users that have subscribed to this extension then see, that extension is Idle, but it's wrong, because peer have still call and monitored extension should stay InUse until hangup.


****** ADDITIONAL INFORMATION ******

SIP 200 OK from asterisk server as reply to peer registration and changing extension state from InUse to Idle.

[Sep 20 11:56:17]
<--- Transmitting (NAT) to 193.85.164.154:10351 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 193.85.164.154:10351;branch=z9hG4bKs69kq8id482bs38ru86opo3;received=193.85.164.154
From: <sip:324@ipbx.i.cz>;tag=kgcichusq1hc6r4246sf
To: <sip:324@ipbx.i.cz>;tag=as2578046a
Call-ID: GV0ChXgZoIebDO6U-HCUj2QqFBs3xP
CSeq: 7957 REGISTER
Server: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
Expires: 400
Contact: <sip:324@193.85.164.154:10351;transport=UDP>;expires=400
Date: Sat, 20 Sep 2008 09:56:17 GMT
Content-Length: 0


<------------>
[Sep 20 11:56:18]   == Extension Changed 324[linestates] new state Idle for Notify User 324p
Comments:By: Leif Madsen (lmadsen) 2008-10-14 11:48:23

Does this happen in 1.4.x, or only on 1.6/trunk? If it didn't happen in 1.4, any ideas as to when this change may have occured? Thanks!

By: pj (pj) 2008-10-15 16:27:47

I'm using hints only with asterisk trunk, but it was working before,
so I will try to find commit that causes this issue, maybe it's month or two ago.

By: BJ Weschke (bweschke) 2008-10-15 17:04:22

assigned to davevg to see if he can reproduce in his lab environment

By: pj (pj) 2008-11-29 15:35:22.000-0600

issue still persist in todays trunk revision (Asterisk SVN-trunk-r159853)
do you need some more debugging from me?
It's easily reproductible: when sip device refreshes registration, device status is immediatelly changed to idle, even call still continues.

By: Digium Subversion (svnbot) 2008-12-11 09:05:45.000-0600

Repository: asterisk
Revision: 162997

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r162997 | file | 2008-12-11 09:05:45 -0600 (Thu, 11 Dec 2008) | 4 lines

When a device registers to use it is entirely possible that they may be in use, so tell the core that we don't know the devstate and have it ask us for it.
(closes issue ASTERISK-12758)
Reported by: pj

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=162997

By: pj (pj) 2008-12-11 15:08:54.000-0600

now, when peer reregisters, asterisk changes line state from InUse to Busy,
imho, this isn't yet correct behaviour
Asterisk SVN-trunk-r163094

[Dec 11 22:04:20]   == Using SIP RTP CoS mark 5
[Dec 11 22:04:20]   == Extension Changed 324[linestates] new state Busy for Notify User 324p
[Dec 11 22:04:20]   == Extension Changed 324[linestates] new state InUse for Notify User 324p (queued)
[Dec 11 22:04:20]     -- Executing [959@testservices:3] Playback("SIP/324-b7211688", "demo-echotest") in new stack
[Dec 11 22:04:20]   == Extension Changed 324[linestates] new state InUse for Notify User 324p
[Dec 11 22:04:20]     -- <SIP/324-b7211688> Playing 'demo-echotest.slin' (language 'cz')
[Dec 11 22:04:40]     -- Executing [959@testservices:4] Echo("SIP/324-b7211688", "") in new stack
sip reregistration ==>> [Dec 11 22:06:23]   == Extension Changed 324[linestates] new state Busy for Notify User 324p
[Dec 11 22:06:33]   == Spawn extension (testservices, h, 1) exited non-zero on 'SIP/324-b7211688'
[Dec 11 22:06:33]   == Extension Changed 324[linestates] new state Idle for Notify User 324p



By: Joshua C. Colp (jcolp) 2008-12-11 15:12:05.000-0600

What is your sip.conf configuration like?

By: pj (pj) 2008-12-11 15:36:22.000-0600

[general]
context=from-guest                 ; Default context for incoming calls
srvlookup=yes                    ; Enable DNS SRV lookups on outbound calls
allowguest=yes
match_auth_username=yes
allowsubscribe=no
alwaysauthreject=yes
disallow=all                    ; First disallow all codecs
allow=g729,gsm,ilbc,alaw
language=cz
canreinvite=no
nat=yes

[phone](!)
type=peer
host=dynamic
qualify=4000
qualifyfreq=20
nat=yes
canreinvite=no
disallow=all
allow=g729,gsm,ilbc
callcounter=yes
busylevel=1
allowsubscribe=yes
subscribecontext=linestates
context=zamestnanci


[324p](phone)
secret=xxx
callerid="Pavel Jezek" <324>

By: Joshua C. Colp (jcolp) 2008-12-11 15:49:16.000-0600

That explains why it went to busy, you have busylevel set to 1. That does not explain why it went to in use though in the first place...

By: pj (pj) 2008-12-11 16:06:08.000-0600

actually, I don't see any difference between InUse and Busy, because line that is in use (regardless if has incomming or outgoing call) asterisk shows as 'InUse', but changes to 'Busy' when phone refreshes registration.

By: Joshua C. Colp (jcolp) 2008-12-11 16:24:09.000-0600

I don't understand your last note. They mean two different things. In use means that the phone is in use but can accept further calls, busy means that the phone is in use but can not accept further calls. You should see busy regardless but the code is changing to in use after busy for whatever reason.

By: pj (pj) 2008-12-11 16:34:50.000-0600

OK, thanks for explanation...
anyway, imho, line state should stay same throughout the call, without being affected with sip registration refresh.

By: Digium Subversion (svnbot) 2008-12-12 10:55:11.000-0600

Repository: asterisk
Revision: 163579

U   trunk/channels/chan_sip.c
U   trunk/main/channel.c

------------------------------------------------------------------------
r163579 | file | 2008-12-12 10:55:10 -0600 (Fri, 12 Dec 2008) | 4 lines

Since chan_sip is callback devicestate driven do not pass in actual states, pass in unknown so we get asked. Additionally do not pass in an actual device state value in ast_setstate since the channel may be callback driven.
(closes issue ASTERISK-12758)
Reported by: pj

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=163579