summaryrefslogtreecommitdiff
path: root/main/pbx.c
AgeCommit message (Collapse)Author
2016-08-29pbx.c: Prevent infinite recursion in manager_show_dialplan_helper.Etienne Lessard
Previously, if context A was including context B and context B was including context A, i.e. if there was a circular dependency between contexts, then calling manager_show_dialplan_helper could lead to an infinite recursion, resulting in a crash. This commit applies the same solution as the one implemented in the show_dialplan_helper function. The manager_show_dialplan_helper and show_dialplan_helper functions contain lots of code in common, but the former was missing the "infinite recursion avoidance" code. ASTERISK-26226 #close Change-Id: I1aea85133c21787226f4f8442253a93000aa0897
2016-08-15pbx.c: Additional fixes to ast_context_remove_extension_callerid2.Corey Farrell
Do not check registrar of the first extension head. We should only check the registrar when we match the priority. Additionally fix a couple calls to strcmp which used the input callerid instead of the clean version ex.cidmatch. ASTERISK-26233 Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1
2016-08-01Merge "pbx.c: Fix handling of '-' in extension name and callerid" into 13zuul
2016-07-28pbx.c: Fix handling of '-' in extension name and calleridCorey Farrell
This adds a two strings to ast_exten. name to go with exten and cidmatch_display to go with cidmatch. The new fields contain input used to add the extension in the first place. The existing fields now contain stripped input that excludes insignificant spaces and dashes. These stripped fields should always be used for comparisons. The unstripped fields should normally be used for display, but displaying stripped values will not cause runtime errors. Note the actual string is only stored twice if it contains dashes. If no dashes are found then both 'char *' fields point to the same memory. So this change has a minimum effect on memory usage. The existing functions ast_get_extension_name and ast_get_extension_cidmatch return unstripped values as they did before this change. Other similar bugs likely still exist where unstripped extensions are saved outside pbx.c then passed back in. ASTERISK-26233 #close Change-Id: I6cd61ce57acc1570ca6cc14960c4c3b0a9eb837f
2016-07-28pbx.c: Allow dangerous functions when adding a hint to dialplan.Richard Mudgett
We can allow dangerous functions when adding a hint since altering dialplan is itself a privileged activity. Otherwise, we could never execute dangerous functions. ASTERISK-25996 #close Reported by: Andrew Nagy Change-Id: I4929ff100ad1200a0198262d069a34f2296e77ba
2016-07-14pbx: Fix leak of timezone for time based includes.Corey Farrell
Create include_free to run ast_destroy_timing and ast_free, use that in all places that freed an ast_include structure. This fixes a couple of paths that previously did not run ast_destroy_timing. ASTERISK-26196 #close Change-Id: I1671bd111bef0dc113e8bf8f77f89fcfc395d838
2016-04-08Merge "pbx.c: Minor code rearangements." into 13zuul
2016-04-07pbx.c: Minor code rearangements.Richard Mudgett
* Pull out a loop invariant. * Convert an else-if ladder to a switch statement. Change-Id: I0a95cfa9474a4600b9865f7b444534d275b37e95
2016-04-07pbx: Update doxygen for extension state watchers.Richard Mudgett
Change-Id: Id1403b12136de62a272c01bb355aef65fd2c2d1e
2016-01-11pbx: Deadlock between contexts container and context_merge locksKevin Harwell
Recent changes (ASTERISK-25394 commit 2bd27d12223fe33b58c453965ed5c6ed3af7c4f5) introduced the possibility of a deadlock. Due to the mentioned modifications ast_change_hints now needs to keep both merge/delete and state callbacks from occurring while it executes. Unfortunately, sometimes ast_change_hints can be called with the contexts container locked. When this happens it's possible for another thread to grab the context_merge_lock before the thread calling into ast_change_hints does and then try to obtain the contexts container lock. This of course causes a deadlock between the two threads. The thread calling into ast_change_hints waits for the other thread to release context_merge_lock and the other thread is waiting on that one to release the contexts container lock. Unfortunately, there is not a great way to fix this problem. When hints change, the subsequent state callbacks cannot run at the same time as a merge/delete, nor when the usual state callbacks do. This patch alleviates the problem by having those particular callbacks (the ones run after a hint change) occur in a serialized task. By moving the context_merge_lock to a task it can now safely be attempted or held without a deadlock occurring. ASTERISK-25640 #close Reported by: Krzysztof Trempala Change-Id: If2210ea241afd1585dc2594c16faff84579bf302
2016-01-05main/pbx: Move hangup handler routines to pbx_hangup_handler.c.Corey Farrell
This is the sixth patch in a series meant to reduce the bulk of pbx.c. This moves hangup handler management functions to their own source. Change-Id: Ib25a75aa57fc7d5c4294479e5cc46775912fb104
2016-01-05main/pbx: Move dialplan application management routines to pbx_app.c.Corey Farrell
This is the sixth patch in a series meant to reduce the bulk of pbx.c. This moves dialplan application management functions to their own source. Change-Id: I444c10fb90a3cdf9f3047605d6a8aad49c22c44c
2016-01-05main/pbx: Move switch routines to pbx_switch.c.Corey Farrell
This is the fifth patch in a series meant to reduce the bulk of pbx.c. This moves ast_switch functions to their own source. Change-Id: Ic2592a18a5c4d8a3c2dcf9786c9a6f650a8c628e
2016-01-05main/pbx: Move timing routines to pbx_timing.c.Corey Farrell
This is the fourth patch in a series meant to reduce the bulk of pbx.c. This moves pbx timing functions to their own source. Change-Id: I05c45186cb11edfc901e95f6be4e6a8abf129cd6
2016-01-04main/pbx: Move variable routines to pbx_variables.c.Corey Farrell
This is the third patch in a series meant to reduce the bulk of pbx.c. This moves channel and global variable routines to their own source. Change-Id: Ibe8fb4647db11598591d443a99e3f99200a56bc6
2016-01-01main/pbx: Move custom function routines to pbx_functions.c.Corey Farrell
This is the second patch in a series meant to reduce the bulk of pbx.c. This moves custom function management routines to their own source. Change-Id: I34a6190282f781cdbbd3ce9d3adeac3c3805e177
2015-12-30main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.cGeorge Joseph
We joked about splitting pbx.c into multiple files but this first step was fairly easy. All of the pbx_builtin dialplan applications have been moved into pbx_builtins.c and a new pbx_private.h file was added. load_pbx_builtins() is called by asterisk.c just after load_pbx(). A few functions were renamed and are cross-exposed between the 2 source files. Change-Id: I87066be3dbf7f5822942ac1449d98cc43fc7561a
2015-09-19pbx: Update device and presence state when changing a hint extension.Joshua Colp
When changing a hint extension without removing the hint first the device state and presence state is not updated. This causes the state of the hint to be that of the previous extension and not the current one. This state is kept until a state change occurs as a result of something (presence state change, device state change). This change updates the hint with the current device and presence state of the new extension when it is changed. Any state callbacks which may have been added before the hint extension is changed are also informed of the new device and presence state if either have changed. ASTERISK-25394 #close Change-Id: If268f1110290e502c73dd289c9e7e7b27bc8432f
2015-09-02pbx: Fix crash when issuing "core show hints" with long pattern match.Joshua Colp
When issuing the "core show hints" CLI command a combination of both the hint extension and context is created. This uses a fixed size buffer expecting that the extension will not exceed maximum extension length. When the extension is actually a pattern match this constraint does not hold true, and the extension may exceed the maximum extension length. In this case extra characters are written past the end of the fixed size buffer. This change makes it so the construction of the combined hint extension and context can not exceed the size of the buffer. ASTERISK-25367 #close Change-Id: Idfa1b95d0d4dc38e675be7c1de8900b3f981f499
2015-08-31Fix deadlock on presence state changes.Mark Michelson
A deadlock was observed where three threads were competing for different locks: * One thread held the hints lock and was attempting to lock a specific hint. * One thread was holding the specific hint's lock and was attempting to lock the contexts lock * One thread was holding the contexts lock and attempting to lock the hints lock. Clearly the second thread was doing the wrong thing here. The fix for this is to make sure that the hint's lock is not held on presence state changes. Something similar is already done (and commented about) for device state changes. ASTERISK-25362 #close Reported by Mark Michelson Change-Id: I15ec2416b92978a4c0c08273b2d46cb21aff97e2
2015-07-17pbx.c: Post AMI VarSet event if delete a non-empty dialplan variable.Richard Mudgett
ASTERISK-25256 #close Reported by: Richard Mudgett Change-Id: I0b6be720b66fa956f6a798cd22ef8934eb0c0ff3
2015-06-26main/pbx: Resolve case sensitivity regression in PBX hintsMatt Jordan
When 8297136f was merged for ASTERISK-25040, a regression was introduced surrounding the case sensitivity of device names within hints. Previously, device names - such as 'sip/foo' - were compared in a case insensitive fashion. Thus, 'sip/foo' was equivalent to 'SIP/foo'. After that patch, only the case sensitive name would match, i.e., 'SIP/foo'. As a result, some dialplan hints stopped working. This patch re-introduces case insensitive matching for device names in hints. ASTERISK-25040 ASTERISK-25202 #close Change-Id: If5046a7d14097e1e3c12b63092b9584bb1e9cb4c (cherry picked from commit 96bbcf495a1da9e607d9b04a44b5c4f49e83cc03)
2015-06-08Fix unsafe uses of ast_context pointers.Corey Farrell
Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
2015-05-01main/pbx: Improve performance of dialplan reloads with a large number of hintsMatt Jordan
The PBX core maintains two hash tables for hints: a container of the actual hints (hints), along with a container of devices that are watching that hint (hintdevices). When a dialplan reload occurs, each hint in the hints container is destroyed; this requires a lookup in the container of devices to find the device => hint mapping object. In the current code, this performs an ao2_callback, iterating over each of the device to hint objects in the hintdevices container. For a large number of hints, this is extremely expensive: dialplan reloads with 20000 hints could take several minutes in just this phase. This patch improves the performance of this step in the dialplan reloads by caching which devices are watching a hint on the hint object itself. Since we don't want to create a circular reference, we just cache the name of the device. This allows us to perform a smarter ao2_callback on the hintdevices container during hint removal, hashing on the name of the device and returning an iterator to the matching names. The overall performance improvement is rather large, taking this step down to a number of seconds as opposed to minutes. In addition, this patch also registers the hint containers in the PBX core with the astobj2 library. This allows for reasonable debugging to hash collisions in those containers. ASTERISK-25040 #close Reported by: Matt Jordan Change-Id: Iedfc97a69d21070c50fca42275d7b3e714e59360
2015-04-19main/pbx: Don't attempt to destroy a previously destroyed exten/priority tupleMatt Jordan
When a PBX registrar is unloaded, it will fail to remove its extension from the context root_table if a dialplan application used by that extension is still loaded. This can be the case for AGI, which can be unloaded after several of the standard PBX providers. Often, this is harmless; however, if the extension's priorities are removed during the failed unloading *and* the dialplan application later unregisters, it leaves a ticking timebomb for the next PBX provider that attempts to iterate over the extensions. When that occurs, the peer_table pointer on the extension will already be set to NULL. The current code does not check to see if the pointer is NULL before passing it to a hashtab function this is not NULL tolerant. Since it is possible for the peer_table to be NULL when we normally would not expect that to be the case, the solution in this patch is to simply skip over processing an extension's priorities if peer_table is NULL. Prior to this patch, the tests/pbx/callerid_match test would crash during module unload. With this patch, the test no longer crashes after running. ASTERISK-24774 #close Reported by: Corey Farrell Change-Id: I2bbeecb7e0f77bac303a1b9135e4cdb4db6d4c40
2015-03-26Replace most uses of ast_register_atexit with ast_register_cleanup.Corey Farrell
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-30Fix some memory leaks.Mark Michelson
These memory leaks were found and fixed by John Hardin. I'm just committing them for him. ASTERISK-24736 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/4389 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431468 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-19Call extension state callbacks at hint creation.Mark Michelson
When a hint gets created, any subsequent device or presence state changes result in extension status events getting sent out to interested parties. However, at the time of hint creation, no such event gets sent out, so watchers of extension state are potentially left in the dark until the first state change after hint creation. Patch contributed by John Hardin (License #6512) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430776 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Make AMI actions that generate event lists consistent.Richard Mudgett
* Made the following AMI actions use list API calls for consistency: Agents BridgeInfo BridgeList BridgeTechnologyList ConfbridgeLIst ConfbridgeLIstRooms CoreShowChannels DAHDIShowChannels DBGet DeviceStateList ExtensionStateList FAXSessions Hangup IAXpeerlist IAXpeers IAXregistry MeetmeList MeetmeListRooms MWIGet ParkedCalls Parkinglots PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PresenceStateList PRIShowSpans QueueStatus QueueSummary ShowDialPlan SIPpeers SIPpeerstatus SIPshowregistry SKINNYdevices SKINNYlines Status VoicemailUsersList * Incremented the AMI version to 2.7.0. * Changed astman_send_listack() to not use the listflag parameter and always set the value to "Start" so the start capitalization is consistent. i.e., The FAXSessions used "Start" while the rest of the system used "start". The corresponding complete event always used "Complete". * Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the AMI ActionID for all of its list events. * Fixed off-nominal AMI protocol error in manager_bridge_info(), manager_parking_status_single_lot(), and manager_parking_status_all_lots(). Use of astman_send_error() after responding to the original AMI action request violates the action response pattern by sending two responses. * Fixed minor protocol error in action_getconfig() when no requested categories are found. Each line needs to be formatted as "Header: text". * Fixed off-nominal memory leak in manager_build_parked_call_string(). * Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail(). ASTERISK-24049 #close Reported by: Jonathan Rose Review: https://reviewboard.asterisk.org/r/4315/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-12pbx: Fix off-nominal case where a freed extension may still be used.Joshua Colp
If during the operation of adding an extension a priority is added but fails it is possible for the extension to be freed but still exist in the PBX core. If this occurs subsequent lookups may try to access the extension and end up in freed memory. This change removes the extension from the PBX core when the priority addition fails and then frees the extension. ASTERISK-24444 #close Reported by: Leandro Dardini Review: https://reviewboard.asterisk.org/r/4162/ ........ Merged revisions 427709 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 427710 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@427711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-13Bridges: Fix feature interruption/unintended kick caused by external actionsJonathan Rose
If a manager or CLI user attached a mixmonitor to a call running a dynamic bridge feature while in a bridge, the feature would be interrupted and the channel would be forcibly kicked out of the bridge (usually ending the call during a simple 1 to 1 call). This would also occur during any similar action that could set the unbridge soft hangup flag, so the fix for this was to remove unbridge from the soft hangup flags and make it a separate thing all together. ASTERISK-24027 #close Reported by: mjordan Review: https://reviewboard.asterisk.org/r/3900/ ........ Merged revisions 420934 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07pbx: Filter out pattern matching hints in responses sent to ExtensionStateListMatthew Jordan
Hints that are a pattern match are technically stored in the hint container in the same fashion as concrete implementations of hints. The pattern matching hints, however, are not "real" in the sense that things can subscribe to them: rather, they are stored in the hints container so that when a subscription is made a "real" hint can be generated for the subscription if one does not yet exist. The extension state core takes care of this correctly by matching against non-pattern matching extensions prior to pattern matching extensions. Because of this, however, the ExtensionStateList AMI action was returning pattern matching hints when executed. These hints are meaningless from the perspective of AMI clients: their state will never change, they cannot be subscribed to, and events would never normally be generated from them. As such, we now filter these out of the response. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06pbx_lua: fix regression with global sym export and context clash by pbx_config.George Joseph
ASTERISK-23818 (lua contexts being overwritten by contexts of the same name in pbx_config) surfaced because pbx_lua, having the AST_MODFLAG_GLOBAL_SYMBOLS set, was always force loaded before pbx_config. Since I couldn't find any reason for pbx_lua to export it's symbols to the rest of Asterisk, I simply changed the flag to AST_MODFLAG_DEFAULT. Problem solved. What I didn't realize was that the symbols need to be exported not because Asterisk needs them but because any external Lua modules like luasql.mysql need the base Lua language APIs exported (ASTERISK-17279). Back to ASTERISK-23818... It looks like there's an issue in pbx.c where context_merge was only merging includes, switches and ignore patterns if the context was already existing AND has extensions, or if the context was brand new. If pbx_lua is loaded before pbx_config, the context will exist BUT pbx_lua, being implemented as a switch, will never place extensions in it, just the switch statement. The result is that when pbx_config loads, it never merges the switch statement created by pbx_lua into the final context. This patch sets pbx_lua's modflag back to AST_MODFLAG_GLOBAL_SYMBOLS and adds an "else if" in context_merge that catches the case where an existing context has includes, switchs or ingore patterns but no actual extensions. ASTERISK-23818 #close Reported by: Dennis Guse Reported by: Timo Teräs Tested by: George Joseph Review: https://reviewboard.asterisk.org/r/3891/ ........ Merged revisions 420146 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 420147 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 420148 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-30manager: Add state list commandsKinsey Moore
This patch adds three new AMI commands: * ExtensionStateList (pbx.c) - list all known extension state hints and their current statuses. Events emitted by the list action are equivalent to the ExtensionStatus events. * PresenceStateList (res_manager_presencestate) - list all known presence state values. Events emitted are generated by the stasis message type, and hence are PresenceStateChange events. * DeviceStateList (res_manager_devicestate) - list all known device state values. Events emitted are generated by the stasis message type, and hence are DeviceStateChange events. Patch-by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3799/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-24accountcode: Slightly change accountcode propagation.Richard Mudgett
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-04Remove many deprecated modulesMatthew Jordan
Billing records are fair, To get paid is quite bright, You should really use ODBC; Good-bye cdr_sqlite. Microsoft did once push H.323, Hell, we all remember NetMeeting. But try to compile chan_h323 now And you will take quite a beating. The XMPP and SIP war was fierce, And in the distant fray Was birthed res_jabber/chan_jingle; But neither to stay. For everyone did care and chase what Google professed. "Free Internet Calling" was what devotees cried, But Google did change the specs so often That the developers were happy the day chan_gtalk died. And then there was that odd application Dedicated to the Polish tongue. app_saycountpl was subsumed by Say; One could say its bell was rung. To read and parse a file from the dialplan You could (I guess) use an application. app_readfile did fill that purpose, but I think A function is perhaps better in its creation. Barging is rude, I'm not sure why we do it. Inwardly, the caller will probably sigh. But if you really must do it, Don't use app_dahdibarge, use ChanSpy. We all despise the sound of tinny robots It makes our queues so cold. To control such an abomination It's better to not use Wait/SetMusicOnHold. It's often nice to know properties of a channel It makes our calls right We have a nice function called CHANNEL And so SIPCHANINFO is sent off into the night. And now things get odd; Apparently one could delimit with a colon Properties from the SIPPEER function! Commas are in; all others are done. Finally, a word on pipes and commas. We're sorry. We can't say it enough. But those compatibility options in asterisk.conf; To maintain them forever was just too tough. This patch removes: * cdr_sqlite * chan_gtalk * chan_jingle * chan_h323 * res_jabber * app_saycountpl * app_readfile * app_dahdibarge It removes the following applications/functions: * WaitMusicOnHold * SetMusicOnHold * SIPCHANINFO It removes the colon delimiter from the SIPPEER function. Finally, it also removes all compatibility options that were configurable from asterisk.conf, as these all applied to compatibility with Asterisk 1.4 systems. Review: https://reviewboard.asterisk.org/r/3698/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03pbx_config: Add manager actions to add/remove extensionsJonathan Rose
Adds two new manager commands to pbx_config - DialplanExtensionAdd and DialplanExtensionRemove which allow manager users to create and delete extensions respectively. Review: https://reviewboard.asterisk.org/r/3650/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13stasis: Reduce creation of channel snapshots to improve performanceMatthew Jordan
During some performance testing of Asterisk with AGI, ARI, and lots of Local channels, we noticed that there's quite a hit in performance during channel creation and releasing to the dialplan (ARI continue). After investigating the performance spike that occurs during channel creation, we discovered that we create a lot of channel snapshots that are technically unnecessary. This includes creating snapshots during: * AGI execution * Returning objects for ARI commands * During some Local channel operations * During some dialling operations * During variable setting * During some bridging operations And more. This patch does the following: - It removes a number of fields from channel snapshots. These fields were rarely used, were expensive to have on the snapshot, and hurt performance. This included formats, translation paths, Log Call ID, callgroup, pickup group, and all channel variables. As a result, AMI Status, "core show channel", "core show channelvar", and "pjsip show channel" were modified to either hit the live channel or not show certain pieces of data. While this is unfortunate, the performance gain from this patch is worth the loss in behaviour. - It adds a mechanism to publish a cached snapshot + blob. A large number of publications were changed to use this, including: - During Dial begin - During Variable assignment (if no AMI variables are emitted - if AMI variables are set, we have to make snapshots when a variable is changed) - During channel pickup - When a channel is put on hold/unhold - When a DTMF digit is begun/ended - When creating a bridge snapshot - When an AOC event is raised - During Local channel optimization/Local bridging - When endpoint snapshots are generated - All AGI events - All ARI responses that return a channel - Events in the AgentPool, MeetMe, and some in Queue - Additionally, some extraneous channel snapshots were being made that were unnecessary. These were removed. - The result of ast_hashtab_hash_string is now cached in stasis_cache. This reduces a large number of calls to ast_hashtab_hash_string, which reduced the amount of time spent in this function in gprof by around 50%. #ASTERISK-23811 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3568/ ........ Merged revisions 416211 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12main/pbx - documentation - enhance 'core show hints' and 'core show hint' ↵Rusty Newton
help text Adds descriptive help text to 'core show hints' and 'core show hint'. The text describes the various columns for the sake of clarity. It takes into account recent changes to the content displayed by the commands https://reviewboard.asterisk.org/r/3604/ and https://reviewboard.asterisk.org/r/3611/. ASTERISK-23764 Review: https://reviewboard.asterisk.org/r/3610/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-11CLI: correct presence information on core show hintsScott Griepentrog
Adds presence to core show hint and changes presence string conversion to use the correct function. ASTERISK-23858 #close Review: https://reviewboard.asterisk.org/r/3611/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415715 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-10CLI: add presence information to core show hintsScott Griepentrog
Adds presence state value to output of core show hints. Also reformats the output slightly so it doesn't use as much space as it would otherwise. Was: 1000@demo : SIP/1000 State:Unavailable Watchers 0 Now: 1000@demo : SIP/1000 State:Unavailable Presence:Idle Watchers 0 AFS-53 #close Review: https://reviewboard.asterisk.org/r/3604/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-08bridges/bridge_native_rtp: Reconfigure bridge on removal of framehookMatthew Jordan
This patch is a re-do of r414122. When r414122 was merged, a major problem with it was uncovered. UNBRIDGE soft hangup flags have a catastrophic effect on the pbx core if they leak out from the bridge layer: the channel gets hung up. With the number of threads involved in a blind transfer, and with the initial patch, it was likely that this would occur. This caused a large number of test failures This patch is nearly identical with the one proposed in r414122, save for the following changes: - We explicitly clear the UNBRIDGE flag when setting an after goto on a channel in a bridge - Defensively, if we encounter an UNBRIDGE flag in the pbx core, we handle it https://reviewboard.asterisk.org/r/3585/ ........ Merged revisions 415443 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-29PBX: Prevent incorrect hint parsingKinsey Moore
Dynamic and pattern matching hints should not be checked for their last known state until they are instantiated by subscribers. (closes issue AFS-56) Reported by: John Hardin Patch AFS-56-pbx.diff submitted by Matt Jordan (license 6283) ........ Merged revisions 414813 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 414859 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 414860 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messagesMatthew Jordan
This patch addresses some aesthetic issues in Asterisk. These are all just minor tweaks to improve the look of the CLI when used in a variety of settings. Specifically: * A number of chatty verbose messages were removed or demoted to DEBUG messages. Verbose messages with a verbosity level of 5 or higher were - if kept as verbose messages - demoted to level 4. Several messages that were emitted at verbose level 3 were demoted to 4, as announcement of dialplan applications being executed occur at level 3 (and so the effects of those applications should generally be less). * Some verbose messages that only appear when their respective 'debug' options are enabled were bumped up to always be displayed. * Prefix/timestamping of verbose messages were moved to the verboser handlers. This was done to prevent duplication of prefixes when the timestamp option (-T) is used with the CLI. * Verbose magic is removed from messages before being emitted to non-verboser handlers. This prevents the magic in multi-line verbose messages (such as SIP debug traces or the output of DumpChan) from being written to files. * _Slightly_ better support for the "light background" option (-W) was added. This includes using ast_term_quit in the output of XML documentation help, as well as changing the "Asterisk Ready" prompt to bright green on the default background (which stands a better chance of being displayed properly than bright white). Review: https://reviewboard.asterisk.org/r/3547/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
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-04-18Originated calls: Fix several originate call problems.Richard Mudgett
* Restore the reason value set by pbx_outgoing_attempt() to use AST_CONTROL_xxx values as all the consumers were expecting rather than cause codes. * Fixed the dial routines to set cause codes for more than just ast_request() so pbx_outgoing_attempt() reason codes will function. * Fix inconsistent locked_channel return status in pbx_outgoing_attempt(). The chanel may not have been locked or the channel may have been a stale pointer. * Fixed the OutgoingSpoolFailed channel to run dialplan whenever the dialing fails for an originate exten and 1 < synchronous. * Fix incorrect ast_cond_wait() usage in pbx_outgoing_attempt(). Indroduced by issue ASTERISK-22212 patch. * Made struct pbx_outgoing use the ao2 lock instead of its own lock for the cond wait mutex. No sense in having two locks associated with the same struct when only one is needed. Review: https://reviewboard.asterisk.org/r/3421/ ........ Merged revisions 412581 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-15Remove unused RAII_VAR() declarations.Richard Mudgett
* Remove unused RAII_VAR() declarations. The compiler cannot catch these because the cleanup function "references" the unused variable. Some actually allocated and released resources that were never used. * Fixed some whitespace issues in stasis_bridges.c. ........ Merged revisions 412399 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07uniqueid: channel linkedid, ami, ari object creation with id'sScott Griepentrog
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-02-22Remove extra defines of AST_PBX_MAX_STACK.Corey Farrell
* Ensure AST_PBX_MAX_STACK is only defined in extconf.h and pbx.h. * Fix incorrect function parameters in utils/extconf.c. (closes issue ASTERISK-23141) Reported by: Maxim Review: https://reviewboard.asterisk.org/r/3241/ ........ Merged revisions 408785 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 408786 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 408787 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-16pbx: Handle a completely empty dialplan during a context mergeMatthew Jordan
It is highly unlikely, but - at least in Asterisk 12 - theoretically possible to load Asterisk with no dialplan whatsoever. If that occurs, and some other module (that is not a pbx module) attempts to merge its contexts into the dialplan, the existing merge routine will crash. This is because it is not insane, and rightly believes that you provided some sort of dialplan, somewhere. This patch will gracefully merge the contexts in such a case. Note that this is highly unlikely to occur in 1.8/11, as features will most likely provide some dialplan via parking. However, in Asterisk 12, parking is now provided by res_parking, and hence may create its dialplan later. (closes issue ASTERISK-23297) Reported by: CJ Oster Review: https://reviewboard.asterisk.org/r/3222 ........ Merged revisions 408200 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 408201 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 408220 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408227 65c4cc65-6c06-0410-ace0-fbb531ad65f3