[Home]

Summary:ASTERISK-05138: hints just shows states 0 and 4 on SIP devices
Reporter:paradise (paradise)Labels:
Date Opened:2005-09-24 01:50:27Date Closed:2008-01-15 15:49:09.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Subscriptions
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) calllimitpeer.txt
( 1) Patch-5281.txt
( 2) Patch-5281-v2.txt
Description:after switching to CVS HEAD noticed that hints not working as expected. (test on snom190 and eyeBeam) after some debugging  found that asterisk (devicestate.c) just understands and reports state 0 and 4 of SIP device. (seems no problem woth Zap channels) :

DEBUG[9472] devicestate.c: Changing state for Zap/4 - state 2 (In use)
DEBUG[9472] app_queue.c: Device 'Zap/4' changed to state '2' (In use)
DEBUG[9472] app_queue.c: Device 'Zap/4' changed to state '2' (In use)
DEBUG[9472] devicestate.c: Changing state for Zap/4 - state 0 (Unknown)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] devicestate.c: Changing state for SIP/11 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] devicestate.c: Changing state for SIP/11 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] app_queue.c: Device 'Zap/4' changed to state '0' (Unknown)
DEBUG[9472] app_queue.c: Device 'SIP/11' changed to state '1' (Not in use)
DEBUG[9472] app_queue.c: Device 'SIP/11' changed to state '1' (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] devicestate.c: Changing state for SIP/11 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] app_queue.c: Device 'SIP/11' changed to state '1' (Not in use)
DEBUG[9472] devicestate.c: Changing state for Zap/3 - state 0 (Unknown)
DEBUG[9472] devicestate.c: Changing state for Zap/3 - state 0 (Unknown)
DEBUG[9472] app_queue.c: Device 'Zap/3' changed to state '0' (Unknown)
DEBUG[9472] app_queue.c: Device 'Zap/3' changed to state '0' (Unknown)
DEBUG[9472] devicestate.c: Changing state for Zap/3 - state 2 (In use)
DEBUG[9472] devicestate.c: Changing state for Zap/3 - state 2 (In use)
DEBUG[9472] app_queue.c: Device 'Zap/3' changed to state '2' (In use)
DEBUG[9472] app_queue.c: Device 'Zap/3' changed to state '2' (In use)
DEBUG[9472] chan_sip.c: Checking device state for peer 19
DEBUG[9472] devicestate.c: Changing state for SIP/19 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 19
DEBUG[9472] app_queue.c: Device 'SIP/19' changed to state '1' (Not in use)
DEBUG[9472] devicestate.c: Changing state for Zap/3 - state 0 (Unknown)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] devicestate.c: Changing state for SIP/11 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] devicestate.c: Changing state for SIP/11 - state 1 (Not in use)
DEBUG[9472] chan_sip.c: Checking device state for peer 11
DEBUG[9472] app_queue.c: Device 'Zap/3' changed to state '0' (Unknown)
DEBUG[9472] app_queue.c: Device 'SIP/11' changed to state '1' (Not in use)
DEBUG[9472] app_queue.c: Device 'SIP/11' changed to state '1' (Not in use)


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

at the moment show hints and show channels show:

   -= Registered Asterisk Dial Plan Hints =-
  101                 : SIP/101               State  0 Watchers  0
  100                 : SIP/100               State  0 Watchers  0
  90                  : SIP/90                State  0 Watchers  0
  89                  : SIP/89                State  4 Watchers  0
  59                  : SIP/59                State  4 Watchers  0
  54                  : SIP/54                State  0 Watchers  1
  26                  : SIP/26                State  4 Watchers  0
  25                  : SIP/25                State  4 Watchers  0
  24                  : SIP/24                State  4 Watchers  0
  23                  : SIP/23                State  4 Watchers  0
  22                  : SIP/22                State  4 Watchers  0
  21                  : SIP/21                State  4 Watchers  0
  19                  : SIP/19                State  0 Watchers  0
  18                  : SIP/18                State  4 Watchers  0
  16                  : SIP/16                State  0 Watchers  0
  15                  : SIP/15                State  4 Watchers  0
  14                  : SIP/14                State  4 Watchers  0
  12                  : SIP/12                State  0 Watchers  0
  11                  : SIP/11                State  0 Watchers  1
  10                  : SIP/10                State  0 Watchers  0
