Commit Graph

591 Commits

Author SHA1 Message Date
Alexei Gradinari 4a567cee3a app_dial/queue/followme: 'I' options to block initial updates in both directions
The 'I' option currently blocks initial CONNECTEDLINE or REDIRECTING updates
from the called parties to the caller.

This patch also blocks updates in the other direction before call is
answered.

ASTERISK-27980

Change-Id: I6ce9e151a2220ce9e95aa66666933cfb9e2a4a01
2018-10-24 14:15:27 -05:00
Richard Mudgett 9838a5e57a app_dial/app_queue: Update application option documentation
* Update the post-answer documentation and example.  The Dial example was
incorrect and misleading for the post-answer subroutine useage.

* Fix note and warning paragraphs in option descriptions.  They don't show
up in the wiki.

Change-Id: I81019a1fd75d5b9151f76b52c38e2a90da682d14
2018-10-18 17:23:01 -05:00
Rodrigo Ramírez Norambuena 1a3115d1c5 app_dial: set the comment for OPT_ARG_ANNOUNCE to really what is done
Change-Id: I08f88adb09f7e5813f37e70fecd787468cdb32c8
2018-09-03 11:27:07 -03:00
Jenkins2 5843a19797 Merge "loader: Convert reload_classes to built-in modules." 2018-03-19 12:53:12 -05:00
Florian Floimair ecc846b26b app_dial: Enable early-media video
Certain applications (e.g. door-phone) require that also video is transmitted
before a call is accepted.

Change-Id: I9842e1dc2f6e1c2c49dc33fe615255007d2f821e
2018-03-16 17:53:20 +01:00
Corey Farrell 572a508ef2 loader: Convert reload_classes to built-in modules.
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl

These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.

Some of these modules are still initialized or shutdown from outside the
module loader.  logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).

Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
2018-03-14 05:20:12 -04:00
Sean Bright fd0ca1c3f9 Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:23:22 -05:00
Corey Farrell 955a891a84 app_macro deprecation.
* Mark the module deprecated.
* Disable the module by default.
* Produce a warning the first time a macro is used.
* Note deprecation related options in app_dial and app_queue.

ASTERISK-27350

Change-Id: I560ea043bacdbc5534a17d97854273d52c2f1bdc
2017-10-18 09:54:58 -05:00
Joshua Colp 5a7af00e80 asterisk: Audit locking of channel when manipulating flags.
When manipulating flags on a channel the channel has to be
locked to guarantee that nothing else is also manipulating
the flags. This change introduces locking where necessary to
guarantee this. It also adds helper functions that manipulate
channel flags and lock to reduce repeated code.

ASTERISK-26789

Change-Id: I489280662dba0f4c50981bfc5b5a7073fef2db10
2017-05-16 14:25:23 +00:00
Joshua Colp 2b22c3c84b channel: Add ability to request an outgoing channel with stream topology.
This change extends the ast_request functionality by adding another
function and callback to create an outgoing channel with a requested
stream topology. Fallback is provided by either converting the
requested stream topology into a format capabilities structure if
the channel driver does not support streams or by converting the
requested format capabilities into a stream topology if the channel
driver does support streams.

The Dial application has also been updated to request an outgoing
channel with the stream topology of the calling channel.

ASTERISK-26959

Change-Id: Ifa9037a672ac21d42dd7125aa09816dc879a70e6
2017-04-27 10:39:46 +00:00
Joshua Colp 5d938045d4 channel: Remove old epoll support and fixed max number of file descriptors.
This change removes the old epoll support which has not been used or
maintained in quite some time.

The fixed number of file descriptors on a channel has also been removed.
File descriptors are now contained in a growable vector. This can be
used like before by specifying a specific position to store a file
descriptor at or using a new API call, ast_channel_fd_add, which adds
a file descriptor to the channel and returns its position.

Tests have been added which cover the growing behavior of the vector
and the new API call.

ASTERISK-26885

Change-Id: I1a754b506c009b83dfdeeb08c2d2815db30ef928
2017-03-27 19:54:44 +00:00
Richard Mudgett 16fdb11bc3 core: Cleanup some channel snapshot staging anomalies.
We shouldn't unlock the channel after starting a snapshot staging because
another thread may interfere and do its own snapshot staging.

