[asterisk-dev] [Code Review] Transition MWI events to Stasis
Mark Michelson
reviewboard at asterisk.org
Mon Mar 4 15:23:53 CST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2368/#review7986
-----------------------------------------------------------
team/dlee/stasis-core/apps/app_minivm.c
<https://reviewboard.asterisk.org/r/2368/#comment15184>
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.
team/dlee/stasis-core/apps/app_voicemail.c
<https://reviewboard.asterisk.org/r/2368/#comment15188>
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.
team/dlee/stasis-core/apps/app_voicemail.c
<https://reviewboard.asterisk.org/r/2368/#comment15190>
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.
team/dlee/stasis-core/apps/app_voicemail.c
<https://reviewboard.asterisk.org/r/2368/#comment15193>
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.
team/dlee/stasis-core/channels/chan_dahdi.c
<https://reviewboard.asterisk.org/r/2368/#comment15207>
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.
- Mark
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/20130304/02ba023c/attachment.htm>
More information about the asterisk-dev
mailing list