[asterisk-dev] [Code Review] Prevent 'Bad Magic Number' caused when a channel is optimized out by masquerade

Alec Davis sivad.a at paradise.net.nz
Fri Sep 17 21:39:29 CDT 2010


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

Review request for Asterisk Developers.


Summary
-------

there are 2 main fixes here.

1). Prevent a further masquerade being planned if either original/clonechan(masq/masqr) are set.
2). While the actual masquerade happens keep the channels container locked for the full duration. 

There is a comment 'that the channels container can be freed' after both channels are locked and unlink, but that not the case.


This addresses bug 16057.
    https://issues.asterisk.org/view.php?id=16057


Diffs
-----

  trunk/main/channel.c 287464 

Diff: https://reviewboard.asterisk.org/r/928/diff


Testing
-------

Using the following test plan, calling 10020 creates 20 looped Local channel calls, that then get optimized out.

[test]
exten => 10000,1,Answer()
exten => 10000,n,Playback(test-tones-follow)
exten => 10000,n,Milliwatt()

exten => _1XXXX,1,Set(i=${MATH(${EXTEN}-1,int)})
exten => _1XXXX,n,Dial(Local/${i}@test)

After patch: normal expected channels.
    asterix*CLI> core show channels
    Channel              Location             State   Application(Data)
    DAHDI/35-1           10010 at phones:2       Up      Dial(Local/10009 at phones)
    Local/10000 at phones-2 s at echo-test:4        Up      Echo()
    Local/10000 at phones-2 (None)               Up      AppDial((Outgoing Line))
    3 active channels
    2 active calls
    97 calls processed
    asterix*CLI>


prior to the patch:
   'Bad Magic Number' would reqularly been seen.

   dead channels left in container
   asterix*CLI> core show channels
   Channel              Location             State   Application(Data)
   Local/10000 at phones-2 s at echo-test:3        Up      Playback(echo-test)
   Local/10000 at phones-2 (None)               Up      AppDial((Outgoing Line))
   2 active channels
   1 active call
   21 calls processed
   asterix*CLI>


Thanks,

Alec




More information about the asterisk-dev mailing list