----------------
- 20 hints registred

Channel              Location             State   Application(Data)
SIP/54-075a          (None)               Up      Bridged Call(SIP/12-170b)
SIP/12-170b          s@macro-extdial:2    Up      Dial(SIP/54|18|Crg)
SIP/11-dbd6          (None)               Up      Bridged Call(Zap/2-1)
Zap/2-1              s@incoming:2         Up      Queue(default|r|||30)
SIP/11-8914          (None)               Up      Bridged Call(Zap/1-1)
Zap/1-1              s@macro-extdial:2    Up      Dial(SIP/11|42|Crg)
6 active channels
3 active calls
Comments:By: paradise (paradise) 2005-09-24 01:52:48

CVS HEAD Date is: 09-23-2005

By: Kevin P. Fleming (kpfleming) 2005-09-25 17:25:14

Fixed in CVS HEAD.

By: paradise (paradise) 2005-09-27 00:54:25

still the same problem.

at the time of getting the following list 3 extensions(11,12,54) are on call, but no hints and no LEDs!

   -= Registered Asterisk Dial Plan Hints =-
  101                 : SIP/101               State  0 Watchers  0
  100                 : SIP/100               State  0 Watchers  0
  90                  : SIP/90                State  0 Watchers  0
  89                  : SIP/89                State  4 Watchers  0
  59                  : SIP/59                State  4 Watchers  0
  54                  : SIP/54                State  0 Watchers  1
  26                  : SIP/26                State  4 Watchers  0
  25                  : SIP/25                State  4 Watchers  0
  24                  : SIP/24                State  4 Watchers  0
  23                  : SIP/23                State  4 Watchers  0
  22                  : SIP/22                State  4 Watchers  0
  21                  : SIP/21                State  4 Watchers  0
  19                  : SIP/19                State  4 Watchers  0
  18                  : SIP/18                State  4 Watchers  0
  16                  : SIP/16                State  0 Watchers  0
  15                  : SIP/15                State  4 Watchers  0
  14                  : SIP/14                State  4 Watchers  0
  12                  : SIP/12                State  0 Watchers  0
  11                  : SIP/11                State  0 Watchers  1
  10                  : SIP/10                State  0 Watchers  0
----------------
- 20 hints registred

By: Kevin P. Fleming (kpfleming) 2005-09-29 00:13:52

OK, please show the 'show channels' output when your system is in this condition. I also need to know whether you are using the 'qualify' option for your SIP peers, and if so, what their status was at that time (presumably REACHABLE).

By: Kevin P. Fleming (kpfleming) 2005-10-04 21:45:52

Please re-test with CVS HEAD; some more changes went in tonight that could affect this problem in a positive way :-)

By: paradise (paradise) 2005-10-05 01:44:28

upgraded to CVS HEAD but no success yet!

> show version files chan_sip.c
File                      Revision
----                      --------
chan_sip.c                Revision: 1.882

> sip show subscriptions
Peer             User        Call ID      Extension        Last state     Type  
192.168.2.7      54          5474982b620  54               Idle           pidf+xml
192.168.2.7      54          530cdd66451  14               Idle           pidf+xml
192.168.2.7      54          a36b9f290f3  12               Idle           pidf+xml
192.168.2.31     12          3c2670cb0ea  54               Idle           dialog-info+xml
4 active SIP subscriptions

> show hints
   -= Registered Asterisk Dial Plan Hints =-
  54                  : SIP/54                State  0 Watchers  2
  26                  : SIP/26                State  4 Watchers  0
  25                  : SIP/25                State  4 Watchers  0
  18                  : SIP/18                State  4 Watchers  0
  14                  : SIP/14                State  4 Watchers  1
  12                  : SIP/12                State  0 Watchers  1
  11                  : SIP/11                State  0 Watchers  0