* app_dial.c:dial_exec_full() made hold the channel lock while setting up
the outgoing channel staging.  Made hold the channel lock after the called
party answers while updating the caller channel staging.

* chan_sip.c:sip_new() completed the channel staging on off-nominal exit.
Also we need to use ast_hangup() instead of ast_channel_unref() at that
location.

* channel.c:__ast_channel_alloc_ap() added a comment about not needing to
complete the channel snapshot staging on off-nominal exit paths.

* rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel
locks while staging the channels for the stats channel variables.

Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
2017-02-10 12:05:56 -06:00
Joshua Colp 4de5454ef1 app_dial: Fix incorrect device state when channel is picked up.
Given the scenario where multiple channels are dialed using Dial()
but the caller is picked up using PickupChan() all outgoing channels
except the channel specified to PickupChan() would be marked
as ringing until the call had been hung up.

When using the PickupChan application the channel executing the
application is swapped into place of another channel. As part
of this process the channel is answered. The Dial application
has explicit logic which checks if the channel is answered,
cancels all other outgoing channels, and bridges. This logic is
different than the normal logic that is executed when an outgoing
channel is answered. This different logic failed to publish dial
events stating that the other outgoing channels had been canceled.
As a result references to the outgoing channels were held onto by
the dial masquerade process until the call had been ended and
the channels had gone away. This would result in the channels
appearing in the "core show channels" list despite not being present
anymore and would also result in incorrect device state.

This change makes it so that this logic also publishes
dial events stating that the other outgoing channels have been
canceled.

ASTERISK-26549

Change-Id: Iea7168e6e82f7d4609ec0366153804e4f55ea64f
2016-11-02 09:16:41 -05:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
George Joseph 86e8716952 app_dial: Add the "Q" option to set the cause on unanswered channels
The "Q" option will set the cause on the unanswered channels when
another channel answers.  It overrides the default of
ANSWERED_ELSEWHERE.

NOTE:  chan_sip does not support setting the cause on a CANCEL to
anything other than ANSWERED_ELSEWHERE.

ASTERISK-26446 #close

Change-Id: I71742e0919aaa16784c30a2b2e73fbeed7672e47
2016-10-11 12:05:56 -05:00
zuul cc7e978149 Merge "apps/app_dial: Fix crash on non-connect call paths for Privacy/Screening option" 2016-09-07 17:23:45 -05:00
Matt Jordan 730cb3b0b7 apps/app_dial: Fix crash on non-connect call paths for Privacy/Screening option
In any scenario in which the callee is not connected to the caller, the
current code in app_dial will crash due to raising a Dial End Stasis
Message after the callee channel has been hung up. This patch corrects
the error by simply moving the explicit hangup of the callee (peer)
channel until after the dial end message.

ASTERISK-25691 #close

Change-Id: I816a414014424d0d8c80e2a3cbef13ef8c63798d
2016-09-03 16:07:36 -05:00
Matt Jordan 6e1a3b924e apps/app_dial: Set the DIALSTATUS to NOANSWER on privacy option 5
If the callee selects option '5' using the Dial application's privacy
(P) option, the DIALSTATUS is erroneously set to ANSWER. This option
reflects the callee sending the caller to VoiceMail one time; the call
is definitely *not* ANSWERed in such a scenario. With this patch, the
DIALSTATUS is instead set to NOANSWER, which is the same DIALSTATUS that
is set when the 'send to VoiceMail every time' option is set.

ASTERISK-25691

Change-Id: Iaf0c9f0fa00545e7366443875e2bb7d9a89a1358
2016-09-03 16:06:56 -05:00
Matt Jordan 9202ca34a8 app_dial: Improve documentation
* Add some helpful <literal> and other embedded paragraph tags

* Document some of the lesser known channel variables set by Dial

* Add examples for some common Dial uses, along with some more
  challenging but useful options

