aboutsummaryrefslogtreecommitdiffstats
path: root/channels/misdn
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-14 17:01:48 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-14 17:01:48 +0000
commit682207e89720b041c91c7eaa8bde0b197662ed1e (patch)
treea78bbb66d6452319b9e79cff4da7f13e31abc763 /channels/misdn
parentc84930e93790ae6aa9b6fc3910402c342e024dee (diff)
Merged revisions 206487 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r206487 | rmudgett | 2009-07-14 11:44:47 -0500 (Tue, 14 Jul 2009) | 28 lines Fixes several call transfer issues with chan_misdn. * issue #14355 - Crash if attempt to transfer a call to an application. Masquerade the other pair of the four asterisk channels involved in the two calls. The held call already must be a bridged call (not an applicaton) or it would have been rejected. * issue #14692 - Held calls are not automatically cleared after transfer. Allow the core to initate disconnect of held calls to the ISDN port. This also fixes a similar case where the party on hold hangs up before being transferred or taken off hold. * JIRA ABE-1903 - Orphaned held calls left in music-on-hold. Do not simply block passing the hangup event on held calls to asterisk core. * Fixed to allow held calls to be transferred to ringing calls. Previously, held calls could only be transferred to connected calls. * Eliminated unused call states to simplify hangup code. * Eliminated most uses of "holded" because it is not a word. (closes issue #14355) (closes issue #14692) Reported by: sodom Patches: misdn_xfer_v14_r205839.patch uploaded by rmudgett (license 664) Tested by: rmudgett ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206489 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn')
-rw-r--r--channels/misdn/isdn_lib.c77
-rw-r--r--channels/misdn/isdn_lib.h3
2 files changed, 36 insertions, 44 deletions
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index 10590d64f..8cd2fd10f 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -240,8 +240,6 @@ struct misdn_bchannel *find_bc_by_l3id(struct misdn_stack *stack, unsigned long
struct misdn_bchannel *find_bc_by_confid(unsigned long confid);
-struct misdn_bchannel *stack_holder_find_bychan(struct misdn_stack *stack, int chan);
-
int setup_bc(struct misdn_bchannel *bc);
int manager_isdn_handler(iframe_t *frm ,msg_t *msg);
@@ -3208,13 +3206,6 @@ void te_lib_destroy(int midev)
cb_log(4, 0, "midev closed\n");
}
-
-
-void misdn_lib_transfer(struct misdn_bchannel* holded_bc)
-{
- holded_bc->holded=0;
-}
-
struct misdn_bchannel *manager_find_bc_by_pid(int pid)
{
struct misdn_stack *stack;
@@ -3594,7 +3585,7 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
{
msg_t *msg;
struct misdn_bchannel *bc2;
- struct misdn_bchannel *holded_bc;
+ struct misdn_bchannel *held_bc;
struct misdn_stack *stack;
int retval = 0;
int channel;
@@ -3705,20 +3696,22 @@ int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event )
break;
case EVENT_HOLD_ACKNOWLEDGE:
- holded_bc = malloc(sizeof(struct misdn_bchannel));
- if (!holded_bc) {
- cb_log(0,bc->port, "Could not allocate holded_bc!!!\n");
+ held_bc = malloc(sizeof(struct misdn_bchannel));
+ if (!held_bc) {
+ cb_log(0, bc->port, "Could not allocate held_bc!!!\n");
RETURN(-1,OUT);
}
- /*backup the bc*/
- memcpy(holded_bc,bc,sizeof(struct misdn_bchannel));
- holded_bc->holded=1;
- bc_state_change(holded_bc,BCHAN_CLEANED);
-
- stack_holder_add(stack,holded_bc);
+ /* backup the bc and put it in storage */
+ *held_bc = *bc;
+ held_bc->holded = 1;
+ held_bc->channel = 0;/* A held call does not have a channel anymore. */
+ held_bc->channel_preselected = 0;
+ held_bc->channel_found = 0;
+ bc_state_change(held_bc, BCHAN_CLEANED);
+ stack_holder_add(stack, held_bc);
- /*kill the bridge and clean the bchannel*/
+ /* kill the bridge and clean the real b-channel record */
if (stack->nt) {
if (bc->bc_state == BCHAN_BRIDGED) {
misdn_split_conf(bc,bc->conf_id);
@@ -4681,28 +4674,6 @@ void stack_holder_remove(struct misdn_stack *stack, struct misdn_bchannel *holde
}
}
-struct misdn_bchannel *stack_holder_find_bychan(struct misdn_stack *stack, int chan)
-{
- struct misdn_bchannel *help;
-
- cb_log(4,stack?stack->port:0, "*HOLDER: find_bychan %c\n", chan);
-
- if (!stack) return NULL;
-
- for (help=stack->holding;
- help;
- help=help->next) {
- if (help->channel == chan) {
- cb_log(4,stack->port, "*HOLDER: found_bychan bc\n");
- return help;
- }
- }
-
- cb_log(4,stack->port, "*HOLDER: find_bychan nothing\n");
- return NULL;
-
-}
-
struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned long l3id)
{
struct misdn_bchannel *help;
@@ -4724,7 +4695,29 @@ struct misdn_bchannel *stack_holder_find(struct misdn_stack *stack, unsigned lon
return NULL;
}
+/*!
+ * \brief Find a held call's B channel record.
+ *
+ * \param port Port the call is on.
+ * \param l3_id mISDN Layer 3 ID of held call.
+ *
+ * \return Found bc-record or NULL.
+ */
+struct misdn_bchannel *misdn_lib_find_held_bc(int port, int l3_id)
+{
+ struct misdn_bchannel *bc;
+ struct misdn_stack *stack;
+
+ bc = NULL;
+ for (stack = get_misdn_stack(); stack; stack = stack->next) {
+ if (stack->port == port) {
+ bc = stack_holder_find(stack, l3_id);
+ break;
+ }
+ }
+ return bc;
+}
void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone)
{
diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h
index 934be9830..89565327e 100644
--- a/channels/misdn/isdn_lib.h
+++ b/channels/misdn/isdn_lib.h
@@ -753,8 +753,6 @@ void misdn_lib_log_ies(struct misdn_bchannel *bc);
char *manager_isdn_get_info(enum event_e event);
-void misdn_lib_transfer(struct misdn_bchannel* holded_bc);
-
struct misdn_bchannel* misdn_lib_get_free_bc(int port, int channel, int inout, int dec);
#if defined(AST_MISDN_ENHANCEMENTS)
struct misdn_bchannel *misdn_lib_get_register_bc(int port);
@@ -793,6 +791,7 @@ int misdn_lib_get_port_up (int port) ;
int misdn_lib_maxports_get(void) ;
+struct misdn_bchannel *misdn_lib_find_held_bc(int port, int l3_id);
void misdn_lib_release(struct misdn_bchannel *bc);
int misdn_cap_is_speech(int cap);