----------------
- 7 hints registred

> show channels
Channel              Location             State   Application(Data)
SIP/12-b05e          (None)               Up      Bridged Call(SIP/54-f73f)
SIP/54-f73f          s@macro-extdial:2    Up      Dial(SIP/12|36|Crg)
2 active channels
1 active call

ext. 12 is snom190 and ext. 54 is eyeBeam and both are monitorting each other but no indicator is ON, on this call.

By: Olle Johansson (oej) 2005-10-05 02:46:21

Please check with latest cvs head, there was some changes tonight.

By: paradise (paradise) 2005-10-05 03:21:44

i'm using the very latest CVS.
as u see my chan_sip version is 1.882

By: paradise (paradise) 2005-10-05 23:38:06

tested again with tonights CVS. no success yet!

By: Olle Johansson (oej) 2005-10-11 23:10:14

I can not repeat this, I see state 8 and 1 during a call. Latest CVS head.

By: Olle Johansson (oej) 2005-10-11 23:11:49

If you can duplicate it, we need full configuration and SIP debug output with verbose 4, debug 4 and sip debug turned on. Thank you!

/Olle and Kevin in the  Astricon Code Zone

By: paradise (paradise) 2005-10-27 07:57:23

i just found that when i set "type=peer" in "sip.conf" everything works as expected!
is this normal?



By: paradise (paradise) 2005-10-30 03:09:23.000-0600

it seems that hints not working on sip extens which type=friend

By: Olle Johansson (oej) 2005-10-30 03:18:53.000-0600

I have type=friend and it works perfectly... There's something else going on here.

By: Olle Johansson (oej) 2005-10-30 03:19:34.000-0600

Still need the configuration and debug output as requested before.

By: paradise (paradise) 2005-10-30 03:26:51.000-0600

this is my config file.
i'm trying to get the debug output.

[general]
context=default
port=5060
bindaddr=0.0.0.0
disallow=all
allow=ulaw
allow=alaw
allow=gsm
allow=h263
allow=h261
videosupport=yes
trustrpid=yes
maxexpirey=300
defaultexpirey=120
rtptimeout=120
rtpholdtimeout=360
canreinvite=no
insecure=port,invite
srvlookup=no
checkmwi=10
sipdebug=no
usereqphone=yes
subscribecontext = myextens
notifyringing = yes

[10]
context=myextens
type=friend
host=dynamic
username=10
secret=10
dtmf=rfc2833
disallow=all
allow=ulaw
allow=alaw
allow=gsm
call-limit=5

other extens as "10"

By: Olle Johansson (oej) 2005-10-30 03:29:22.000-0600

Please add that kind of information as attachments to a bug report, not inline. It makes it much harder to manager the bug report and read e-mails from the bug tracker if you add them inline. Thank you!

By: Olle Johansson (oej) 2005-10-30 03:30:51.000-0600

Off-topic: The "username" config is of no help without "defaultip".

By: Kevin P. Fleming (kpfleming) 2005-11-10 23:05:06.000-0600

Closing until the appropriate debug/trace output can be provided.

By: paradise (paradise) 2005-12-03 09:28:16.000-0600

I could solve the problem with the attached patch.
any comments?

By: Olle Johansson (oej) 2005-12-03 12:01:40.000-0600

Your patch reverts the problem so the opposite will occur I think, but it highlighted a potential problem when using type=friend. I think this patch will have the same effect, please try it.

Thank you for being stubborn and locating the problem and contributing to Asterisk!

/O :-)

By: paradise (paradise) 2005-12-04 00:36:46.000-0600

> Your patch reverts the problem so the opposite will occur I think, but it
> highlighted a potential problem when using type=friend.
i dont think so! consider that in sip_devicestate() it just changes the state according to peer->call_limit:
if ((p = find_peer(host, NULL, 1))) {
 ...
} else {
 res = AST_DEVICE_UNAVAILABLE;
}