Change-Id: Ib2fb9301e8e044d14fbb2815ec64161f19bbfbc1
2016-08-15 07:42:44 -05:00
Joshua Colp 5c949d009e Merge "Fixes to include signal.h" 2016-06-09 04:40:24 -05:00
Timo Teräs 39b69ab537 Fixes to include signal.h
POSIX defines signal.h. sys/signal.h should not be used as it is
c-library internal header which may or may not exist. Notably with
musl it generates warning of being incorrect.

Change-Id: Ia56b0aa1d84b5c590114867b1b384a624f39a6fc
2016-06-08 20:37:08 +03:00
Alexei Gradinari 3e8d523d88 core/dial: New channel variable FORWARDERNAME
Added a new channel variable FORWARDERNAME which indicates which
channel was responsible for a forwarding requests received on dial attempt.

Fixed a bug in the app_queue: FORWARD_CONTEXT is not used.

ASTERISK-26059 #close

Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2
2016-06-04 11:07:22 -05:00
Mark Michelson 205a31f86c Expand the scope of Dial Events
Dial events up to this point have come in two flavors
* A Dial event with no status to indicate that dialing has begun
* A Dial event with a status to indicate that dialing has ended

With this change, Dial events have been expanded to also give
intermediate events, such as "RINGING", "PROCEEDING", and "PROGRESS".
This is especially useful for ARI dialing, as it gives the application
writer the opportunity to place a channel into an early bridge when
early media is detected.

AMI handles these in-progress dial events by sending a new event called
"DialState" that simply indicates that dial state has changed but has
not ended. ARI never distinguished between DialBegin and DialEnd, so no
change was made to the event itself.

Another change here relates to dial forwards. A forward-related event
was previously only sent when a channel was successfully able to forward
a call to a new channel. With this set of changes, if forwarding is
blocked, we send a Dial event with a forwarding destination but no
forwarding channel, since we were prevented from creating one. This is
again useful for ARI since application writers can now handle call
forward attempts from within their own application.

ASTERISK-25925 #close
Reported by Mark Michelson

Change-Id: I42cbec7730d84640a434d143a0d172a740995543
2016-05-31 11:43:24 -05:00
Richard Mudgett f88b952093 app_dial: Immediately exit dial if the caller is already hung up.
If a caller hangs up before dial is executed within an AGI then the AGI
has likely eaten all queued frames before executing the dial in DeadAGI
mode.  With the caller hung up and no pending frames from the caller's
read queue, dial would not know that the call has hung up until a called
channel answers.  It is rather annoying to whoever just answered the
non-existent call.

Dial should not continue execution in DeadAGI mode, hangup handlers, or
the h exten.

* Added a check early in dial to abort dialing if the caller has hungup.

ASTERISK-25307 #close
Reported by: David Cunningham

Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418
2016-01-04 13:34:13 -06:00
Walter Doekes 39daf9f066 docs: Fix a few typo's in app docs (more then, resourse).
Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7
2015-11-06 16:46:31 -05:00
Matt Jordan e0d8b6a65d Merge "app_dial.c: Make 'A' option pass COLP updates." 2015-09-29 07:27:02 -05:00
Matt Jordan 360d076dfc Merge "app_dial.c: Force COLP update if outgoing channel name changed." 2015-09-29 07:26:20 -05:00
Joshua Colp afabf9da7f Merge "app_dial.c: Factor out a connected line update routine." 2015-09-28 14:07:05 -05:00
Richard Mudgett 1d394774b2 app_dial.c: Make 'A' option pass COLP updates.
While the 'A' option is playing the announcement file allow the caller and
peer to exchange COLP update frames.

ASTERISK-25423
Reported by: John Hardin

Change-Id: Iac6cf89b56d26452c6bb88e9363622bbf23895f9
2015-09-25 12:40:31 -05:00
Richard Mudgett 680b76eb25 app_dial.c: Force COLP update if outgoing channel name changed.
* When a call is answered and the outgoing channel name has changed then
force a connected line update because the channel is no longer the same.
The channel was masqueraded into by another channel.  This is usually
because of a call pickup.

Note: Forwarded calls are handled in a controlled manner so the original
channel name is replaced with the forwarded channel.

