[asterisk-dev] [Code Review]: Transition MWI events to Stasis

opticron reviewboard at asterisk.org
Tue Mar 5 12:58:44 CST 2013



> On March 4, 2013, 3:23 p.m., Mark Michelson wrote:
> > team/dlee/stasis-core/apps/app_minivm.c, line 2018
> > <https://reviewboard.asterisk.org/r/2368/diff/2/?file=33783#file33783line2018>
> >
> >     128 is not large enough for this allocation. Use (AST_MAX_EXTENSION + AST_MAX_CONTEXT + 2). The + 2 is to allow for the '@' and the null terminator.
> >     
> >     Edit: I've seen this same allocation get used probably about 15 times throughout this review. Probably would be a good idea to #define the size of a mailbox unique ID in a stasis header file so that all allocations can just be that size.

Done.


> On March 4, 2013, 3:23 p.m., Mark Michelson wrote:
> > team/dlee/stasis-core/apps/app_voicemail.c, line 12622
> > <https://reviewboard.asterisk.org/r/2368/diff/2/?file=33784#file33784line12622>
> >
> >     Hate to be the grammar guy, but I see two things wrong with this:
> >     
> >     1) Start with a capital letter.
> >     2) "a mwi_sub_task" sounds weird to me since I would usually pronounce it "an mwi_sub_task". You can get around this by just saying "Could not allocate mwi_sub_task"
> >     
> >     That being said, we tend not to put error messages after allocation failures since ast_calloc() prints an error message already. So you can just remove this error message altogether.

Removed.


> On March 4, 2013, 3:23 p.m., Mark Michelson wrote:
> > team/dlee/stasis-core/channels/chan_dahdi.c, line 5428
> > <https://reviewboard.asterisk.org/r/2368/diff/2/?file=33785#file33785line5428>
> >
> >     You have a refleak. Need to decrease the refcount of mwi_message when you are finished with it.
> >     
> >     Edit: It looks like this is done on every call to stasis_cache_get() in this diff. You're either leaking refs on all of them, or there's something I'm missing about why you don't need to unref.

I had an internal model of how the caching works built in my head from some discussions which apparently conflicts with reality.  Fixed.


> On March 4, 2013, 3:23 p.m., Mark Michelson wrote:
> > team/dlee/stasis-core/apps/app_voicemail.c, lines 12628-12634
> > <https://reviewboard.asterisk.org/r/2368/diff/2/?file=33784#file33784line12628>
> >
> >     You've got some memory leaks here in the case that pushing the task fails. You'll need to free mwist->mailbox, mwist->context, and mwist->uniqueid.
> >     
> >     I suggest making an mwi_sub_task_free() function to call that will free the mwi_sub_task and its duplicated strings. You can call that here, handle_subscribe(), and potentially anywhere else that you would normally be freeing an mwi_sub_task.

Created a destructor and put it in the appropriate places.


> On March 4, 2013, 3:23 p.m., Mark Michelson wrote:
> > team/dlee/stasis-core/apps/app_voicemail.c, line 7742
> > <https://reviewboard.asterisk.org/r/2368/diff/2/?file=33784#file33784line7742>
> >
> >     Based on the code above, it appears as though "box" may not have an "@context" on it. It does not appear that stasis_publish_mwi_state() is prepared to handle that.

Reworked to not require the box out front and check and combine them later.


- opticron


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


On March 4, 2013, 2 p.m., opticron wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2368/
> -----------------------------------------------------------
> 
> (Updated March 4, 2013, 2 p.m.)
> 
> 
> Review request for Asterisk Developers and David Lee.
> 
> 
> Summary
> -------
> 
> This converts the usage of the existing event system in Asterisk for MWI to use Stasis as the pubsub backend.
> 
> Note: This patch requires the changes in https://reviewboard.asterisk.org/r/2367/ to compile.
> 
> 
> This addresses bug ASTERISK-21097.
>     https://issues.asterisk.org/jira/browse/ASTERISK-21097
> 
> 
> Diffs
> -----
> 
>   team/dlee/stasis-core/apps/app_minivm.c 382383 
>   team/dlee/stasis-core/apps/app_voicemail.c 382383 
>   team/dlee/stasis-core/channels/chan_dahdi.c 382383 
>   team/dlee/stasis-core/channels/chan_iax2.c 382383 
>   team/dlee/stasis-core/channels/chan_mgcp.c 382383 
>   team/dlee/stasis-core/channels/chan_sip.c 382383 
>   team/dlee/stasis-core/channels/chan_skinny.c 382383 
>   team/dlee/stasis-core/channels/chan_unistim.c 382383 
>   team/dlee/stasis-core/channels/sig_pri.h 382383 
>   team/dlee/stasis-core/channels/sig_pri.c 382383 
>   team/dlee/stasis-core/channels/sip/include/sip.h 382383 
>   team/dlee/stasis-core/include/asterisk/app.h 382383 
>   team/dlee/stasis-core/include/asterisk/xmpp.h 382383 
>   team/dlee/stasis-core/main/app.c 382383 
>   team/dlee/stasis-core/main/asterisk.c 382383 
>   team/dlee/stasis-core/res/res_jabber.c 382383 
>   team/dlee/stasis-core/res/res_xmpp.c 382383 
> 
> Diff: https://reviewboard.asterisk.org/r/2368/diff
> 
> 
> Testing
> -------
> 
> MWI distribution to SIP phones has been tested manually as has the pollmailboxes option for voicemail.
> 
> 
> Thanks,
> 
> opticron
> 
>

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


More information about the asterisk-dev mailing list