> I think this patch will have the same effect, please try it.
No, with your patch just the state of called exten. in a call will be changed.

By: paradise (paradise) 2005-12-07 15:47:14.000-0600

oej: any comments?

By: Kevin P. Fleming (kpfleming) 2005-12-13 10:53:00.000-0600

What does 'state of called exten in a call mean'?

By: paradise (paradise) 2005-12-14 07:57:38.000-0600

kpfleming: when a call is made there are two ends: caller --> called.
with oej patch just the called number devices state will change.
consider when both caller and called numbers to be local sip device, so just one end device state will monitor correctly.

By: Olle Johansson (oej) 2005-12-14 10:18:27.000-0600

If that's the case, we have a problem elsewhere. This code should be called twice, one time for the outbound call and another time for the inbound call.

By: paradise (paradise) 2005-12-14 14:16:54.000-0600

i think that update_call_counter() is already running twice per call.

By: paradise (paradise) 2005-12-20 02:55:50.000-0600

i'm still using the patch without any problem.
it works fine for both friends and peers.

By: paradise (paradise) 2006-01-03 05:54:56.000-0600

removing "call-limit" in sip.conf makes hints work again without using the patch!!!
any comments?

By: opsys (opsys) 2006-01-03 08:08:47.000-0600

call-limit is depreciated in favor of GroupCount and Group Function.

By: Kenneth Holm (saitech) 2006-01-03 09:12:59.000-0600

If call-limit is deprecated, how can i limit calls for sip-users/agents in a queue?

I cannot see, how i should do this with group count. I have used incominglimit/outgoinglimit in asteris 1.07 but have switched to asterisk 1.2.1

By: Olle Johansson (oej) 2006-01-03 11:45:08.000-0600

Not any more.

By: Kenneth Holm (saitech) 2006-01-03 12:01:10.000-0600

In that case, it not possible in any way, to limit an agent to have only one incomming call? I want to eliminate the call waiting for an agent answering calls from any queue.

Isn't that possible in any way at all anymore?

By: Olle Johansson (oej) 2006-01-03 12:07:37.000-0600

The agent discussion is outside of this issue report.

By: paradise (paradise) 2006-01-04 00:47:48.000-0600

so all call-limit related code in chan_sip.c should be removed. ;-)

By: Olle Johansson (oej) 2006-01-04 01:10:06.000-0600

Call-limits will stay. "incominglimit" and "outgoinglimit" are being removed as keywords.

By: Olle Johansson (oej) 2006-01-04 02:07:42.000-0600

I think these problems come from the fact that incoming calls are counted on the user part and outbound calls on the peer part of a friend. There's no combined counter.

To solve this correctly, we need to remove user/peers, as will be done in chan_sip3. That way, we will only have one counter for the calls.

And yes, if you disable call-limits things will work differently.

I think this report is ready to be closed with my recent patches to svn trunk.

By: paradise (paradise) 2006-01-04 02:22:11.000-0600

I've also faced some crashes which seems to be related to hint and sip subscriptions. by disbaling hints no more crashes will occur.
this is reported as bug ASTERISK-5755813.

btw, thanks for your comments!

By: Olle Johansson (oej) 2006-01-04 02:59:08.000-0600

Fixed in svn trunk.

By: Olle Johansson (oej) 2006-01-04 03:02:52.000-0600

paradise: Thanks for working hard on solving issues you find in Asterisk!

/Olle

By: Olle Johansson (oej) 2006-01-04 03:03:00.000-0600

paradise: Thanks for working hard on solving issues you find in Asterisk!

/Olle

By: Digium Subversion (svnbot) 2008-01-15 15:49:09.000-0600

Repository: asterisk
Revision: 6654

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r6654 | kpfleming | 2008-01-15 15:49:08 -0600 (Tue, 15 Jan 2008) | 2 lines

clean update devicestate function, ensure that it can return AST_DEVICE_UNKNOWN when call limits are not turned on (issue ASTERISK-5138)

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

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