ASTERISK-25423
Reported by: John Hardin

Change-Id: I2e01f7a698fbbc8c26344a59c2be40c6cd98b00c
2015-09-25 12:40:31 -05:00
Richard Mudgett fdf0bcb04a app_dial.c: Factor out a connected line update routine.
Replace inlined code with update_connected_line_from_peer().

ASTERISK-25423
Reported by: John Hardin

Change-Id: Ia14f18def417645cd7fb453e1bdac682630a5091
2015-09-25 12:40:31 -05:00
Richard Mudgett c285879845 app_dial.c: Remove some no-op code.
Change-Id: Ice1884a94315d3cb7e3bbd47a9fba76a27276c54
2015-09-25 11:31:03 -05:00
Joshua Colp 3b2b004d69 app_dial: Hold reference to calling channel formats when dialing outbound.
Currently when requesting a channel the native formats of the
calling channel are provided to the core for usage when dialing
the outbound channel. This occurs without holding the channel lock
or keeping a reference to the formats. This is problematic as
the channel driver may end up changing the formats during this time.
In the case of chan_sip this happens when an SDP negotiation
completes.

This change makes it so app_dial keeps a reference to the native
formats of the calling channel which guarantees that they will
remain valid for the period of time needed.

ASTERISK-25172 #close

Change-Id: I2f0a67bd0d5d14c3bdbaae552b4b1613a283f0db
2015-06-24 13:51:02 -05:00
Mark Michelson aae45acbda Detect potential forwarding loops based on count.
A potential problem that can arise is the following:

* Bob's phone is programmed to automatically forward to Carol.
* Carol's phone is programmed to automatically forward to Bob.
* Alice calls Bob.

If left unchecked, this results in an endless loops of call forwards
that would eventually result in some sort of fiery crash.

Asterisk's method of solving this issue was to track which interfaces
had been dialed. If a destination were dialed a second time, then
the attempt to call that destination would fail since a loop was
detected.

The problem with this method is that call forwarding has evolved. Some
SIP phones allow for a user to manually forward an incoming call to an
ad-hoc destination. This can mean that:

* There are legitimate use cases where a device may be dialed multiple
times, or
* There can be human error when forwarding calls.

This change removes the old method of detecting forwarding loops in
favor of keeping a count of the number of destinations a channel has
dialed on a particular branch of a call. If the number exceeds the
set number of max forwards, then the call fails. This approach has
the following advantages over the old:

* It is much simpler.
* It can detect loops involving local channels.
* It is user configurable.

The only disadvantage it has is that in the case where there is a
legitimate forwarding loop present, it takes longer to detect it.
However, the forwarding loop is still properly detected and the
call is cleaned up as it should be.

Address review feedback on gerrit.

* Correct "mfgium" to "Digium"
* Decrement max forwards by one in the case where allocation of the
  max forwards datastore is required.
* Remove irrelevant code change from pjsip_global_headers.c

ASTERISK-24958 #close

Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
2015-04-17 15:58:07 -05:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
Matthew Jordan 4740ef50f4 apps/app_dial: Don't publish DialEnd twice on unexpected GoSub/Macro values
The Dial application has some interesting options with the mid-call Macro (M)
and GoSub (U) options. If the MACRO_RESULT/GOSUB_RESULT returns specific
values, the Dial application will take some action upon the channels involved
in the dial operation (such as hanging up a particular party, etc.) The Dial
application ensures that a Stasis message is published in the event that
MACRO_RESULT/GOSUB_RESULT returns a value that kills the dial operation, so
that there is a corresponding DialEnd event published in AMI/ARI for the
DialBegin event that preceeded it.

A bug exists where that same DialEnd event will be published on Stasis even if
the value returned in MACRO_RESULT/GOSUB_RESULT is not one that the Dial
application cares about. This causes two DialEnd events to be published - one
with the MACRO_RESULT/GOSUB_RESULT and another with "ANSWERED" - which is all
sorts of wrong.

This patch fixes the bug by ensuring that we only publish a DialEnd message to
Stasis if the Dial application's mid-call Macro/GoSub returns something that
Dial cares about.

