[Home]

Summary:ASTERISK-26587: app_originate: Add option to execute gosub prior to dial
Reporter:dkerr (dkerr)Labels:
Date Opened:2016-11-13 13:42:26.000-0600Date Closed:2016-12-06 05:35:30.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_originate
Versions:11.24.1 Frequency of
Occurrence
Related
Issues:
Environment:LinuxAttachments:( 0) asterisk-11-bugid26587.patch
( 1) asterisk-13-bugid26587.patch
Description:Inspired by issue ASTERISK-22992 that requested ability to add callerid into app_originate.  Comments in that issue suggested that it was better solved by adding an option to gosub prior to originating the call.

The attached patch implements this much like app_dial with two options one to gosub on the originating channel and one to gosub on the newly created channel and behaves just like app_dial.  The attached patch has been tested on Asterisk 11.24.1.  I have tested adding callerid info and also SIPAddHeader (to e.g. add header to force auto answer) and confirmed it works. Have also tested both 'exten' and 'app' versions of app_originate.

Comments:By: Asterisk Team (asteriskteam) 2016-11-13 13:42:28.408-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: dkerr (dkerr) 2016-11-13 13:47:17.651-0600

Referenced patch file for described feature.

By: Joshua C. Colp (jcolp) 2016-11-14 06:02:23.918-0600

Asterisk 11 is no longer a supported branch, it only receives security fixes. This will need to be brought up to Asterisk 13 - as well it alters the API in a way that is not binary backwards compatible. This could be problematic.

Do you plan on bringing it up to 13 and putting it up for code review or would you like help doing so?

By: dkerr (dkerr) 2016-11-14 09:22:13.912-0600

Joshua, yes understand Asterisk 11 not supported, but it is version I am currently running.  Yes I can and will provide a Asterisk 13 version of the patch.

Whether to put it up for code review... depends on whether there is interest in doing so.  I had a particular problem I wanted so solve and this was the best way to do it.  I think it could be useful to others and so contributed it here in case it is of help (I started here looking for a solution and that led me to the referenced ASTERISK-22992 which prompted me to work on this).

On backward compatibility... at dialplan, cli, manager and call files it should be fine.  But I did need to add a parameter to internal function calls as the gosub can't execute on the new channel until it is created so that dragged me deeper into the code and required mods to everywhere else that called the same functions.  Would welcome ideas on alternative approaches... as implemented it is very specific to gosub on predial -- I gave no thought to whether/how to handle any other options that can be passed into app_dial that it might be useful to pass into app_originate as well.  Other options might also need to get passed down to ast_pbx_outgoing_exten/app to handle and that would require a more flexible way of passing those parameters down.

Thanks for your comments.
David

By: Joshua C. Colp (jcolp) 2016-11-14 09:27:58.038-0600

I think people would find it useful, but the mailing lists[1] or community site[2] would be the best place to know for certain from the user base. As for adding the parameter to the internal function calls - they are actually publicly exposed functions that third party modules could use, as a result in order to maintain binary compatibility another function call would need to be added. That is what I was referring to only - not pulling additional options in from Dial.

[1] http://lists.digium.com/mailman/listinfo/asterisk-users
[2] https://community.asterisk.org/

By: dkerr (dkerr) 2016-11-14 13:00:04.570-0600

Okay I get it.... so ast_pbx_outgoing_exten/app need to remain unchanged.  I could solve this in much the same way as ast_request_and_dial() which has two versions, one prefixed with double underscores with extra parameters.  So I could do the same with the outgoing exten/app functions... create ones with double underscores and then wrap them so that third party modules would not be affected.   Thanks for pointing this out, I'll make the changes.

David

By: dkerr (dkerr) 2016-11-14 22:01:53.636-0600

Attached is updated version of the patch file that preserves binary compatibility.

By: dkerr (dkerr) 2016-11-14 22:03:39.500-0600

I've updated the patch file to maintain binary compatibility.  I am looking at Asterisk 13 and implementing this on that level will be a little different thanks to changes in how the call is originated.  I need to test the code for this before I upload a patch for Asterisk 13.

David

By: Joshua C. Colp (jcolp) 2016-11-15 05:31:56.754-0600

I'll assign this to you until you've sorted out the 13.

By: dkerr (dkerr) 2016-11-15 07:26:31.535-0600

Asterisk 13 version of the patch

By: dkerr (dkerr) 2016-11-15 07:30:38.480-0600

I have uploaded asterisk 13 version of the patch having tested the various permutations of Originate().  All are working.  Slightly different (easier?) implementation as changes between 11 and 13 had added predial capability for other functions -- app_page maybe -- that I could leverage.

David

By: Joshua C. Colp (jcolp) 2016-11-16 19:29:43.872-0600

If you would like to put this up for code review you can follow the Patch Contribution Process[1] otherwise I have put it into the queue to take it through the process.

[1] https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process

By: dkerr (dkerr) 2016-11-17 15:44:27.088-0600

Thanks Joshua.  I will go read up on the process and try and submit myself.

Thanks
David

By: Friendly Automation (friendly-automation) 2016-12-06 05:35:31.705-0600

Change 4484 merged by Joshua Colp:
app_originate: Add option to execute gosub prior to dial

[https://gerrit.asterisk.org/4484|https://gerrit.asterisk.org/4484]

By: Anthony Messina (amessina) 2017-03-30 09:25:35.320-0500

This has been resolved for a while.  Is there any chance of it being pulled into the Asterisk 14 branch or to be part of the next 14.x.x release?

By: Joshua C. Colp (jcolp) 2017-03-30 09:29:05.744-0500

[~amessina] If a test is written which covers the functionality it could be pulled in.