[Home]

Summary:ASTERISK-13100: Asterisk can't watch for more than 5 devices on a single hint
Reporter:mdu113 (mdu113)Labels:
Date Opened:2008-11-21 13:26:28.000-0600Date Closed:2010-08-31 13:26:57
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Subscriptions
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Here's the hint in dialplan:
[xyz]
exten => __PRS2_010,hint,SIP/xyz010001&SIP/xyz010002&SIP/xyz210001&SIP/xyz110001&SIP/xyz010101
there're currently 5 devices to watch and everything works fine if i make a call to SIP/xyz010101 (last one):
   -- Executing [101@xyz:1] Set("SIP/xyz112201-b7304288", "TIMEOUT(absolute)=10800") in new stack
   -- Channel will hangup at 2008-11-21 22:17:36 UTC.
   -- Executing [101@xyz:2] AGI("SIP/xyz112201-b7304288", "agi://pbxtest") in new stack
   -- AGI Script Executing Application: (SetCallerPres) Options: (allowed_passed_screen)
   -- AGI Script Executing Application: (Set) Options: (CALLERID(name)=Michael)
   -- AGI Script Executing Application: (Dial) Options: (SIP/xyz010101|15|)
   -- Called xyz010101
   -- SIP/xyz010101-081f8b58 is ringing
devel*CLI> show hints
devel*CLI>
   -= Registered Asterisk Dial Plan Hints =-
            __PRS2_010@xyz                 : SIP/xyz010001&SIP/xy  State:Ringing         Watchers  0
----------------
- 1 hints registered
   -- SIP/xyz010101-081f8b58 answered SIP/xyz112201-b7304288
devel*CLI> show hints
devel*CLI>
   -= Registered Asterisk Dial Plan Hints =-
            __PRS2_010@xyz                 : SIP/xyz010001&SIP/xy  State:InUse           Watchers  0
----------------
- 1 hints registered

Now I'm adding another device to watch in front of SIP/xyz010101 making it 6th device:
[xyz]
exten => __PRS2_010,hint,SIP/xyz010001&SIP/xyz010002&SIP/xyz210001&SIP/xyz110001&SIP/xyz011101&SIP/xyz010101
and do 'dialplan reload'. asterisk takes this configurion without a word of complain, but now the state of SIP/xyz010101 is always Idle:
   -- Executing [101@xyz:1] Set("SIP/xyz112201-b7304288", "TIMEOUT(absolute)=10800") in new stack
   -- Channel will hangup at 2008-11-21 22:21:20 UTC.
   -- Executing [101@xyz:2] AGI("SIP/xyz112201-b7304288", "agi://pbxtest") in new stack
   -- AGI Script Executing Application: (SetCallerPres) Options: (allowed_passed_screen)
   -- AGI Script Executing Application: (Set) Options: (CALLERID(name)=Michael)
   -- AGI Script Executing Application: (Dial) Options: (SIP/xyz010101|15|)
   -- Called xyz010101
   -- SIP/xyz010101-081f8b58 is ringing
devel*CLI> show hints
devel*CLI>
   -= Registered Asterisk Dial Plan Hints =-
            __PRS2_010@xyz                 : SIP/xyz010001&SIP/xy  State:Idle            Watchers  0
----------------
- 1 hints registered
   -- SIP/xyz010101-081f8b58 answered SIP/xyz112201-b7304288
devel*CLI> show hints
devel*CLI>
   -= Registered Asterisk Dial Plan Hints =-
            __PRS2_010@xyz                 : SIP/xyz010001&SIP/xy  State:Idle            Watchers  0
----------------
- 1 hints registered


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

All devices listed in hint are registered sip friends. State for the first 5 devices are always published fine.
I couldn't find a word about such limitation anywhere in the documentation, so I consider it a bug. Please let me know if you need any more info.
Comments:By: Leif Madsen (lmadsen) 2008-11-24 12:30:10.000-0600

Could you test this with shorter names? Perhaps it is a character limitation?

By: mdu113 (mdu113) 2008-11-24 15:14:55.000-0600

You're right it seems to be string length related. With shorter names (SIP/x1&SIP/x2...) I can watch about 9-10 devices. It looks like the string is limited to about 80 chars. I hope it's not intended to be like that.

By: Tilghman Lesher (tilghman) 2008-11-24 15:32:24.000-0600

It is intentionally coded that way and it's not likely to be something that we're going to change in 1.4.  Increasing the substitution buffer may cause stack issues.  This will, however, be fixed as of the 1.6.2 release.

By: Tilghman Lesher (tilghman) 2008-11-24 15:45:21.000-0600

You are, of course, perfectly welcome to change the size of the buffer in main/pbx.c (line 1919 or thereabouts), function ast_extension_state2, buffer "hint" to whatever size you like and recompile.  We just aren't going to put that into a release until 1.6.2.

By: mdu113 (mdu113) 2010-08-27 16:40:04

I was looking through svn log and noticed commit r263637 that is closing issue 17257. It got me interested and I have retested the issue. Since it says "Remove arbitrary size limitation for hints", I thought I'd reopen this issue, 'cause while eliminated the crash that revision didn't fully fix it (though improved).
Please let me know if you want me to open a new issue or just leave it alone.
Here's what I see now.
Devices that fit into AST_MAX_EXTENSION in hint string work perfectly with immediate reaction to state changes.
Devices that don't fit into AST_MAX_EXTENSION seems to also work. Kind of. There's a long (something like 30-60 seconds) delay between device state changes (I place a call on monitored device) and asterisk actually notices it.
Here's an example. I create a hint that monitors, let's say, 10 devices with hint string length definitely > 80 characters. If I call device listed first in the hint string (it fully fits into AST_MAX_EXTENSION characters) then asterisk notices it right away and hint state changes immediately.
Contrary, if I call device listed last in the hint strings (doesn't fit into AST_MAX_EXTENSION characters) then there will be a long delay before asterisk will notice it.
It looks like devices that appeared too far in the hints string aren't being watched by the standard mechanism, which is probably events-based, but there's some background process that rechecks all the state of all devices periodically (and not very often) and that one catches it.


By: Tilghman Lesher (tilghman) 2010-08-28 04:26:40

Please do not reopen issues which are over 2 years old.  If you're reporting an issue in a later release, open a new issue instead.