Review: https://reviewboard.asterisk.org/r/4336

ASTERISK-24682 #close
Reported by: Matt Jordan
........

Merged revisions 430842 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-21 13:12:04 +00:00
Matthew Jordan ba5d5da60b Improve call forwarding reporting, especially with regards to ARI.
This patch addresses a few issues:

1) The order of Dial events have been changed when performing a call forward.
   The order has now been altered to
    1) Dial begins dialing channel A.
    2) When A forwards the call to B, we issue the dial end event to channel
       A, indicating the dial is being canceled due to a forward to B.
    3) When the call to channel B occurs, we then issue a new dial begin to
       channel B.

2) Call forwards are now reported on the calling channel, not the peer channel.

3) AMI DialEnd events have been altered to display the extension the call is
   being forwarded to when relevant.

4) You can now get the values of channel variables for channels that are not
   currently in the Stasis application. This brings the retrieval of channel
   variables more in line with the rest of channel read operations since they
   may be performed on channels not in Stasis.

ASTERISK-24134 #close
Reported by Matt Jordan

ASTERISK-24138 #close
Reported by Matt Jordan

Patches:
	forward-shenanigans.diff uploaded by Matt Jordan (License #6283)

Review: https://reviewboard.asterisk.org/r/3899
........

Merged revisions 420794 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-18 00:57:01 +00:00
Matthew Jordan 44fc6ea6ff apps/app_dial: Fix Dial 'z' option
The 'z' option is supposed to disable the dial timeout in the case of a call
forward. Unfortunately, the wrong timeout timer was passed to the do_forward
function, resulting in the option not working.

ASTERISK-24225 #close
Reported by: dimitripietro
Tested by: dimitripietro
patches:
  jira_asterisk_24225_v1.8.patch uploaded by rmudgett (License 5621)
  jira_asterisk_24225_v11.patch uploaded by rmudgett (License 5621)
........

Merged revisions 421232 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 421233 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 421234 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 421235 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-17 23:10:21 +00:00
Richard Mudgett a2ce95d9d2 accountcode: Slightly change accountcode propagation.
The previous behavior was to simply set the accountcode of an outgoing
channel to the accountcode of the channel initiating the call.  It was
done this way a long time ago to allow the accountcode set on the SIP/100
channel to be propagated to a local channel so the dialplan execution on
the Local;2 channel would have the SIP/100 accountcode available.

SIP/100 -> Local;1/Local;2 -> SIP/200

Propagating the SIP/100 accountcode to the local channels is very useful.
Without any dialplan manipulation, all channels in this call would have
the same accountcode.

Using dialplan, you can set a different accountcode on the SIP/200 channel
either by setting the accountcode on the Local;2 channel or by the Dial
application's b(pre-dial), M(macro) or U(gosub) options, or by the
FollowMe application's b(pre-dial) option, or by the Queue application's
macro or gosub options.  Before Asterisk v12, the altered accountcode on
SIP/200 will remain until the local channels optimize out and the
accountcode would change to the SIP/100 accountcode.

Asterisk v1.8 attempted to add peeraccount support but ultimately had to
punt on the support.  The peeraccount support was rendered useless because
of how the CDR code needed to unconditionally force the caller's
accountcode onto the peer channel's accountcode.  The CEL events were thus
intentionally made to always use the channel's accountcode as the
peeraccount value.

With the arrival of Asterisk v12, the situation has improved somewhat so
peeraccount support can be made to work.  Using the indicated example, the
the accountcode values become as follows when the peeraccount is set on
SIP/100 before calling SIP/200:

SIP/100 ---> Local;1 ---- Local;2 ---> SIP/200
acct: 100 \/ acct: 200 \/ acct: 100 \/ acct: 200
peer: 200 /\ peer: 100 /\ peer: 200 /\ peer: 100

If a channel already has an accountcode it can only change by the
following explicit user actions:

1) A channel originate method that can specify an accountcode to use.

