[asterisk-dev] [Code Review] Remove the need for AST_PBX_KEEPALIVE when using GoSub from Dial

Joshua Colp jcolp at digium.com
Thu Dec 18 13:25:32 CST 2008


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/98/#review248
-----------------------------------------------------------



/trunk/apps/app_dial.c
<http://reviewboard.digium.com/r/98/#comment501>

    Since you are no longer adding the extension in you shouldn't need the context any longer either. You also need to remove the code that finds and deletes/destroys the extension and context from the unload_module callback.


- Joshua


On 2008-12-18 10:00:27, Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/98/
> -----------------------------------------------------------
> 
> (Updated 2008-12-18 10:00:27)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> I'm on a mission to have AST_PBX_KEEPALIVE and related return codes completely removed from the tree.  It is currently being used in a couple of different ways.
> 
> 1) It is used when another thread assumes ownership of a channel from within a dialplan application (such as Parking).  The return code tells the caller that the channel that was passed in is no longer valid and must not be dereferenced.  In my opinion, this is evil and error prone.  By using Masquerading, we can avoid having to deal with these magic "please don't touch this object anymore" return codes.  Murf has a patch which removes all usage of this style in review 29.
> 
> 2) The Dial() option to run GoSub() also used this return code.  This was because the code needs to run a PBX for GoSub to work, but it also wants to continue doing stuff with the channel after it finishes.  So, it used a final result of KEEPALIVE to achieve this.  However, since we know up front that this is what we want, we can provide it as an option to ast_pbx_run().
> 
> This patch updates the ast_pbx API to include an option that can be supplied to ast_pbx_run() to tell the PBX not to free the channel at the end.  It also removes the KeepAlive application, as it is no longer needed.  Finally, it updates app_dial to use this new method for handling GoSub from Dial.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_dial.c 165504 
>   /trunk/include/asterisk/pbx.h 165504 
>   /trunk/main/pbx.c 165504 
> 
> Diff: http://reviewboard.digium.com/r/98/diff
> 
> 
> Testing
> -------
> 
> I called 5004 and it worked as expected.
> 
> [silly-playback]
> 
> exten => s,1,Playback(tt-weasels)
> exten => s,n,Return()
> 
> [default]
> 
> exten => 5004,1,Dial(SIP/5004,,U(silly-playback))
> 
> 
> Thanks,
> 
> Russell
> 
>




More information about the asterisk-dev mailing list