[asterisk-commits] kmoore: branch kmoore/cel_backend_refactor r396487 - in /team/kmoore/cel_back...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 9 08:25:16 CDT 2013
Author: kmoore
Date: Fri Aug 9 08:25:10 2013
New Revision: 396487
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396487
Log:
Bring up to trunk
Added:
team/kmoore/cel_backend_refactor/res/parking/parking_tests.c
- copied unchanged from r396486, team/kmoore/event_system_strip/res/parking/parking_tests.c
team/kmoore/cel_backend_refactor/rest-api-templates/param_cleanup.mustache
- copied unchanged from r396486, team/kmoore/event_system_strip/rest-api-templates/param_cleanup.mustache
Modified:
team/kmoore/cel_backend_refactor/ (props changed)
team/kmoore/cel_backend_refactor/UPGRADE-11.txt
team/kmoore/cel_backend_refactor/apps/app_chanspy.c
team/kmoore/cel_backend_refactor/apps/app_meetme.c
team/kmoore/cel_backend_refactor/apps/app_minivm.c
team/kmoore/cel_backend_refactor/apps/app_playback.c
team/kmoore/cel_backend_refactor/apps/app_queue.c
team/kmoore/cel_backend_refactor/apps/app_stack.c
team/kmoore/cel_backend_refactor/apps/app_voicemail.c
team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_announce.c
team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_record.c
team/kmoore/cel_backend_refactor/apps/confbridge/confbridge_manager.c
team/kmoore/cel_backend_refactor/bridges/bridge_holding.c
team/kmoore/cel_backend_refactor/channels/chan_bridge_media.c
team/kmoore/cel_backend_refactor/channels/chan_dahdi.c
team/kmoore/cel_backend_refactor/channels/chan_iax2.c
team/kmoore/cel_backend_refactor/channels/chan_mgcp.c
team/kmoore/cel_backend_refactor/channels/chan_misdn.c
team/kmoore/cel_backend_refactor/channels/chan_oss.c
team/kmoore/cel_backend_refactor/channels/chan_sip.c
team/kmoore/cel_backend_refactor/channels/chan_skinny.c
team/kmoore/cel_backend_refactor/channels/chan_unistim.c
team/kmoore/cel_backend_refactor/channels/sig_pri.c
team/kmoore/cel_backend_refactor/formats/format_wav_gsm.c
team/kmoore/cel_backend_refactor/funcs/func_channel.c
team/kmoore/cel_backend_refactor/funcs/func_frame_trace.c
team/kmoore/cel_backend_refactor/funcs/func_global.c
team/kmoore/cel_backend_refactor/funcs/func_strings.c
team/kmoore/cel_backend_refactor/include/asterisk/app.h
team/kmoore/cel_backend_refactor/include/asterisk/astobj2.h
team/kmoore/cel_backend_refactor/include/asterisk/bridge_basic.h
team/kmoore/cel_backend_refactor/include/asterisk/bridge_features.h
team/kmoore/cel_backend_refactor/include/asterisk/bridge_roles.h
team/kmoore/cel_backend_refactor/include/asterisk/channel.h
team/kmoore/cel_backend_refactor/include/asterisk/frame.h
team/kmoore/cel_backend_refactor/include/asterisk/json.h
team/kmoore/cel_backend_refactor/include/asterisk/manager.h
team/kmoore/cel_backend_refactor/include/asterisk/options.h
team/kmoore/cel_backend_refactor/include/asterisk/parking.h
team/kmoore/cel_backend_refactor/include/asterisk/pickup.h
team/kmoore/cel_backend_refactor/include/asterisk/stasis.h
team/kmoore/cel_backend_refactor/include/asterisk/stasis_app.h
team/kmoore/cel_backend_refactor/include/asterisk/stasis_app_recording.h
team/kmoore/cel_backend_refactor/include/asterisk/stasis_bridges.h
team/kmoore/cel_backend_refactor/include/asterisk/strings.h
team/kmoore/cel_backend_refactor/main/app.c
team/kmoore/cel_backend_refactor/main/asterisk.c
team/kmoore/cel_backend_refactor/main/astobj2.c
team/kmoore/cel_backend_refactor/main/bridge.c
team/kmoore/cel_backend_refactor/main/bridge_basic.c
team/kmoore/cel_backend_refactor/main/bridge_channel.c
team/kmoore/cel_backend_refactor/main/bridge_roles.c
team/kmoore/cel_backend_refactor/main/cdr.c
team/kmoore/cel_backend_refactor/main/cel.c
team/kmoore/cel_backend_refactor/main/channel.c
team/kmoore/cel_backend_refactor/main/channel_internal_api.c
team/kmoore/cel_backend_refactor/main/cli.c
team/kmoore/cel_backend_refactor/main/features.c
team/kmoore/cel_backend_refactor/main/json.c
team/kmoore/cel_backend_refactor/main/manager.c
team/kmoore/cel_backend_refactor/main/manager_bridges.c
team/kmoore/cel_backend_refactor/main/manager_channels.c
team/kmoore/cel_backend_refactor/main/pbx.c
team/kmoore/cel_backend_refactor/main/pickup.c
team/kmoore/cel_backend_refactor/main/rtp_engine.c
team/kmoore/cel_backend_refactor/main/stasis_bridges.c
team/kmoore/cel_backend_refactor/main/stasis_cache.c
team/kmoore/cel_backend_refactor/main/stasis_cache_pattern.c
team/kmoore/cel_backend_refactor/main/strings.c
team/kmoore/cel_backend_refactor/main/utils.c
team/kmoore/cel_backend_refactor/pbx/pbx_dundi.c
team/kmoore/cel_backend_refactor/pbx/pbx_loopback.c
team/kmoore/cel_backend_refactor/res/ari/ari_model_validators.c
team/kmoore/cel_backend_refactor/res/ari/ari_model_validators.h
team/kmoore/cel_backend_refactor/res/ari/ari_websockets.c
team/kmoore/cel_backend_refactor/res/ari/resource_asterisk.c
team/kmoore/cel_backend_refactor/res/ari/resource_asterisk.h
team/kmoore/cel_backend_refactor/res/ari/resource_bridges.c
team/kmoore/cel_backend_refactor/res/ari/resource_bridges.h
team/kmoore/cel_backend_refactor/res/ari/resource_events.c
team/kmoore/cel_backend_refactor/res/ari/resource_events.h
team/kmoore/cel_backend_refactor/res/ari/resource_recordings.c
team/kmoore/cel_backend_refactor/res/ari/resource_recordings.h
team/kmoore/cel_backend_refactor/res/ari/resource_sounds.h
team/kmoore/cel_backend_refactor/res/parking/parking_bridge.c
team/kmoore/cel_backend_refactor/res/parking/parking_manager.c
team/kmoore/cel_backend_refactor/res/parking/res_parking.h
team/kmoore/cel_backend_refactor/res/res_ari_asterisk.c
team/kmoore/cel_backend_refactor/res/res_ari_bridges.c
team/kmoore/cel_backend_refactor/res/res_ari_channels.c
team/kmoore/cel_backend_refactor/res/res_ari_endpoints.c
team/kmoore/cel_backend_refactor/res/res_ari_events.c
team/kmoore/cel_backend_refactor/res/res_ari_playback.c
team/kmoore/cel_backend_refactor/res/res_ari_recordings.c
team/kmoore/cel_backend_refactor/res/res_ari_sounds.c
team/kmoore/cel_backend_refactor/res/res_parking.c
team/kmoore/cel_backend_refactor/res/res_pjsip.c
team/kmoore/cel_backend_refactor/res/res_pjsip/config_system.c
team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h
team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c
team/kmoore/cel_backend_refactor/res/res_pjsip_exten_state.c
team/kmoore/cel_backend_refactor/res/res_pjsip_messaging.c
team/kmoore/cel_backend_refactor/res/res_pjsip_notify.c
team/kmoore/cel_backend_refactor/res/res_pjsip_outbound_registration.c
team/kmoore/cel_backend_refactor/res/res_sorcery_astdb.c
team/kmoore/cel_backend_refactor/res/res_stasis_recording.c
team/kmoore/cel_backend_refactor/res/snmp/agent.c
team/kmoore/cel_backend_refactor/res/stasis/control.c
team/kmoore/cel_backend_refactor/rest-api-templates/ari_resource.h.mustache
team/kmoore/cel_backend_refactor/rest-api-templates/param_parsing.mustache
team/kmoore/cel_backend_refactor/rest-api-templates/res_ari_resource.c.mustache
team/kmoore/cel_backend_refactor/rest-api/api-docs/asterisk.json
team/kmoore/cel_backend_refactor/rest-api/api-docs/bridges.json
team/kmoore/cel_backend_refactor/rest-api/api-docs/channels.json
team/kmoore/cel_backend_refactor/rest-api/api-docs/events.json
team/kmoore/cel_backend_refactor/rest-api/api-docs/recordings.json
team/kmoore/cel_backend_refactor/rest-api/api-docs/sounds.json
team/kmoore/cel_backend_refactor/tests/test_json.c
team/kmoore/cel_backend_refactor/tests/test_stasis.c
team/kmoore/cel_backend_refactor/utils/Makefile
team/kmoore/cel_backend_refactor/utils/extconf.c
team/kmoore/cel_backend_refactor/utils/refcounter.c
Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Fri Aug 9 08:25:10 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702,385356,395020
+/branches/11:373240,375247,375702,385356,395020,396441
Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- cel_integrated (original)
+++ cel_integrated Fri Aug 9 08:25:10 2013
@@ -1,1 +1,1 @@
-/team/kmoore/event_system_strip:1-396085
+/team/kmoore/event_system_strip:1-396486
Modified: team/kmoore/cel_backend_refactor/UPGRADE-11.txt
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/UPGRADE-11.txt?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/UPGRADE-11.txt (original)
+++ team/kmoore/cel_backend_refactor/UPGRADE-11.txt Fri Aug 9 08:25:10 2013
@@ -19,6 +19,11 @@
=== UPGRADE-10.txt -- Upgrade info for 1.8 to 10
===
===========================================================
+From 11.5 to 11.6:
+* res_agi will now properly indicate if there was an error in streaming an
+ audio file. The result code will be -1 and the result returned from the
+ the function will be RESULT_FAILURE instead of the prior behavior of always
+ returning RESULT_SUCCESS even if there was an error.
From 11.4 to 11.5:
* The default settings for chan_sip are now overriden properly by the general
Modified: team/kmoore/cel_backend_refactor/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_chanspy.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_chanspy.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_chanspy.c Fri Aug 9 08:25:10 2013
@@ -637,12 +637,14 @@
}
if (ast_test_flag(flags, OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
+ RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(spyee_autochan->chan), ast_channel_cleanup);
+
/* And this hook lets us inject audio into the channel that the spied on
channel is currently bridged with.
*/
ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy", 0);
- if ((spyee_bridge_autochan = ast_autochan_setup(ast_bridged_channel(spyee_autochan->chan)))) {
+ if ((spyee_bridge_autochan = ast_autochan_setup(bridged))) {
ast_channel_lock(spyee_bridge_autochan->chan);
if (start_spying(spyee_bridge_autochan, spyer_name, &csth.bridge_whisper_audiohook)) {
ast_log(LOG_WARNING, "Unable to attach barge audiohook on spyee %s. Barge mode disabled!\n", name);
@@ -935,7 +937,7 @@
break;
}
- if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(autochan->chan)) {
+ if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_channel_is_bridged(autochan->chan)) {
continue;
}
Modified: team/kmoore/cel_backend_refactor/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_meetme.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_meetme.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_meetme.c Fri Aug 9 08:25:10 2013
@@ -1167,7 +1167,7 @@
STASIS_MESSAGE_TYPE_INIT(meetme_talk_request_type);
meetme_event_message_router = stasis_message_router_create(
- ast_channel_cache());
+ ast_channel_topic_all_cached());
if (!meetme_event_message_router) {
meetme_stasis_cleanup();
Modified: team/kmoore/cel_backend_refactor/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_minivm.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_minivm.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_minivm.c Fri Aug 9 08:25:10 2013
@@ -1674,7 +1674,7 @@
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
if (ast_test_flag(vmu, MVM_OPERATOR))
canceldtmf = "0";
- cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, global_silencethreshold, global_maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
+ cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, sound_duration, 0, global_silencethreshold, global_maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
if (cmd == -1) /* User has hung up, no options to give */
Modified: team/kmoore/cel_backend_refactor/apps/app_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_playback.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_playback.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_playback.c Fri Aug 9 08:25:10 2013
@@ -220,6 +220,10 @@
s = x + 1;
ast_debug(2, "value is <%s>\n", s);
n = ast_var_assign("SAY", s);
+ if (!n) {
+ ast_log(LOG_ERROR, "Memory allocation error in do_say\n");
+ return -1;
+ }
AST_LIST_INSERT_HEAD(&head, n, entries);
/* scan the body, one piece at a time */
Modified: team/kmoore/cel_backend_refactor/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_queue.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_queue.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_queue.c Fri Aug 9 08:25:10 2013
@@ -4583,10 +4583,10 @@
case AST_CONTROL_BUSY:
ast_verb(3, "%s is busy\n", ochan_name);
ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
- do_hang(o);
endtime = (long) time(NULL);
endtime -= starttime;
rna(endtime * 1000, qe, o->chan, on, membername, qe->parent->autopausebusy);
+ do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart) {
start_time_tv = ast_tvnow();
Modified: team/kmoore/cel_backend_refactor/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_stack.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_stack.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_stack.c Fri Aug 9 08:25:10 2013
@@ -273,8 +273,9 @@
}
if (!found) {
- variables = ast_var_assign(var, "");
- AST_LIST_INSERT_HEAD(&frame->varshead, variables, entries);
+ if ((variables = ast_var_assign(var, ""))) {
+ AST_LIST_INSERT_HEAD(&frame->varshead, variables, entries);
+ }
pbx_builtin_pushvar_helper(chan, var, value);
} else {
pbx_builtin_setvar_helper(chan, var, value);
Modified: team/kmoore/cel_backend_refactor/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/app_voicemail.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/app_voicemail.c (original)
+++ team/kmoore/cel_backend_refactor/apps/app_voicemail.c Fri Aug 9 08:25:10 2013
@@ -14681,7 +14681,7 @@
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
if (ast_test_flag(vmu, VM_OPERATOR))
canceldtmf = "0";
- cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, sound_duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
+ cmd = ast_play_and_record_full(chan, playfile, tempfile, maxtime, fmt, duration, sound_duration, 0, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf, 0, AST_RECORD_IF_EXISTS_OVERWRITE);
if (strchr(canceldtmf, cmd)) {
/* need this flag here to distinguish between pressing '0' during message recording or after */
canceleddtmf = 1;
Modified: team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_announce.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_announce.c (original)
+++ team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_announce.c Fri Aug 9 08:25:10 2013
@@ -134,7 +134,7 @@
.send_text = ast_unreal_sendtext,
.queryoption = ast_unreal_queryoption,
.setoption = ast_unreal_setoption,
- .properties = AST_CHAN_TP_ANNOUNCER,
+ .properties = AST_CHAN_TP_INTERNAL,
};
struct ast_channel_tech *conf_announce_get_tech(void)
Modified: team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_record.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_record.c (original)
+++ team/kmoore/cel_backend_refactor/apps/confbridge/conf_chan_record.c Fri Aug 9 08:25:10 2013
@@ -86,7 +86,7 @@
.call = rec_call,
.read = rec_read,
.write = rec_write,
- .properties = AST_CHAN_TP_RECORDER,
+ .properties = AST_CHAN_TP_INTERNAL,
};
struct ast_channel_tech *conf_record_get_tech(void)
Modified: team/kmoore/cel_backend_refactor/apps/confbridge/confbridge_manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/apps/confbridge/confbridge_manager.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/apps/confbridge/confbridge_manager.c (original)
+++ team/kmoore/cel_backend_refactor/apps/confbridge/confbridge_manager.c Fri Aug 9 08:25:10 2013
@@ -200,7 +200,7 @@
ast_assert(blob != NULL);
ast_assert(event != NULL);
- bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+ bridge_text = ast_manager_build_bridge_state_string(blob->bridge);
if (!bridge_text) {
return;
}
Modified: team/kmoore/cel_backend_refactor/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/bridges/bridge_holding.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/bridges/bridge_holding.c (original)
+++ team/kmoore/cel_backend_refactor/bridges/bridge_holding.c Fri Aug 9 08:25:10 2013
@@ -81,7 +81,7 @@
ast_moh_stop(bridge_channel->chan);
break;
case IDLE_MODE_RINGING:
- ast_indicate(bridge_channel->chan, -1);
+ ast_bridge_channel_queue_control_data(bridge_channel, -1, NULL, 0);
break;
case IDLE_MODE_NONE:
break;
@@ -124,7 +124,7 @@
ast_moh_start(bridge_channel->chan, ast_strlen_zero(moh_class) ? NULL : moh_class, NULL);
break;
case IDLE_MODE_RINGING:
- ast_indicate(bridge_channel->chan, AST_CONTROL_RINGING);
+ ast_bridge_channel_queue_control_data(bridge_channel, AST_CONTROL_RINGING, NULL, 0);
break;
case IDLE_MODE_NONE:
break;
@@ -302,6 +302,44 @@
return 0;
}
+static void holding_bridge_suspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ struct holding_channel *hc = bridge_channel ? bridge_channel->tech_pvt : NULL;
+
+ if (!hc) {
+ return;
+ }
+
+ if (!ast_test_flag(&hc->holding_roles, HOLDING_ROLE_PARTICIPANT)) {
+ return;
+ }
+
+ participant_stop_hold_audio(bridge_channel);
+}
+
+static void holding_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+ struct holding_channel *hc = bridge_channel ? bridge_channel->tech_pvt : NULL;
+ struct ast_bridge_channel *announcer_channel = bridge->tech_pvt;
+
+ if (!hc) {
+ return;
+ }
+
+ /* If the bridge channel being unsuspended is not a participant, no need to do anything. */
+ if (!ast_test_flag(&hc->holding_roles, HOLDING_ROLE_PARTICIPANT)) {
+ return;
+ }
+
+ /* If there is currently an announcer channel in the bridge, there is also no need to do anything. */
+ if (announcer_channel) {
+ return;
+ }
+
+ /* Otherwise we need to resume the entertainment. */
+ participant_start_hold_audio(bridge_channel);
+}
+
static struct ast_bridge_technology holding_bridge = {
.name = "holding_bridge",
.capabilities = AST_BRIDGE_CAPABILITY_HOLDING,
@@ -309,6 +347,8 @@
.write = holding_bridge_write,
.join = holding_bridge_join,
.leave = holding_bridge_leave,
+ .suspend = holding_bridge_suspend,
+ .unsuspend = holding_bridge_unsuspend,
};
static int unload_module(void)
Modified: team/kmoore/cel_backend_refactor/channels/chan_bridge_media.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_bridge_media.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_bridge_media.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_bridge_media.c Fri Aug 9 08:25:10 2013
@@ -89,7 +89,7 @@
.send_text = ast_unreal_sendtext,
.queryoption = ast_unreal_queryoption,
.setoption = ast_unreal_setoption,
- .properties = AST_CHAN_TP_ANNOUNCER,
+ .properties = AST_CHAN_TP_INTERNAL,
};
static struct ast_channel_tech record_tech = {
@@ -111,7 +111,7 @@
.send_text = ast_unreal_sendtext,
.queryoption = ast_unreal_queryoption,
.setoption = ast_unreal_setoption,
- .properties = AST_CHAN_TP_RECORDER,
+ .properties = AST_CHAN_TP_INTERNAL,
};
static struct ast_channel *media_request_helper(struct ast_format_cap *cap,
Modified: team/kmoore/cel_backend_refactor/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_dahdi.c?view=diff&rev=396487&r1=396486&r2=396487
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_dahdi.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_dahdi.c Fri Aug 9 08:25:10 2013
@@ -460,6 +460,8 @@
static int num_cadence = 4;
static int user_has_defined_cadences = 0;
+static int has_pseudo;
+
static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX] = {
{ { 125, 125, 2000, 4000 } }, /*!< Quick chirp followed by normal ring */
{ { 250, 250, 500, 1000, 250, 250, 500, 4000 } }, /*!< British style ring */
@@ -816,6 +818,18 @@
* \note Set from the "smdiport" string read in from chan_dahdi.conf
*/
char smdi_port[SMDI_MAX_FILENAME_LEN];
+
+ /*!
+ * \brief Don't create channels below this number
+ * \note by default is 0 (no limit)
+ */
+ int wanted_channels_start;
+
+ /*!
+ * \brief Don't create channels above this number (infinity by default)
+ * \note by default is 0 (special value that means "no limit").
+ */
+ int wanted_channels_end;
};
/*! returns a new dahdi_chan_conf with default values (by-value) */
@@ -1741,7 +1755,7 @@
static void *my_get_sigpvt_bridged_channel(struct ast_channel *chan)
{
- struct ast_channel *bridged = ast_bridged_channel(chan);
+ RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
if (bridged && ast_channel_tech(bridged) == &dahdi_tech) {
struct dahdi_pvt *p = ast_channel_tech_pvt(bridged);
@@ -2632,7 +2646,7 @@
#endif /* defined(HAVE_PRI) */
#if defined(HAVE_PRI)
-static int pri_destroy_dchan(struct sig_pri_span *pri);
+static void pri_destroy_span(struct sig_pri_span *pri);
static void my_handle_dchan_exception(struct sig_pri_span *pri, int index)
{
@@ -2662,7 +2676,7 @@
pri_event_noalarm(pri, index, 0);
break;
case DAHDI_EVENT_REMOVED:
- pri_destroy_dchan(pri);
+ pri_destroy_span(pri);
break;
default:
break;
@@ -9736,12 +9750,15 @@
struct ast_channel *nbridge =
p->subs[SUB_THREEWAY].owner;
struct dahdi_pvt *pbridge = NULL;
+ RAII_VAR(struct ast_channel *, bridged, nbridge ? ast_channel_bridge_peer(nbridge) : NULL, ast_channel_cleanup);
+
/* set up the private struct of the bridged one, if any */
- if (nbridge && ast_bridged_channel(nbridge))
- pbridge = ast_channel_tech_pvt(ast_bridged_channel(nbridge));
+ if (nbridge && bridged) {
+ pbridge = ast_channel_tech_pvt(bridged);
+ }
if (nbridge && pbridge &&
(ast_channel_tech(nbridge) == &dahdi_tech) &&
- (ast_channel_tech(ast_bridged_channel(nbridge)) == &dahdi_tech) &&
+ (ast_channel_tech(bridged) == &dahdi_tech) &&
ISTRUNK(pbridge)) {
int func = DAHDI_FLASH;
/* Clear out the dial buffer */
@@ -10732,28 +10749,120 @@
return handled;
}
-/* destroy a DAHDI channel, identified by its number */
-static int dahdi_destroy_channel_bynum(int channel)
+/* destroy a range DAHDI channels, identified by their number */
+static void dahdi_destroy_channel_range(int start, int end)
{
struct dahdi_pvt *cur;
-
+ struct dahdi_pvt *next;
+ int destroyed_first = 0;
+ int destroyed_last = 0;
+
+ ast_mutex_lock(&iflock);
+ ast_debug(1, "range: %d-%d\n", start, end);
+ for (cur = iflist; cur; cur = next) {
+ next = cur->next;
+ if (cur->channel >= start && cur->channel <= end) {
+ int x = DAHDI_FLASH;
+
+ if (cur->channel > destroyed_last) {
+ destroyed_last = cur->channel;
+ }
+ if (destroyed_first < 1 || cur->channel < destroyed_first) {
+ destroyed_first = cur->channel;
+ }
+ ast_debug(3, "Destroying %d\n", cur->channel);
+ /* important to create an event for dahdi_wait_event to register so that all analog_ss_threads terminate */
+ ioctl(cur->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
+
+ destroy_channel(cur, 1);
+ ast_module_unref(ast_module_info->self);
+ }
+ }
+ ast_mutex_unlock(&iflock);
+ if (destroyed_first > start || destroyed_last < end) {
+ ast_debug(1, "Asked to destroy %d-%d, destroyed %d-%d,\n",
+ start, end, destroyed_first, destroyed_last);
+ }
+}
+
+static int setup_dahdi(int reload);
+static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, struct dahdi_chan_conf *base_conf, struct dahdi_chan_conf *conf);
+
+/*!
+ * \internal
+ * \brief create a range of new DAHDI channels
+ *
+ * \param start first channel in the range
+ * \param end last channel in the range
+ *
+ * \retval RESULT_SUCCESS on success.
+ * \retval RESULT_FAILURE on error.
+ */
+static int dahdi_create_channel_range(int start, int end)
+{
+ struct dahdi_pvt *cur;
+ struct dahdi_chan_conf default_conf = dahdi_chan_conf_default();
+ struct dahdi_chan_conf base_conf = dahdi_chan_conf_default();
+ struct dahdi_chan_conf conf = dahdi_chan_conf_default();
+ int i, x;
+ int ret = RESULT_FAILURE; /* be pessimistic */
+
+ ast_debug(1, "channel range caps: %d - %d\n", start, end);
ast_mutex_lock(&iflock);
for (cur = iflist; cur; cur = cur->next) {
- if (cur->channel == channel) {
- int x = DAHDI_FLASH;
-
- /* important to create an event for dahdi_wait_event to register so that all analog_ss_threads terminate */
- ioctl(cur->subs[SUB_REAL].dfd, DAHDI_HOOK, &x);
-
- destroy_channel(cur, 1);
- ast_mutex_unlock(&iflock);
- ast_module_unref(ast_module_info->self);
- return RESULT_SUCCESS;
- }
- }
+ if (cur->channel >= start && cur->channel <= end) {
+ ast_log(LOG_ERROR,
+ "channel range %d-%d is occupied\n",
+ start, end);
+ goto out;
+ }
+ }
+ for (x = 0; x < NUM_SPANS; x++) {
+#ifdef HAVE_PRI
+ struct dahdi_pri *pri = pris + x;
+
+ if (!pris[x].pri.pvts[0]) {
+ break;
+ }
+ for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
+ int channo = pri->dchannels[i];
+
+ if (!channo) {
+ break;
+ }
+ if (!pri->pri.fds[i]) {
+ break;
+ }
+ if (channo >= start && channo <= end) {
+ ast_log(LOG_ERROR,
+ "channel range %d-%d is occupied by span %d\n",
+ start, end, x + 1);
+ goto out;
+ }
+ }
+#endif
+ }
+ if (!default_conf.chan.cc_params || !base_conf.chan.cc_params ||
+ !conf.chan.cc_params) {
+ goto out;
+ }
+ default_conf.wanted_channels_start = start;
+ base_conf.wanted_channels_start = start;
+ conf.wanted_channels_start = start;
+ default_conf.wanted_channels_end = end;
+ base_conf.wanted_channels_end = end;
+ conf.wanted_channels_end = end;
+ if (setup_dahdi_int(0, &default_conf, &base_conf, &conf) == 0) {
+ ret = RESULT_SUCCESS;
+ }
+out:
+ ast_cc_config_params_destroy(default_conf.chan.cc_params);
+ ast_cc_config_params_destroy(base_conf.chan.cc_params);
+ ast_cc_config_params_destroy(conf.chan.cc_params);
ast_mutex_unlock(&iflock);
- return RESULT_FAILURE;
-}
+ return ret;
+}
+
static struct dahdi_pvt *handle_init_event(struct dahdi_pvt *i, int event)
{
@@ -11120,11 +11229,7 @@
doomed = NULL;
for (i = iflist;; i = i->next) {
if (doomed) {
- int res;
- res = dahdi_destroy_channel_bynum(doomed->channel);
- if (res != RESULT_SUCCESS) {
- ast_log(LOG_WARNING, "Couldn't find channel to destroy, hopefully another destroy operation just happened.\n");
- }
+ dahdi_destroy_channel_range(doomed->channel, doomed->channel);
doomed = NULL;
}
if (!i) {
@@ -13570,10 +13675,21 @@
for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
if (!pri->dchannels[i])
break;
+ if (pri->pri.fds[i] >= 0) {
+ /* A partial range addition. Not a complete setup. */
+ break;
+ }
pri->pri.fds[i] = open("/dev/dahdi/channel", O_RDWR);
+ if ((pri->pri.fds[i] < 0)) {
+ ast_log(LOG_ERROR, "Unable to open D-channel (fd=%d) (%s)\n",
+ pri->pri.fds[i], strerror(errno));
+ return -1;
+ }
x = pri->dchannels[i];
- if ((pri->pri.fds[i] < 0) || (ioctl(pri->pri.fds[i],DAHDI_SPECIFY,&x) == -1)) {
- ast_log(LOG_ERROR, "Unable to open D-channel %d (%s)\n", x, strerror(errno));
+ res = ioctl(pri->pri.fds[i], DAHDI_SPECIFY, &x);
+ if (res) {
+ dahdi_close_pri_fd(pri, i);
+ ast_log(LOG_ERROR, "Unable to SPECIFY channel %d (%s)\n", x, strerror(errno));
return -1;
}
memset(&p, 0, sizeof(p));
@@ -13974,22 +14090,44 @@
*
* \param pri the pri span
*
- * \return TRUE if the span was valid and we attempted destroying.
- *
* Shuts down a span and destroys its D-Channel. Further destruction
* of the B-channels using dahdi_destroy_channel() would probably be required
* for the B-Channels.
*/
-static int pri_destroy_dchan(struct sig_pri_span *pri)
+static void pri_destroy_span(struct sig_pri_span *pri)
{
int i;
+ int res;
+ int cancel_code;
struct dahdi_pri* dahdi_pri;
-
- if (!pri->master || (pri->master == AST_PTHREADT_NULL)) {
- return 0;
- }
- pthread_cancel(pri->master);
- pthread_join(pri->master, NULL);
+ pthread_t master = pri->master;
+
+ if (!master || (master == AST_PTHREADT_NULL)) {
+ return;
+ }
+ ast_debug(2, "About to destroy DAHDI channels of span %d.\n", pri->span);
+ for (i = 0; i < pri->numchans; i++) {
+ int channel;
+ struct sig_pri_chan *pvt = pri->pvts[i];
+
+ if (!pvt) {
+ continue;
+ }
+ channel = pvt->channel;
+ ast_debug(2, "About to destroy B-channel %d.\n", channel);
+ dahdi_destroy_channel_range(channel, channel);
+ }
+
+ cancel_code = pthread_cancel(master);
+ ast_debug(4,
+ "Waiting to join thread of span %d "
+ "with pid=%p cancel_code=%d\n",
+ pri->span, (void *)master, cancel_code);
+ res = pthread_join(master, NULL);
+ if (res != 0) {
+ ast_log(LOG_NOTICE, "pthread_join failed: %d\n", res);
+ }
+ pri->master = AST_PTHREADT_NULL;
/* The 'struct dahdi_pri' that contains our 'struct sig_pri_span' */
dahdi_pri = container_of(pri, struct dahdi_pri, pri);
@@ -13997,17 +14135,16 @@
ast_debug(4, "closing pri_fd %d\n", i);
dahdi_close_pri_fd(dahdi_pri, i);
}
- pri->pri = NULL;
+ sig_pri_init_pri(pri);
ast_debug(1, "PRI span %d destroyed\n", pri->span);
- return 1;
}
static char *handle_pri_destroy_span(struct ast_cli_entry *e, int cmd,
struct ast_cli_args *a)
{
int span;
- int i;
int res;
+ struct sig_pri_span *pri;
switch (cmd) {
case CLI_INIT:
@@ -14031,25 +14168,13 @@
a->argv[3], 1, NUM_SPANS);
return CLI_SUCCESS;
}
- if (!pris[span - 1].pri.pri) {
+ pri = &pris[span - 1].pri;
+ if (!pri->pri) {
ast_cli(a->fd, "No PRI running on span %d\n", span);
return CLI_SUCCESS;
}
- for (i = 0; i < pris[span - 1].pri.numchans; i++) {
- int channel;
- struct sig_pri_chan *pvt = pris[span - 1].pri.pvts[i];
-
- if (!pvt) {
- continue;
- }
- channel = pvt->channel;
- ast_debug(2, "About to destroy B-channel %d.\n", channel);
- dahdi_destroy_channel_bynum(channel);
- }
- ast_debug(2, "About to destroy D-channel of span %d.\n", span);
- pri_destroy_dchan(&pris[span - 1].pri);
-
+ pri_destroy_span(pri);
return CLI_SUCCESS;
}
@@ -14501,26 +14626,97 @@
#endif /* HAVE_OPENR2 */
-static char *dahdi_destroy_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
- int channel;
- int ret;
+static char *dahdi_destroy_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ int start;
+ int end;
switch (cmd) {
case CLI_INIT:
- e->command = "dahdi destroy channel";
+ e->command = "dahdi destroy channels";
e->usage =
- "Usage: dahdi destroy channel <chan num>\n"
+ "Usage: dahdi destroy channels <from_channel> [<to_channel>]\n"
" DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 4)
+ if ((a->argc < 4) || a->argc > 5) {
return CLI_SHOWUSAGE;
-
- channel = atoi(a->argv[3]);
- ret = dahdi_destroy_channel_bynum(channel);
- return ( RESULT_SUCCESS == ret ) ? CLI_SUCCESS : CLI_FAILURE;
+ }
+ start = atoi(a->argv[3]);
+ if (start < 1) {
+ ast_cli(a->fd, "Invalid starting channel number %s.\n",
+ a->argv[4]);
+ return CLI_FAILURE;
+ }
+ if (a->argc == 5) {
+ end = atoi(a->argv[4]);
+ if (end < 1) {
+ ast_cli(a->fd, "Invalid ending channel number %s.\n",
+ a->argv[4]);
+ return CLI_FAILURE;
+ }
+ } else {
+ end = start;
+ }
+
+ if (end < start) {
+ ast_cli(a->fd,
+ "range end (%d) is smaller than range start (%d)\n",
+ end, start);
+ return CLI_FAILURE;
+ }
+ dahdi_destroy_channel_range(start, end);
+ return CLI_SUCCESS;
+}
+
+static char *dahdi_create_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ int start;
+ int end;
+ int ret;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "dahdi create channels";
+ e->usage = "Usage: dahdi create channels <from> [<to>] - a range of channels\n"
+ " dahdi create channels new - add channels not yet created\n"
+ "For ISDN and SS7 the range should include complete spans.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+ if ((a->argc < 4) || a->argc > 5) {
+ return CLI_SHOWUSAGE;
+ }
+ if (a->argc == 4 && !strcmp(a->argv[3], "new")) {
+ ret = dahdi_create_channel_range(0, 0);
+ return (RESULT_SUCCESS == ret) ? CLI_SUCCESS : CLI_FAILURE;
+ }
+ start = atoi(a->argv[3]);
+ if (start <= 0) {
+ ast_cli(a->fd, "Invalid starting channel number '%s'.\n",
+ a->argv[3]);
+ return CLI_FAILURE;
+ }
+ if (a->argc == 5) {
+ end = atoi(a->argv[4]);
+ if (end <= 0) {
+ ast_cli(a->fd, "Invalid ending channel number '%s'.\n",
+ a->argv[4]);
+ return CLI_FAILURE;
+ }
+ } else {
+ end = start;
+ }
+ if (end < start) {
+ ast_cli(a->fd,
+ "range end (%d) is smaller than range start (%d)\n",
+ end, start);
+ return CLI_FAILURE;
+ }
+ ret = dahdi_create_channel_range(start, end);
+ return (RESULT_SUCCESS == ret) ? CLI_SUCCESS : CLI_FAILURE;
}
static void dahdi_softhangup_all(void)
@@ -14551,7 +14747,6 @@
ast_mutex_unlock(&iflock);
}
-static int setup_dahdi(int reload);
static int dahdi_restart(void)
{
#if defined(HAVE_PRI) || defined(HAVE_SS7)
@@ -15328,7 +15523,8 @@
AST_CLI_DEFINE(handle_dahdi_show_cadences, "List cadences"),
AST_CLI_DEFINE(dahdi_show_channels, "Show active DAHDI channels"),
AST_CLI_DEFINE(dahdi_show_channel, "Show information on a channel"),
- AST_CLI_DEFINE(dahdi_destroy_channel, "Destroy a channel"),
+ AST_CLI_DEFINE(dahdi_destroy_channels, "Destroy channels"),
+ AST_CLI_DEFINE(dahdi_create_channels, "Create channels"),
AST_CLI_DEFINE(dahdi_restart_cmd, "Fully restart DAHDI channels"),
AST_CLI_DEFINE(dahdi_show_status, "Show all DAHDI cards status"),
AST_CLI_DEFINE(dahdi_show_version, "Show the DAHDI version in use"),
@@ -16355,7 +16551,7 @@
return p;
}
-static int build_channels(struct dahdi_chan_conf *conf, const char *value, int reload, int lineno, int *found_pseudo)
+static int build_channels(struct dahdi_chan_conf *conf, const char *value, int reload, int lineno)
{
char *c, *chan;
char *subdir;
@@ -16378,8 +16574,6 @@
finish = start;
} else if (!strcasecmp(chan, "pseudo")) {
finish = start = CHAN_PSEUDO;
- if (found_pseudo)
- *found_pseudo = 1;
} else {
ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", value, chan);
return -1;
@@ -16409,6 +16603,12 @@
}
}
}
+ if (conf->wanted_channels_start &&
+ (real_channel < conf->wanted_channels_start ||
+ real_channel > conf->wanted_channels_end)
+ ) {
+ continue;
+ }
tmp = mkintf(real_channel, conf, reload);
if (tmp) {
@@ -16417,6 +16617,9 @@
ast_log(LOG_ERROR, "Unable to %s channel '%s'\n",
(reload == 1) ? "reconfigure" : "register", value);
return -1;
+ }
+ if (real_channel == CHAN_PSEUDO) {
+ has_pseudo = 1;
}
}
}
@@ -16604,7 +16807,6 @@
{
struct dahdi_pvt *tmp;
int y;
- int found_pseudo = 0;
struct ast_variable *dahdichan = NULL;
for (; v; v = v->next) {
@@ -16617,7 +16819,7 @@
ast_log(LOG_WARNING, "Channel '%s' ignored.\n", v->value);
continue;
}
- if (build_channels(confp, v->value, reload, v->lineno, &found_pseudo)) {
+ if (build_channels(confp, v->value, reload, v->lineno)) {
if (confp->ignore_failed_channels) {
ast_log(LOG_WARNING, "Channel '%s' failure ignored: ignore_failed_channels.\n", v->value);
continue;
@@ -17750,8 +17952,7 @@
if (dahdichan) {
/* Process the deferred dahdichan value. */
- if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno,
- &found_pseudo)) {
+ if (build_channels(confp, dahdichan->value, reload, dahdichan->lineno)) {
if (confp->ignore_failed_channels) {
ast_log(LOG_WARNING,
"Dahdichan '%s' failure ignored: ignore_failed_channels.\n",
@@ -17774,7 +17975,7 @@
/*< \todo why check for the pseudo in the per-channel section.
* Any actual use for manual setup of the pseudo channel? */
- if (!found_pseudo && reload != 1 && !(options & PROC_DAHDI_OPT_NOCHAN)) {
+ if (!has_pseudo && reload != 1 && !(options & PROC_DAHDI_OPT_NOCHAN)) {
/* use the default configuration for a channel, so
that any settings from real configured channels
don't "leak" into the pseudo channel config
@@ -17788,6 +17989,7 @@
}
if (tmp) {
ast_verb(3, "Automatically generated pseudo channel\n");
+ has_pseudo = 1;
} else {
ast_log(LOG_WARNING, "Unable to register pseudo channel!\n");
}
@@ -18067,7 +18269,8 @@
if (reload != 1) {
int x;
[... 8083 lines stripped ...]
More information about the asterisk-commits
mailing list