2) The calling channel propagating its non-empty peeraccount or its
non-empty accountcode if the peeraccount was empty to the outgoing
channel's accountcode before initiating the dial.  e.g., Dial and
FollowMe.  The exception to this propagation method is Queue.  Queue will
only propagate peeraccounts this way only if the outgoing channel does not
have an accountcode.

3) Dialplan using CHANNEL(accountcode).

4) Dialplan using CHANNEL(peeraccount) on the other end of a local
channel pair.

If a channel does not have an accountcode it can get one from the
following places:

1) The channel driver's configuration at channel creation.

2) Explicit user action as already indicated.

3) Entering a basic or stasis-mixing bridge from a peer channel's
peeraccount value.

You can specify the accountcode for an outgoing channel by setting the
CHANNEL(peeraccount) before using the Dial, FollowMe, and Queue
applications.  Queue adds the wrinkle that it will not overwrite an
existing accountcode on the outgoing channel with the calling channels
values.

Accountcode and peeraccount values propagate to an outgoing channel before
dialing.  Accountcodes also propagate when channels enter or leave a basic
or stasis-mixing bridge.  The peeraccount value only makes sense for
mixing bridges with two channels; it is meaningless otherwise.

* Made peeraccount functional by changing accountcode propagation as
described above.

* Fixed CEL extracting the wrong ie value for the peeraccount.  This was
done intentionally in Asterisk v1.8 when that version had to punt on
peeraccount.

* Fixed a few places dealing with accountcodes that were reading from
channels without the lock held.

AFS-65 #close

Review: https://reviewboard.asterisk.org/r/3601/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-24 22:48:38 +00:00
Kinsey Moore abd3e4040b Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........

Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 22:49:26 +00:00
Richard Mudgett cbe7f65674 app_dial and app_queue: Make lock the forwarding channel while taking the channel snapshot.
* Fixed ast_channel_publish_dial_forward() not locking the forwarded
channel when taking the channel snapshot.

* Fixed app_dial.c:do_forward() using the wrong channel to get the
original call forwarding string.

* Removed unnecessary locking when calling ast_channel_publish_dial() and
ast_channel_publish_dial_forward() in app_dial and app_queue.  Holding
channel locks when calling ast_channel_publish_dial_forward() with a
forwarded channel could result in pausing the system while the stasis bus
completes processsing a forwarded channel subscription.

Review: https://reviewboard.asterisk.org/r/3451/
........

Merged revisions 412579 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-18 16:27:31 +00:00
Scott Griepentrog 80ef9a21b9 uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it.  Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation.  This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first.  In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.

Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.

