[svn-commits] rmudgett: branch rmudgett/ss7_27_knk r395169 - in /team/rmudgett/ss7_27_knk: ...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 23 11:58:25 CDT 2013
Author: rmudgett
Date: Tue Jul 23 11:58:22 2013
New Revision: 395169
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395169
Log:
Resolve conflict and reset automerge.
Added:
team/rmudgett/ss7_27_knk/channels/chan_dahdi.h
- copied, changed from r395167, trunk/channels/chan_dahdi.h
team/rmudgett/ss7_27_knk/channels/dahdi/ (props changed)
- copied from r395167, trunk/channels/dahdi/
team/rmudgett/ss7_27_knk/channels/dahdi/bridge_native_dahdi.c
- copied unchanged from r395167, trunk/channels/dahdi/bridge_native_dahdi.c
team/rmudgett/ss7_27_knk/channels/dahdi/bridge_native_dahdi.h
- copied unchanged from r395167, trunk/channels/dahdi/bridge_native_dahdi.h
team/rmudgett/ss7_27_knk/include/asterisk/bridging_internal.h
- copied unchanged from r395167, trunk/include/asterisk/bridging_internal.h
Modified:
team/rmudgett/ss7_27_knk/ (props changed)
team/rmudgett/ss7_27_knk/bridges/bridge_builtin_features.c
team/rmudgett/ss7_27_knk/bridges/bridge_softmix.c
team/rmudgett/ss7_27_knk/channels/Makefile
team/rmudgett/ss7_27_knk/channels/chan_dahdi.c
team/rmudgett/ss7_27_knk/channels/chan_mgcp.c
team/rmudgett/ss7_27_knk/include/asterisk/bridging.h
team/rmudgett/ss7_27_knk/include/asterisk/bridging_features.h
team/rmudgett/ss7_27_knk/include/asterisk/bridging_roles.h
team/rmudgett/ss7_27_knk/include/asterisk/features_config.h
team/rmudgett/ss7_27_knk/include/asterisk/stasis_bridging.h
team/rmudgett/ss7_27_knk/main/bridging.c
team/rmudgett/ss7_27_knk/main/bridging_basic.c
team/rmudgett/ss7_27_knk/main/bridging_roles.c
team/rmudgett/ss7_27_knk/main/cel.c
team/rmudgett/ss7_27_knk/main/features.c
team/rmudgett/ss7_27_knk/main/features_config.c
team/rmudgett/ss7_27_knk/main/stasis_bridging.c
Propchange: team/rmudgett/ss7_27_knk/
------------------------------------------------------------------------------
automerge = *
Propchange: team/rmudgett/ss7_27_knk/
------------------------------------------------------------------------------
--- ss7_27_knk-integrated (original)
+++ ss7_27_knk-integrated Tue Jul 23 11:58:22 2013
@@ -1,1 +1,1 @@
-/trunk:1-395148
+/trunk:1-395168
Modified: team/rmudgett/ss7_27_knk/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/bridges/bridge_builtin_features.c?view=diff&rev=395169&r1=395168&r2=395169
==============================================================================
--- team/rmudgett/ss7_27_knk/bridges/bridge_builtin_features.c (original)
+++ team/rmudgett/ss7_27_knk/bridges/bridge_builtin_features.c Tue Jul 23 11:58:22 2013
@@ -54,421 +54,6 @@
#include "asterisk/mixmonitor.h"
#include "asterisk/audiohook.h"
-/*!
- * \brief Helper function that presents dialtone and grabs extension
- *
- * \retval 0 on success
- * \retval -1 on failure
- */
-static int grab_transfer(struct ast_channel *chan, char *exten, size_t exten_len, const char *context)
-{
- int res;
- int digit_timeout;
- RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
-
- ast_channel_lock(chan);
- xfer_cfg = ast_get_chan_features_xfer_config(chan);
- if (!xfer_cfg) {
- ast_log(LOG_ERROR, "Unable to get transfer configuration\n");
- ast_channel_unlock(chan);
- return -1;
- }
- digit_timeout = xfer_cfg->transferdigittimeout;
- ast_channel_unlock(chan);
-
- /* Play the simple "transfer" prompt out and wait */
- res = ast_stream_and_wait(chan, "pbx-transfer", AST_DIGIT_ANY);
- ast_stopstream(chan);
- if (res < 0) {
- /* Hangup or error */
- return -1;
- }
- if (res) {
- /* Store the DTMF digit that interrupted playback of the file. */
- exten[0] = res;
- }
-
- /* Drop to dialtone so they can enter the extension they want to transfer to */
- res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, digit_timeout);
- if (res < 0) {
- /* Hangup or error */
- res = -1;
- } else if (!res) {
- /* 0 for invalid extension dialed. */
- if (ast_strlen_zero(exten)) {
- ast_debug(1, "%s dialed no digits.\n", ast_channel_name(chan));
- } else {
- ast_debug(1, "%s dialed '%s@%s' does not exist.\n",
- ast_channel_name(chan), exten, context);
- }
- ast_stream_and_wait(chan, "pbx-invalid", AST_DIGIT_NONE);
- res = -1;
- } else {
- /* Dialed extension is valid. */
- res = 0;
- }
- return res;
-}
-
-static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)
-{
- ast_channel_lock_both(caller, dest);
- ast_connected_line_copy_from_caller(ast_channel_connected(dest), ast_channel_caller(caller));
- ast_channel_inherit_variables(caller, dest);
- ast_channel_datastore_inherit(caller, dest);
- ast_channel_unlock(dest);
- ast_channel_unlock(caller);
-}
-
-/*! \brief Helper function that creates an outgoing channel and returns it immediately */
-static struct ast_channel *dial_transfer(struct ast_channel *caller, const char *exten, const char *context)
-{
- char destination[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 1];
- struct ast_channel *chan;
- int cause;
-
- /* Fill the variable with the extension and context we want to call */
- snprintf(destination, sizeof(destination), "%s@%s", exten, context);
-
- /* Now we request a local channel to prepare to call the destination */
- chan = ast_request("Local", ast_channel_nativeformats(caller), caller, destination,
- &cause);
- if (!chan) {
- return NULL;
- }
-
- /* Who is transferring the call. */
- pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", ast_channel_name(caller));
-
- /* To work as an analog to BLINDTRANSFER */
- pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFER", ast_channel_name(caller));
-
- /* Before we actually dial out let's inherit appropriate information. */
- copy_caller_data(chan, caller);
-
- /* Since the above worked fine now we actually call it and return the channel */
- if (ast_call(chan, destination, 0)) {
- ast_hangup(chan);
- return NULL;
- }
-
- return chan;
-}
-
-/*!
- * \internal
- * \brief Determine the transfer context to use.
- * \since 12.0.0
- *
- * \param transferer Channel initiating the transfer.
- * \param context User supplied context if available. May be NULL.
- *
- * \return The context to use for the transfer.
- */
-static const char *get_transfer_context(struct ast_channel *transferer, const char *context)
-{
- if (!ast_strlen_zero(context)) {
- return context;
- }
- context = pbx_builtin_getvar_helper(transferer, "TRANSFER_CONTEXT");
- if (!ast_strlen_zero(context)) {
- return context;
- }
- context = ast_channel_macrocontext(transferer);
- if (!ast_strlen_zero(context)) {
- return context;
- }
- context = ast_channel_context(transferer);
- if (!ast_strlen_zero(context)) {
- return context;
- }
- return "default";
-}
-
-static void blind_transfer_cb(struct ast_channel *new_channel, void *user_data,
- enum ast_transfer_type transfer_type)
-{
- struct ast_channel *transferer_channel = user_data;
-
- if (transfer_type == AST_BRIDGE_TRANSFER_MULTI_PARTY) {
- copy_caller_data(new_channel, transferer_channel);
- }
-}
-
-/*! \brief Internal built in feature for blind transfers */
-static int feature_blind_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- char exten[AST_MAX_EXTENSION] = "";
- struct ast_bridge_features_blind_transfer *blind_transfer = hook_pvt;
- const char *context;
- char *goto_on_blindxfr;
-
- ast_bridge_channel_write_hold(bridge_channel, NULL);
-
- ast_channel_lock(bridge_channel->chan);
- context = ast_strdupa(get_transfer_context(bridge_channel->chan,
- blind_transfer ? blind_transfer->context : NULL));
- goto_on_blindxfr = ast_strdupa(S_OR(pbx_builtin_getvar_helper(bridge_channel->chan,
- "GOTO_ON_BLINDXFR"), ""));
- ast_channel_unlock(bridge_channel->chan);
-
- /* Grab the extension to transfer to */
- if (grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
-
- if (!ast_strlen_zero(goto_on_blindxfr)) {
- ast_debug(1, "After transfer, transferer %s goes to %s\n",
- ast_channel_name(bridge_channel->chan), goto_on_blindxfr);
- ast_after_bridge_set_go_on(bridge_channel->chan, NULL, NULL, 0, goto_on_blindxfr);
- }
-
- if (ast_bridge_transfer_blind(0, bridge_channel->chan, exten, context, blind_transfer_cb,
- bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS &&
- !ast_strlen_zero(goto_on_blindxfr)) {
- ast_after_bridge_goto_discard(bridge_channel->chan);
- }
-
- return 0;
-}
-
-/*! Attended transfer code */
-enum atxfer_code {
- /*! Party C hungup or other reason to abandon the transfer. */
- ATXFER_INCOMPLETE,
- /*! Transfer party C to party A. */
- ATXFER_COMPLETE,
- /*! Turn the transfer into a threeway call. */
- ATXFER_THREEWAY,
- /*! Hangup party C and return party B to the bridge. */
- ATXFER_ABORT,
-};
-
-/*! \brief Attended transfer feature to complete transfer */
-static int attended_transfer_complete(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- enum atxfer_code *transfer_code = hook_pvt;
-
- *transfer_code = ATXFER_COMPLETE;
- ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
- return 0;
-}
-
-/*! \brief Attended transfer feature to turn it into a threeway call */
-static int attended_transfer_threeway(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- enum atxfer_code *transfer_code = hook_pvt;
-
- *transfer_code = ATXFER_THREEWAY;
- ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
- return 0;
-}
-
-/*! \brief Attended transfer feature to abort transfer */
-static int attended_transfer_abort(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- enum atxfer_code *transfer_code = hook_pvt;
-
- *transfer_code = ATXFER_ABORT;
- ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
- return 0;
-}
-
-/*! \brief Internal built in feature for attended transfers */
-static int feature_attended_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
-{
- char exten[AST_MAX_EXTENSION] = "";
- struct ast_channel *peer;
- struct ast_bridge *attended_bridge;
- struct ast_bridge_features caller_features;
- int xfer_failed;
- struct ast_bridge_features_attended_transfer *attended_transfer = hook_pvt;
- const char *complete_sound;
- const char *context;
- enum atxfer_code transfer_code = ATXFER_INCOMPLETE;
- const char *atxfer_abort;
- const char *atxfer_threeway;
- const char *atxfer_complete;
- const char *fail_sound;
- RAII_VAR(struct ast_features_xfer_config *, xfer_cfg, NULL, ao2_cleanup);
-
- ast_bridge_channel_write_hold(bridge_channel, NULL);
-
- bridge = ast_bridge_channel_merge_inhibit(bridge_channel, +1);
-
- ast_channel_lock(bridge_channel->chan);
- context = ast_strdupa(get_transfer_context(bridge_channel->chan,
- attended_transfer ? attended_transfer->context : NULL));
- xfer_cfg = ast_get_chan_features_xfer_config(bridge_channel->chan);
- if (!xfer_cfg) {
- ast_log(LOG_ERROR, "Unable to get transfer configuration options\n");
- ast_channel_unlock(bridge_channel->chan);
- return 0;
- }
- if (attended_transfer) {
- atxfer_abort = ast_strdupa(S_OR(attended_transfer->abort, xfer_cfg->atxferabort));
- atxfer_threeway = ast_strdupa(S_OR(attended_transfer->threeway, xfer_cfg->atxferthreeway));
- atxfer_complete = ast_strdupa(S_OR(attended_transfer->complete, xfer_cfg->atxfercomplete));
- } else {
- atxfer_abort = ast_strdupa(xfer_cfg->atxferabort);
- atxfer_threeway = ast_strdupa(xfer_cfg->atxferthreeway);
- atxfer_complete = ast_strdupa(xfer_cfg->atxfercomplete);
- }
- fail_sound = ast_strdupa(xfer_cfg->xferfailsound);
- ast_channel_unlock(bridge_channel->chan);
-
- /* Grab the extension to transfer to */
- if (grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
-
- /* Get a channel that is the destination we wish to call */
- peer = dial_transfer(bridge_channel->chan, exten, context);
- if (!peer) {
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
-
-/* BUGBUG bridging API features does not support the features.conf atxfer bounce between C & B channels */
- /* Setup a DTMF menu to control the transfer. */
- if (ast_bridge_features_init(&caller_features)
- || ast_bridge_hangup_hook(&caller_features,
- attended_transfer_complete, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features, atxfer_abort,
- attended_transfer_abort, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features, atxfer_complete,
- attended_transfer_complete, &transfer_code, NULL, 0)
- || ast_bridge_dtmf_hook(&caller_features, atxfer_threeway,
- attended_transfer_threeway, &transfer_code, NULL, 0)) {
- ast_bridge_features_cleanup(&caller_features);
- ast_hangup(peer);
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
-
- /* Create a bridge to use to talk to the person we are calling */
- attended_bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_1TO1MIX,
- AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
- if (!attended_bridge) {
- ast_bridge_features_cleanup(&caller_features);
- ast_hangup(peer);
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
- ast_bridge_merge_inhibit(attended_bridge, +1);
-
- /* This is how this is going down, we are imparting the channel we called above into this bridge first */
-/* BUGBUG we should impart the peer as an independent and move it to the original bridge. */
- if (ast_bridge_impart(attended_bridge, peer, NULL, NULL, 0)) {
- ast_bridge_destroy(attended_bridge);
- ast_bridge_features_cleanup(&caller_features);
- ast_hangup(peer);
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
- ast_bridge_channel_write_unhold(bridge_channel);
- return 0;
- }
-
- /*
- * For the caller we want to join the bridge in a blocking
- * fashion so we don't spin around in this function doing
- * nothing while waiting.
- */
- ast_bridge_join(attended_bridge, bridge_channel->chan, NULL, &caller_features, NULL, 0);
-
-/*
- * BUGBUG there is a small window where the channel does not point to the bridge_channel.
- *
- * This window is expected to go away when atxfer is redesigned
- * to fully support existing functionality. There will be one
- * and only one ast_bridge_channel structure per channel.
- */
- /* Point the channel back to the original bridge and bridge_channel. */
- ast_bridge_channel_lock(bridge_channel);
- ast_channel_lock(bridge_channel->chan);
- ast_channel_internal_bridge_channel_set(bridge_channel->chan, bridge_channel);
- ast_channel_internal_bridge_set(bridge_channel->chan, bridge_channel->bridge);
- ast_channel_unlock(bridge_channel->chan);
- ast_bridge_channel_unlock(bridge_channel);
-
- /* Wait for peer thread to exit bridge and die. */
- if (!ast_autoservice_start(bridge_channel->chan)) {
- ast_bridge_depart(peer);
- ast_autoservice_stop(bridge_channel->chan);
- } else {
- ast_bridge_depart(peer);
- }
-
- /* Now that all channels are out of it we can destroy the bridge and the feature structures */
- ast_bridge_destroy(attended_bridge);
- ast_bridge_features_cleanup(&caller_features);
-
- /* Is there a courtesy sound to play to the peer? */
- ast_channel_lock(bridge_channel->chan);
- complete_sound = pbx_builtin_getvar_helper(bridge_channel->chan,
- "ATTENDED_TRANSFER_COMPLETE_SOUND");
- if (!ast_strlen_zero(complete_sound)) {
- complete_sound = ast_strdupa(complete_sound);
- } else {
- complete_sound = NULL;
- }
- ast_channel_unlock(bridge_channel->chan);
- if (complete_sound) {
- pbx_builtin_setvar_helper(peer, "BRIDGE_PLAY_SOUND", complete_sound);
- }
-
- xfer_failed = -1;
- switch (transfer_code) {
- case ATXFER_INCOMPLETE:
- /* Peer hungup */
- break;
- case ATXFER_COMPLETE:
- /* The peer takes our place in the bridge. */
- ast_bridge_channel_write_unhold(bridge_channel);
- ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
- xfer_failed = ast_bridge_impart(bridge_channel->bridge, peer, bridge_channel->chan, NULL, 1);
- break;
- case ATXFER_THREEWAY:
- /*
- * Transferer wants to convert to a threeway call.
- *
- * Just impart the peer onto the bridge and have us return to it
- * as normal.
- */
- ast_bridge_channel_write_unhold(bridge_channel);
- xfer_failed = ast_bridge_impart(bridge_channel->bridge, peer, NULL, NULL, 1);
- break;
- case ATXFER_ABORT:
- /* Transferer decided not to transfer the call after all. */
- break;
- }
- ast_bridge_merge_inhibit(bridge, -1);
- ao2_ref(bridge, -1);
- if (xfer_failed) {
- ast_hangup(peer);
- if (!ast_check_hangup_locked(bridge_channel->chan)) {
- ast_stream_and_wait(bridge_channel->chan, fail_sound, AST_DIGIT_NONE);
- }
- ast_bridge_channel_write_unhold(bridge_channel);
- }
-
- return 0;
-}
-
enum set_touch_variables_res {
SET_TOUCH_SUCCESS,
SET_TOUCH_UNSET,
@@ -909,8 +494,6 @@
static int load_module(void)
{
- ast_bridge_features_register(AST_BRIDGE_BUILTIN_BLINDTRANSFER, feature_blind_transfer, NULL);
- ast_bridge_features_register(AST_BRIDGE_BUILTIN_ATTENDEDTRANSFER, feature_attended_transfer, NULL);
ast_bridge_features_register(AST_BRIDGE_BUILTIN_HANGUP, feature_hangup, NULL);
ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMON, feature_automonitor, NULL);
ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMIXMON, feature_automixmonitor, NULL);
Modified: team/rmudgett/ss7_27_knk/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/bridges/bridge_softmix.c?view=diff&rev=395169&r1=395168&r2=395169
==============================================================================
--- team/rmudgett/ss7_27_knk/bridges/bridge_softmix.c (original)
+++ team/rmudgett/ss7_27_knk/bridges/bridge_softmix.c Tue Jul 23 11:58:22 2013
@@ -623,6 +623,9 @@
}
switch (frame->frametype) {
+ case AST_FRAME_NULL:
+ /* "Accept" the frame and discard it. */
+ break;
case AST_FRAME_DTMF_BEGIN:
case AST_FRAME_DTMF_END:
res = ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);
Modified: team/rmudgett/ss7_27_knk/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/Makefile?view=diff&rev=395169&r1=395168&r2=395169
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/Makefile (original)
+++ team/rmudgett/ss7_27_knk/channels/Makefile Tue Jul 23 11:58:22 2013
@@ -1,6 +1,6 @@
#
# Asterisk -- An open source telephony toolkit.
-#
+#
# Makefile for channel drivers
#
# Copyright (C) 1999-2006, Digium, Inc.
@@ -72,10 +72,19 @@
$(if $(filter chan_iax2,$(EMBEDDED_MODS)),modules.link,chan_iax2.so): $(subst .c,.o,$(wildcard iax2/*.c))
$(subst .c,.o,$(wildcard iax2/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_iax2)
+
$(if $(filter chan_sip,$(EMBEDDED_MODS)),modules.link,chan_sip.so): $(subst .c,.o,$(wildcard sip/*.c))
$(subst .c,.o,$(wildcard sip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_sip)
-$(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): sig_analog.o sig_pri.o sig_ss7.o
-sig_analog.o sig_pri.o sig_ss7.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)
+
+# Additional objects to combine with chan_dahdi.so
+CHAN_DAHDI_OBJS= \
+ $(subst .c,.o,$(wildcard dahdi/*.c)) \
+ sig_analog.o \
+ sig_pri.o \
+ sig_ss7.o \
+
+$(if $(filter chan_dahdi,$(EMBEDDED_MODS)),modules.link,chan_dahdi.so): $(CHAN_DAHDI_OBJS)
+$(CHAN_DAHDI_OBJS): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)
ifneq ($(filter chan_h323,$(EMBEDDED_MODS)),)
modules.link: h323/libchanh323.a
Modified: team/rmudgett/ss7_27_knk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ss7_27_knk/channels/chan_dahdi.c?view=diff&rev=395169&r1=395168&r2=395169
==============================================================================
--- team/rmudgett/ss7_27_knk/channels/chan_dahdi.c (original)
+++ team/rmudgett/ss7_27_knk/channels/chan_dahdi.c Tue Jul 23 11:58:22 2013
@@ -62,13 +62,8 @@
#else
#include <sys/signal.h>
#endif
-#include <sys/ioctl.h>
-#include <sys/stat.h>
#include <math.h>
-#include <ctype.h>
-
-#include <dahdi/user.h>
-#include <dahdi/tonezone.h>
+
#include "sig_analog.h"
/* Analog signaling is currently still present in chan_dahdi for use with
* radio. Sig_analog does not currently handle any radio operations. If
@@ -92,11 +87,10 @@
#endif
#endif /* defined(HAVE_SS7) */
-#ifdef HAVE_OPENR2
+#if defined(HAVE_OPENR2)
/* put this here until sig_mfcr2 comes along */
#define SIG_MFCR2_MAX_CHANNELS 672 /*!< No more than a DS3 per trunk group */
-#include <openr2.h>
-#endif
+#endif /* defined(HAVE_OPENR2) */
#include "asterisk/lock.h"
#include "asterisk/channel.h"
@@ -133,6 +127,8 @@
#include "asterisk/features_config.h"
#include "asterisk/bridging.h"
#include "asterisk/stasis_channels.h"
+#include "chan_dahdi.h"
+#include "dahdi/bridge_native_dahdi.h"
/*** DOCUMENTATION
<application name="DAHDISendKeypadFacility" language="en_US">
@@ -424,7 +420,7 @@
/*! \brief Signaling types that need to use MF detection should be placed in this macro */
#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB))
-static const char tdesc[] = "DAHDI Telephony Driver"
+static const char tdesc[] = "DAHDI Telephony"
#if defined(HAVE_PRI) || defined(HAVE_SS7) || defined(HAVE_OPENR2)
" w/"
#if defined(HAVE_PRI)
@@ -447,33 +443,6 @@
static const char config[] = "chan_dahdi.conf";
-#define SIG_EM DAHDI_SIG_EM
-#define SIG_EMWINK (0x0100000 | DAHDI_SIG_EM)
-#define SIG_FEATD (0x0200000 | DAHDI_SIG_EM)
-#define SIG_FEATDMF (0x0400000 | DAHDI_SIG_EM)
-#define SIG_FEATB (0x0800000 | DAHDI_SIG_EM)
-#define SIG_E911 (0x1000000 | DAHDI_SIG_EM)
-#define SIG_FEATDMF_TA (0x2000000 | DAHDI_SIG_EM)
-#define SIG_FGC_CAMA (0x4000000 | DAHDI_SIG_EM)
-#define SIG_FGC_CAMAMF (0x8000000 | DAHDI_SIG_EM)
-#define SIG_FXSLS DAHDI_SIG_FXSLS
-#define SIG_FXSGS DAHDI_SIG_FXSGS
-#define SIG_FXSKS DAHDI_SIG_FXSKS
-#define SIG_FXOLS DAHDI_SIG_FXOLS
-#define SIG_FXOGS DAHDI_SIG_FXOGS
-#define SIG_FXOKS DAHDI_SIG_FXOKS
-#define SIG_PRI DAHDI_SIG_CLEAR
-#define SIG_BRI (0x2000000 | DAHDI_SIG_CLEAR)
-#define SIG_BRI_PTMP (0X4000000 | DAHDI_SIG_CLEAR)
-#define SIG_SS7 (0x1000000 | DAHDI_SIG_CLEAR)
-#define SIG_MFCR2 DAHDI_SIG_CAS
-#define SIG_SF DAHDI_SIG_SF
-#define SIG_SFWINK (0x0100000 | DAHDI_SIG_SF)
-#define SIG_SF_FEATD (0x0200000 | DAHDI_SIG_SF)
-#define SIG_SF_FEATDMF (0x0400000 | DAHDI_SIG_SF)
-#define SIG_SF_FEATB (0x0800000 | DAHDI_SIG_SF)
-#define SIG_EM_E1 DAHDI_SIG_EM_E1
-
#ifdef LOTS_OF_SPANS
#define NUM_SPANS DAHDI_MAX_SPANS
#else
@@ -580,8 +549,6 @@
static int restart_monitor(void);
-static enum ast_bridge_result dahdi_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
-
static int dahdi_sendtext(struct ast_channel *c, const char *text);
static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
@@ -626,8 +593,6 @@
#define MIN_MS_SINCE_FLASH ((2000) ) /*!< 2000 ms */
#define DEFAULT_RINGT ((8000 * 8) / READ_SIZE) /*!< 8,000 ms */
#define DEFAULT_DIALTONE_DETECT_TIMEOUT ((10000 * 8) / READ_SIZE) /*!< 10,000 ms */
-
-struct dahdi_pvt;
/*!
* \brief Configured ring timeout base.
@@ -725,650 +690,14 @@
struct dahdi_pri;
#endif
-#define SUB_REAL 0 /*!< Active call */
-#define SUB_CALLWAIT 1 /*!< Call-Waiting call on hold */
-#define SUB_THREEWAY 2 /*!< Three-way call */
-
/* Polarity states */
#define POLARITY_IDLE 0
#define POLARITY_REV 1
-
-struct distRingData {
- int ring[3];
- int range;
-};
-struct ringContextData {
- char contextData[AST_MAX_CONTEXT];
-};
-struct dahdi_distRings {
- struct distRingData ringnum[3];
- struct ringContextData ringContext[3];
-};
-
-static const char * const subnames[] = {
+const char * const subnames[] = {
"Real",
"Callwait",
"Threeway"
-};
-
-struct dahdi_subchannel {
- int dfd;
- struct ast_channel *owner;
- int chan;
- short buffer[AST_FRIENDLY_OFFSET/2 + READ_SIZE];
- struct ast_frame f; /*!< One frame for each channel. How did this ever work before? */
- unsigned int needringing:1;
- unsigned int needbusy:1;
- unsigned int needcongestion:1;
- unsigned int needanswer:1;
- unsigned int needflash:1;
- unsigned int needhold:1;
- unsigned int needunhold:1;
- unsigned int linear:1;
- unsigned int inthreeway:1;
- struct dahdi_confinfo curconf;
-};
-
-#define CONF_USER_REAL (1 << 0)
-#define CONF_USER_THIRDCALL (1 << 1)
-
-#define MAX_SLAVES 4
-
-/* States for sending MWI message
- * First three states are required for send Ring Pulse Alert Signal
- */
-typedef enum {
- MWI_SEND_NULL = 0,
- MWI_SEND_SA,
- MWI_SEND_SA_WAIT,
- MWI_SEND_PAUSE,
- MWI_SEND_SPILL,
- MWI_SEND_CLEANUP,
- MWI_SEND_DONE,
-} mwisend_states;
-
-struct mwisend_info {
- struct timeval pause;
- mwisend_states mwisend_current;
-};
-
-/*! Specify the lists dahdi_pvt can be put in. */
-enum DAHDI_IFLIST {
- DAHDI_IFLIST_NONE, /*!< The dahdi_pvt is not in any list. */
- DAHDI_IFLIST_MAIN, /*!< The dahdi_pvt is in the main interface list */
-#if defined(HAVE_PRI)
- DAHDI_IFLIST_NO_B_CHAN, /*!< The dahdi_pvt is in a no B channel interface list */
-#endif /* defined(HAVE_PRI) */
-};
-
-struct dahdi_pvt {
- ast_mutex_t lock; /*!< Channel private lock. */
- struct callerid_state *cs;
- struct ast_channel *owner; /*!< Our current active owner (if applicable) */
- /*!< Up to three channels can be associated with this call */
-
- struct dahdi_subchannel sub_unused; /*!< Just a safety precaution */
- struct dahdi_subchannel subs[3]; /*!< Sub-channels */
- struct dahdi_confinfo saveconf; /*!< Saved conference info */
-
- struct dahdi_pvt *slaves[MAX_SLAVES]; /*!< Slave to us (follows our conferencing) */
- struct dahdi_pvt *master; /*!< Master to us (we follow their conferencing) */
- int inconference; /*!< If our real should be in the conference */
-
- int bufsize; /*!< Size of the buffers */
- int buf_no; /*!< Number of buffers */
- int buf_policy; /*!< Buffer policy */
- int faxbuf_no; /*!< Number of Fax buffers */
- int faxbuf_policy; /*!< Fax buffer policy */
- int sig; /*!< Signalling style */
- /*!
- * \brief Nonzero if the signaling type is sent over a radio.
- * \note Set to a couple of nonzero values but it is only tested like a boolean.
- */
- int radio;
- int outsigmod; /*!< Outbound Signalling style (modifier) */
- int oprmode; /*!< "Operator Services" mode */
- struct dahdi_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */
- /*! \brief Amount of gain to increase during caller id */
- float cid_rxgain;
- /*! \brief Rx gain set by chan_dahdi.conf */
- float rxgain;
- /*! \brief Tx gain set by chan_dahdi.conf */
- float txgain;
-
- float txdrc; /*!< Dynamic Range Compression factor. a number between 1 and 6ish */
- float rxdrc;
-
- int tonezone; /*!< tone zone for this chan, or -1 for default */
- enum DAHDI_IFLIST which_iflist; /*!< Which interface list is this structure listed? */
- struct dahdi_pvt *next; /*!< Next channel in list */
- struct dahdi_pvt *prev; /*!< Prev channel in list */
-
- /* flags */
-
- /*!
- * \brief TRUE if ADSI (Analog Display Services Interface) available
- * \note Set from the "adsi" value read in from chan_dahdi.conf
- */
- unsigned int adsi:1;
- /*!
- * \brief TRUE if we can use a polarity reversal to mark when an outgoing
- * call is answered by the remote party.
- * \note Set from the "answeronpolarityswitch" value read in from chan_dahdi.conf
- */
- unsigned int answeronpolarityswitch:1;
- /*!
- * \brief TRUE if busy detection is enabled.
- * (Listens for the beep-beep busy pattern.)
- * \note Set from the "busydetect" value read in from chan_dahdi.conf
- */
- unsigned int busydetect:1;
- /*!
- * \brief TRUE if call return is enabled.
- * (*69, if your dialplan doesn't catch this first)
- * \note Set from the "callreturn" value read in from chan_dahdi.conf
- */
- unsigned int callreturn:1;
- /*!
- * \brief TRUE if busy extensions will hear the call-waiting tone
- * and can use hook-flash to switch between callers.
- * \note Can be disabled by dialing *70.
- * \note Initialized with the "callwaiting" value read in from chan_dahdi.conf
- */
- unsigned int callwaiting:1;
- /*!
- * \brief TRUE if send caller ID for Call Waiting
- * \note Set from the "callwaitingcallerid" value read in from chan_dahdi.conf
- */
- unsigned int callwaitingcallerid:1;
- /*!
- * \brief TRUE if support for call forwarding enabled.
- * Dial *72 to enable call forwarding.
- * Dial *73 to disable call forwarding.
- * \note Set from the "cancallforward" value read in from chan_dahdi.conf
- */
- unsigned int cancallforward:1;
- /*!
- * \brief TRUE if support for call parking is enabled.
- * \note Set from the "canpark" value read in from chan_dahdi.conf
- */
- unsigned int canpark:1;
- /*! \brief TRUE if to wait for a DTMF digit to confirm answer */
- unsigned int confirmanswer:1;
- /*!
- * \brief TRUE if the channel is to be destroyed on hangup.
- * (Used by pseudo channels.)
- */
- unsigned int destroy:1;
- unsigned int didtdd:1; /*!< flag to say its done it once */
- /*! \brief TRUE if analog type line dialed no digits in Dial() */
- unsigned int dialednone:1;
- /*!
- * \brief TRUE if in the process of dialing digits or sending something.
- * \note This is used as a receive squelch for ISDN until connected.
- */
- unsigned int dialing:1;
- /*! \brief TRUE if the transfer capability of the call is digital. */
- unsigned int digital:1;
- /*! \brief TRUE if Do-Not-Disturb is enabled, present only for non sig_analog */
- unsigned int dnd:1;
- /*! \brief XXX BOOLEAN Purpose??? */
- unsigned int echobreak:1;
- /*!
- * \brief TRUE if echo cancellation enabled when bridged.
- * \note Initialized with the "echocancelwhenbridged" value read in from chan_dahdi.conf
- * \note Disabled if the echo canceller is not setup.
- */
- unsigned int echocanbridged:1;
- /*! \brief TRUE if echo cancellation is turned on. */
- unsigned int echocanon:1;
- /*! \brief TRUE if a fax tone has already been handled. */
- unsigned int faxhandled:1;
- /*! TRUE if dynamic faxbuffers are configured for use, default is OFF */
- unsigned int usefaxbuffers:1;
- /*! TRUE while buffer configuration override is in use */
- unsigned int bufferoverrideinuse:1;
- /*! \brief TRUE if over a radio and dahdi_read() has been called. */
- unsigned int firstradio:1;
- /*!
- * \brief TRUE if the call will be considered "hung up" on a polarity reversal.
- * \note Set from the "hanguponpolarityswitch" value read in from chan_dahdi.conf
- */
- unsigned int hanguponpolarityswitch:1;
- /*! \brief TRUE if DTMF detection needs to be done by hardware. */
- unsigned int hardwaredtmf:1;
- /*!
- * \brief TRUE if the outgoing caller ID is blocked/hidden.
- * \note Caller ID can be disabled by dialing *67.
- * \note Caller ID can be enabled by dialing *82.
- * \note Initialized with the "hidecallerid" value read in from chan_dahdi.conf
- */
- unsigned int hidecallerid:1;
- /*!
- * \brief TRUE if hide just the name not the number for legacy PBX use.
- * \note Only applies to PRI channels.
- * \note Set from the "hidecalleridname" value read in from chan_dahdi.conf
- */
- unsigned int hidecalleridname:1;
- /*! \brief TRUE if DTMF detection is disabled. */
- unsigned int ignoredtmf:1;
- /*!
- * \brief TRUE if the channel should be answered immediately
- * without attempting to gather any digits.
- * \note Set from the "immediate" value read in from chan_dahdi.conf
- */
- unsigned int immediate:1;
- /*! \brief TRUE if in an alarm condition. */
- unsigned int inalarm:1;
- /*! \brief TRUE if TDD in MATE mode */
- unsigned int mate:1;
- /*! \brief TRUE if we originated the call leg. */
- unsigned int outgoing:1;
- /* unsigned int overlapdial:1; unused and potentially confusing */
- /*!
- * \brief TRUE if busy extensions will hear the call-waiting tone
- * and can use hook-flash to switch between callers.
- * \note Set from the "callwaiting" value read in from chan_dahdi.conf
- */
- unsigned int permcallwaiting:1;
- /*!
- * \brief TRUE if the outgoing caller ID is blocked/restricted/hidden.
- * \note Set from the "hidecallerid" value read in from chan_dahdi.conf
- */
- unsigned int permhidecallerid:1;
- /*!
- * \brief TRUE if PRI congestion/busy indications are sent out-of-band.
- * \note Set from the "priindication" value read in from chan_dahdi.conf
- */
- unsigned int priindication_oob:1;
- /*!
- * \brief TRUE if PRI B channels are always exclusively selected.
- * \note Set from the "priexclusive" value read in from chan_dahdi.conf
- */
- unsigned int priexclusive:1;
- /*!
- * \brief TRUE if we will pulse dial.
- * \note Set from the "pulsedial" value read in from chan_dahdi.conf
- */
- unsigned int pulse:1;
- /*! \brief TRUE if a pulsed digit was detected. (Pulse dial phone detected) */
- unsigned int pulsedial:1;
- unsigned int restartpending:1; /*!< flag to ensure counted only once for restart */
- /*!
- * \brief TRUE if caller ID is restricted.
- * \note Set but not used. Should be deleted. Redundant with permhidecallerid.
- * \note Set from the "restrictcid" value read in from chan_dahdi.conf
- */
- unsigned int restrictcid:1;
- /*!
- * \brief TRUE if three way calling is enabled
- * \note Set from the "threewaycalling" value read in from chan_dahdi.conf
- */
- unsigned int threewaycalling:1;
- /*!
- * \brief TRUE if call transfer is enabled
- * \note For FXS ports (either direct analog or over T1/E1):
- * Support flash-hook call transfer
- * \note For digital ports using ISDN PRI protocols:
- * Support switch-side transfer (called 2BCT, RLT or other names)
- * \note Set from the "transfer" value read in from chan_dahdi.conf
- */
- unsigned int transfer:1;
- /*!
- * \brief TRUE if caller ID is used on this channel.
- * \note PRI and SS7 spans will save caller ID from the networking peer.
- * \note FXS ports will generate the caller ID spill.
- * \note FXO ports will listen for the caller ID spill.
- * \note Set from the "usecallerid" value read in from chan_dahdi.conf
- */
- unsigned int use_callerid:1;
- /*!
- * \brief TRUE if we will use the calling presentation setting
- * from the Asterisk channel for outgoing calls.
- * \note Only applies to PRI and SS7 channels.
- * \note Set from the "usecallingpres" value read in from chan_dahdi.conf
- */
- unsigned int use_callingpres:1;
- /*!
- * \brief TRUE if distinctive rings are to be detected.
- * \note For FXO lines
- * \note Set indirectly from the "usedistinctiveringdetection" value read in from chan_dahdi.conf
- */
- unsigned int usedistinctiveringdetection:1;
- /*!
- * \brief TRUE if we should use the callerid from incoming call on dahdi transfer.
- * \note Set from the "useincomingcalleridondahditransfer" value read in from chan_dahdi.conf
- */
- unsigned int dahditrcallerid:1;
- /*!
- * \brief TRUE if allowed to flash-transfer to busy channels.
- * \note Set from the "transfertobusy" value read in from chan_dahdi.conf
- */
- unsigned int transfertobusy:1;
- /*!
- * \brief TRUE if the FXO port monitors for neon type MWI indications from the other end.
- * \note Set if the "mwimonitor" value read in contains "neon" from chan_dahdi.conf
- */
- unsigned int mwimonitor_neon:1;
- /*!
- * \brief TRUE if the FXO port monitors for fsk type MWI indications from the other end.
- * \note Set if the "mwimonitor" value read in contains "fsk" from chan_dahdi.conf
- */
- unsigned int mwimonitor_fsk:1;
- /*!
- * \brief TRUE if the FXO port monitors for rpas precursor to fsk MWI indications from the other end.
- * \note RPAS - Ring Pulse Alert Signal
- * \note Set if the "mwimonitor" value read in contains "rpas" from chan_dahdi.conf
- */
- unsigned int mwimonitor_rpas:1;
- /*! \brief TRUE if an MWI monitor thread is currently active */
- unsigned int mwimonitoractive:1;
- /*! \brief TRUE if a MWI message sending thread is active */
- unsigned int mwisendactive:1;
- /*!
- * \brief TRUE if channel is out of reset and ready
- * \note Used by SS7. Otherwise set but not used.
- */
- unsigned int inservice:1;
- /*!
- * \brief Bitmask for the channel being locally blocked.
- * \note Applies to SS7 and MFCR2 channels.
- * \note For MFCR2 only the first bit is used - TRUE if blocked
- * \note For SS7 two bits are used
- * \note Bit 0 - TRUE if maintenance blocked
- * \note Bit 1 - TRUE if hardware blocked
- */
- unsigned int locallyblocked:2;
- /*!
- * \brief Bitmask for the channel being remotely blocked. 1 maintenance, 2 blocked in hardware.
- * \note Applies to SS7 and MFCR2 channels.
- * \note For MFCR2 only the first bit is used - TRUE if blocked
- * \note For SS7 two bits are used
- * \note Bit 0 - TRUE if maintenance blocked
- * \note Bit 1 - TRUE if hardware blocked
- */
- unsigned int remotelyblocked:2;
- /*!
- * \brief TRUE if the channel alarms will be managed also as Span ones
- * \note Applies to all channels
- */
- unsigned int manages_span_alarms:1;
-
-#if defined(HAVE_PRI)
- struct sig_pri_span *pri;
- int logicalspan;
-#endif
- /*!
- * \brief TRUE if SMDI (Simplified Message Desk Interface) is enabled
- * \note Set from the "usesmdi" value read in from chan_dahdi.conf
- */
- unsigned int use_smdi:1;
- struct mwisend_info mwisend_data;
- /*! \brief The SMDI interface to get SMDI messages from. */
- struct ast_smdi_interface *smdi_iface;
-
- /*! \brief Distinctive Ring data */
- struct dahdi_distRings drings;
-
- /*!
- * \brief The configured context for incoming calls.
- * \note The "context" string read in from chan_dahdi.conf
- */
- char context[AST_MAX_CONTEXT];
- /*!
- * \brief A description for the channel configuration
- * \note The "description" string read in from chan_dahdi.conf
- */
- char description[32];
- /*!
- * \brief Saved context string.
- */
- char defcontext[AST_MAX_CONTEXT];
- /*! \brief Extension to use in the dialplan. */
- char exten[AST_MAX_EXTENSION];
- /*!
- * \brief Language configured for calls.
- * \note The "language" string read in from chan_dahdi.conf
- */
- char language[MAX_LANGUAGE];
- /*!
- * \brief The configured music-on-hold class to use for calls.
- * \note The "musicclass" or "mohinterpret" or "musiconhold" string read in from chan_dahdi.conf
- */
- char mohinterpret[MAX_MUSICCLASS];
- /*!
- * \brief Suggested music-on-hold class for peer channel to use for calls.
- * \note The "mohsuggest" string read in from chan_dahdi.conf
- */
- char mohsuggest[MAX_MUSICCLASS];
- char parkinglot[AST_MAX_EXTENSION]; /*!< Parking lot for this channel */
-#if defined(HAVE_PRI) || defined(HAVE_SS7)
- /*! \brief Automatic Number Identification number (Alternate PRI caller ID number) */
- char cid_ani[AST_MAX_EXTENSION];
-#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
- /*! \brief Automatic Number Identification code from PRI */
- int cid_ani2;
[... 4739 lines stripped ...]
More information about the svn-commits
mailing list