[asterisk-dev] [Code Review]: Correct the number of available call numbers in IAX2

rmudgett reviewboard at asterisk.org
Mon Jan 28 13:35:04 CST 2013



> On Jan. 28, 2013, 12:39 p.m., rmudgett wrote:
> > Systems compiled with LOW_MEMORY have similar problems with the 2048 callno value.  The way TRUNK_CALL_START is used in a bit test does not work on the 2048 callno value because the tested bit is not set.
> > 
> > The only reason I can find that IAX_MAX_CALLS needs to be a power of 2 is when defining TRUNK_CALL_START and the use of it in a bit test in make_trunk().  Changing make_trunk() to use a compare operator instead of a bit test should remove all requirements that IAX_MAX_CALLS be a power of two.  It should be recommended that IAX_MAX_CALLS be a power of two for ease of distinguishing normal/trunk calls in IAX traces but not required.
> > 
> > TRUNK_CALL_START should also have insulating parentheses around the definition to avoid unexpected operator precedence issues.
> >
> 
> Sean Bright wrote:
>     > Systems compiled with LOW_MEMORY have similar problems with the 2048 callno value.  The way TRUNK_CALL_START
>     > is used in a bit test does not work on the 2048 callno value because the tested bit is not set.
>     
>     If LOW_MEMORY is defined, IAX_MAX_CALLS will be 2048, TRUNK_CALL_START will be 1024 (0x400).  So other than the parentheses, is any other change needed?

2048 is 0x800.  0x800 & 0x400 is 0.  Callno 2048 is considered a trunk callno by the other code using TRUNK_CALL_START.  The bitwise comparison is therefore wrong in make_trunk().

Fixing the bitwise test in make_trunk() also means the comment at the IAX_MAX_CALLS definition needs to be changed to recommend that the value be a power of 2 but not require it.

This patch is removing 2048 as a valid callno when LOW_MEMORY is defined.  This is a behavior change from previous versions that should be mentioned in UPGRADE.txt.  Of course if the LOW_MEMORY value is changed to 2049 then there is no behavior change because callno 2048 remains available.  The 2048 callno will even be functional.


- rmudgett


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2293/#review7754
-----------------------------------------------------------


On Jan. 28, 2013, 1:01 p.m., Sean Bright wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2293/
> -----------------------------------------------------------
> 
> (Updated Jan. 28, 2013, 1:01 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> While populating the list of available call numbers in IAX2 when LOW_MEMORY is not defined, we use every number between 2 and 32768 (inclusive).  32768 is a 16 bit number (a 1 followed by 15 0s).  According to the IAX2 RFC, call numbers are 15 bit values, making 32768 invalid.
> 
> This patch reduces the number of allocated call numbers by 1 so that the are all 15 bits.
> 
> I intend to commit this change to Asterisk versions 1.8, 11, and trunk.
> 
> I have another patch to replace the ao2_container usage for call number selection almost ready for RB as well.
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_iax2.c 380249 
> 
> Diff: https://reviewboard.asterisk.org/r/2293/diff
> 
> 
> Testing
> -------
> 
> Ran thousands of test calls (both trunked and non-trunked) between 3 Asterisk servers.
> 
> 
> Thanks,
> 
> Sean
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130128/a5d903cf/attachment-0001.htm>


More information about the asterisk-dev mailing list