(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........

Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
Matthew Jordan 66c46fba24 CDRs: fix a variety of dial status problems, h/hangup handler creating CDRs
This patch fixes a number of small-ish problems that were noticed when
witnessing the records that the FreePBX dialplan produces:
(1) Mid-call events (as well as privacy options) have the ability to change the
    overall state of the Dial operation after the called party answers. This
    means that publishing the DialEnd event when the called party is premature;
    we have to wait for the execution of these subroutines to complete before
    we can signal the overall status of the DialEnd. This patch moves that
    publication and adds handlers for the mid-call events.
(2) The AST_FLAG_OUTGOING channel flag is cleared if an after bridge goto
    datastore is detected. This flag was preventing CDRs from being recorded
    for all outbound channels that had a 'continue' option enabled on them by
    the Dial application.
(3) The CDR engine now locks the 'Dial' application as being the CDR
    application if it detects that the current CDR has entered that app. This
    is similar to the logic that is done for Parking. In general, if we entered
    into Dial, then we want that CDR to record the application as such - this
    prevents pre-dial handlers, mid-call handlers, and other shenaniganry
    from changing the application value.
(4) The CDR engine now checks for the AST_SOFTHANGUP_HANGUP_EXEC in more places
    to determine if the channel is in hangup logic or dead. In either case, we
    don't want to record changes in the channel.
(5) The default option for "endbeforehexten" has been changed to "yes". In
    general, you don't want to see CDRs in the 'h' exten or in hangup logic.
    Since the semantics of that option changed in 12, it made sense to update
    the default value as well.
(6) Finally, because we now have the ability to synchronize on the messages
    published to the CDR topic, on shutdown the CDR engine will now synchronize
    to the messages currently in flight. This helps to ensure that all
    in-flight CDRs are written before shutting down.

(closes issue ASTERISK-23164)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3154
........

Merged revisions 407084 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 23:40:51 +00:00
Matthew Jordan f922912731 app_dial: Allow macro/gosub pre-bridge execution to occur on priorities
The parsing for the destination of the macro/gosub uses the '^' character to
separate out context, extension, and priority. However, the logic for the
macro/gosub execution was written such that it would only do the actual
macro/gosub jump if a '^' character existed. This doesn't apply when the
macro/gosub jump occurs in a priority/priority label. This patch changes
the logic so that the parsing still occurs, but the jump will occur even
for priorities/priority labels.

(issue ASTERISK-23164)

Review: https://reviewboard.asterisk.org/r/3154
........

Merged revisions 407041 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 407074 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 407082 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407083 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 23:34:47 +00:00
Kevin Harwell 28c0cb28d0 channel locking: Add locking for channel snapshot creation
Original commit message by mmichelson (asterisk 12 r403311):

"This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such."

The above was initially committed and then reverted at r403398.  The problem
was found to be in core_local.c in the publish_local_bridge_message function.
The ast_unreal_lock_all function locks and adds a reference to the returned
channels and while they were being unlocked they were not being unreffed when
no longer needed.  Fixed by unreffing the channels.

Also in bridge.c a lock was obtained on "other->chan", but then an attempt was
made to unlock "other" and not the previously locked channel.  Fixed by
unlocking "other->chan"

(closes issue ASTERISK-22709)
Reported by: John Bigelow
........

Merged revisions 404237 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-18 20:33:37 +00:00
Joshua Colp 3a5cc054ed res_stasis: Expose event for call forwarding and follow forwarded channel.
This change adds an event for when an originated call is redirected to
another target. This event contains the original channel and the newly
created channel. If a stasis subscription exists on the original originated
channel for a stasis application then a new subscription will also be
created on the stasis application to the redirected channel. This allows
the application to follow the call path completely.

(closes issue ASTERISK-22719)
Reported by: Joshua Colp

Review: https://reviewboard.asterisk.org/r/3054/
........

Merged revisions 403808 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-14 17:19:41 +00:00
David M. Lee 1212906351 Reverting r403311. It's causing ARI tests to hang.
........

Merged revisions 403398 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-05 22:10:20 +00:00
Mark Michelson 8e8b329e14 Add channel locking for channel snapshot creation.
This adds channel locks around calls to create channel snapshots as well
as other functions which operate on a channel and then end up
creating a channel snapshot. Functions that expect the channel to be
locked prior to being called have had their documentation updated to
indicate such.
........

Merged revisions 403311 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-03 17:07:29 +00:00
Joshua Colp 701847af22 Add an 'R' option to Dial which sends ringing until early media has been received.
(closes issue ASTERISK-10487)
Reported by: Gaspar Zoltan
Patches:
	10487.patch uploaded by n8ideas (license 6075)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401411 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-22 15:17:56 +00:00
Richard Mudgett 057d105c5a Add channel lock protection around translation path setup.
Most callers of ast_channel_make_compatible() happen before the channels
enter a two party bridge.  With the new bridging framework, two party
bridging technologies may also call ast_channel_make_compatible() when
there is more than one thread involved with the two channels.

* Added channel lock protection in set_format() and
ast_channel_make_compatible_helper() when dealing with the channel's
native formats while setting up a translation path.

* Fixed best_src_fmt and best_dst_fmt usage consistency in
ast_channel_make_compatible_helper().  The call to
ast_translator_best_choice() got them backwards.

* Updated some callers of ast_channel_make_compatible() and the function
documentation.  There is actually a difference between the two channels
passed in.

* Fixed the deadlock potential in res_fax.c dealing with
ast_channel_make_compatible().  The deadlock potential was already there
anyway because res_fax called ast_channel_make_compatible() with chan
locked.

(closes issue ASTERISK-22542)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/2915/
........

Merged revisions 401239 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-18 16:59:09 +00:00