[asterisk-commits] mmichelson: branch mmichelson/atxfer_features r393196 - /team/mmichelson/atxf...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 28 14:22:17 CDT 2013
Author: mmichelson
Date: Fri Jun 28 14:22:15 2013
New Revision: 393196
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393196
Log:
Adjust the state machine to make more sense with the new superstates.
Once in the recalling superstate, there is no such thing as a transferer
or transfer target. Intead, the party being recalled is always the recall
target, no matter the party's original role in the transfer. I've created
two new stimuli for this and gotten rid of the transferer answer stimulus
since that no longer makes sense.
Testing shows things to still work correctly.
Modified:
team/mmichelson/atxfer_features/main/bridging_basic.c
Modified: team/mmichelson/atxfer_features/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/bridging_basic.c?view=diff&rev=393196&r1=393195&r2=393196
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Fri Jun 28 14:22:15 2013
@@ -366,9 +366,10 @@
STIMULUS_NONE,
STIMULUS_TRANSFEREE_HANGUP,
STIMULUS_TRANSFERER_HANGUP,
- STIMULUS_TARGET_HANGUP,
- STIMULUS_TRANSFERER_ANSWER,
- STIMULUS_TARGET_ANSWER,
+ STIMULUS_TRANSFER_TARGET_HANGUP,
+ STIMULUS_TRANSFER_TARGET_ANSWER,
+ STIMULUS_RECALL_TARGET_HANGUP,
+ STIMULUS_RECALL_TARGET_ANSWER,
STIMULUS_TIMEOUT,
STIMULUS_DTMF_ATXFER_ABORT,
STIMULUS_DTMF_ATXFER_COMPLETE,
@@ -380,9 +381,10 @@
[STIMULUS_NONE] = "None",
[STIMULUS_TRANSFEREE_HANGUP] = "Transferee Hangup",
[STIMULUS_TRANSFERER_HANGUP] = "Transferer Hangup",
- [STIMULUS_TARGET_HANGUP] = "Transfer Target Hangup",
- [STIMULUS_TRANSFERER_ANSWER] = "Transferer Answer",
- [STIMULUS_TARGET_ANSWER] = "Transfer Target Answer",
+ [STIMULUS_TRANSFER_TARGET_HANGUP] = "Transfer Target Hangup",
+ [STIMULUS_TRANSFER_TARGET_ANSWER] = "Transfer Target Answer",
+ [STIMULUS_RECALL_TARGET_HANGUP] = "Recall Target Hangup",
+ [STIMULUS_RECALL_TARGET_ANSWER] = "Recall Target Answer",
[STIMULUS_TIMEOUT] = "Timeout",
[STIMULUS_DTMF_ATXFER_ABORT] = "DTMF Abort",
[STIMULUS_DTMF_ATXFER_COMPLETE] = "DTMF Complete",
@@ -648,7 +650,8 @@
switch (stimulus) {
default:
case STIMULUS_NONE:
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_RECALL_TARGET_ANSWER:
+ case STIMULUS_RECALL_TARGET_HANGUP:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
return TRANSFER_FAIL;
@@ -656,9 +659,9 @@
case STIMULUS_TRANSFERER_HANGUP:
bridge_unhold(props->transferee_bridge);
return props->atxferdropcall ? TRANSFER_BLOND : TRANSFER_BLOND_NONFINAL;
- case STIMULUS_TARGET_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
return TRANSFER_CONSULTING;
- case STIMULUS_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
case STIMULUS_TIMEOUT:
case STIMULUS_DTMF_ATXFER_ABORT:
return TRANSFER_REBRIDGE;
@@ -686,7 +689,8 @@
switch (stimulus) {
default:
case STIMULUS_NONE:
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_RECALL_TARGET_HANGUP:
+ case STIMULUS_RECALL_TARGET_ANSWER:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
/* We soft hangup the transferer to prevent him from sitting in
@@ -697,9 +701,9 @@
case STIMULUS_DTMF_ATXFER_COMPLETE:
case STIMULUS_TRANSFERER_HANGUP:
return props->atxferdropcall ? TRANSFER_BLOND : TRANSFER_BLOND_NONFINAL;
- case STIMULUS_TARGET_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
return TRANSFER_CONSULTING;
- case STIMULUS_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
case STIMULUS_TIMEOUT:
case STIMULUS_DTMF_ATXFER_ABORT:
return TRANSFER_RESUME;
@@ -762,8 +766,9 @@
default:
case STIMULUS_NONE:
case STIMULUS_TIMEOUT:
- case STIMULUS_TARGET_ANSWER:
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
+ case STIMULUS_RECALL_TARGET_HANGUP:
+ case STIMULUS_RECALL_TARGET_ANSWER:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
/* XXX I have absolutely no idea how to handle this case */
@@ -773,7 +778,7 @@
/* We know the transferer is in the target_bridge, so take the other bridge off hold */
bridge_unhold(props->transferee_bridge);
return TRANSFER_COMPLETE;
- case STIMULUS_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
case STIMULUS_DTMF_ATXFER_ABORT:
return TRANSFER_REBRIDGE;
case STIMULUS_DTMF_ATXFER_THREEWAY:
@@ -812,8 +817,9 @@
default:
case STIMULUS_NONE:
case STIMULUS_TIMEOUT:
- case STIMULUS_TARGET_ANSWER:
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
+ case STIMULUS_RECALL_TARGET_HANGUP:
+ case STIMULUS_RECALL_TARGET_ANSWER:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
/* We soft hangup the transferer to prevent him from sitting in
@@ -826,7 +832,7 @@
/* We know the transferer is in the transferee, so take the other bridge off hold */
bridge_unhold(props->target_bridge);
return TRANSFER_COMPLETE;
- case STIMULUS_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
case STIMULUS_DTMF_ATXFER_ABORT:
return TRANSFER_RESUME;
case STIMULUS_DTMF_ATXFER_THREEWAY:
@@ -868,15 +874,16 @@
case STIMULUS_DTMF_ATXFER_THREEWAY:
case STIMULUS_DTMF_ATXFER_SWAP:
case STIMULUS_TRANSFERER_HANGUP:
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
return TRANSFER_FAIL;
- case STIMULUS_TARGET_ANSWER:
+ case STIMULUS_RECALL_TARGET_ANSWER:
return TRANSFER_RESUME;
case STIMULUS_TIMEOUT:
ast_softhangup(props->transfer_target, AST_SOFTHANGUP_EXPLICIT);
- case STIMULUS_TARGET_HANGUP:
+ case STIMULUS_RECALL_TARGET_HANGUP:
return TRANSFER_RECALLING;
}
}
@@ -899,7 +906,6 @@
* and then call out to it. When recalling the transferer, though, we
* have to use the dialing API because the channel is not local.
*/
-
props->dial = ast_dial_create();
if (!props->dial) {
return -1;
@@ -941,19 +947,20 @@
case STIMULUS_DTMF_ATXFER_COMPLETE:
case STIMULUS_DTMF_ATXFER_THREEWAY:
case STIMULUS_DTMF_ATXFER_SWAP:
- case STIMULUS_TARGET_HANGUP:
- case STIMULUS_TARGET_ANSWER:
+ case STIMULUS_TRANSFER_TARGET_HANGUP:
+ case STIMULUS_TRANSFER_TARGET_ANSWER:
+ case STIMULUS_TRANSFERER_HANGUP:
ast_assert(0);
case STIMULUS_TRANSFEREE_HANGUP:
return TRANSFER_FAIL;
case STIMULUS_TIMEOUT:
- case STIMULUS_TRANSFERER_HANGUP:
+ case STIMULUS_RECALL_TARGET_HANGUP:
++props->retry_attempts;
if (props->retry_attempts >= props->atxfercallbackretries) {
return TRANSFER_FAIL;
}
return TRANSFER_RETRANSFER;
- case STIMULUS_TRANSFERER_ANSWER:
+ case STIMULUS_RECALL_TARGET_ANSWER:
ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL, 1);
return TRANSFER_RESUME;
}
@@ -1135,7 +1142,7 @@
if (event == AST_FRAMEHOOK_EVENT_READ &&
frame && frame->frametype == AST_FRAME_CONTROL &&
frame->subclass.integer == AST_CONTROL_ANSWER) {
- stimulate_attended_transfer(props, STIMULUS_TARGET_ANSWER);
+ stimulate_attended_transfer(props, STIMULUS_TRANSFER_TARGET_ANSWER);
ast_framehook_detach(chan, props->target_framehook_id);
props->target_framehook_id = -1;
}
@@ -1161,7 +1168,7 @@
case AST_DIAL_RESULT_HANGUP:
case AST_DIAL_RESULT_UNANSWERED:
/* Failure cases */
- stimulate_attended_transfer(props, STIMULUS_TRANSFERER_HANGUP);
+ stimulate_attended_transfer(props, STIMULUS_RECALL_TARGET_HANGUP);
ao2_ref(props, -1);
break;
case AST_DIAL_RESULT_RINGING:
@@ -1177,7 +1184,7 @@
* steal a reference
*/
ast_channel_ref(props->recall_target);
- stimulate_attended_transfer(props, STIMULUS_TRANSFERER_ANSWER);
+ stimulate_attended_transfer(props, STIMULUS_RECALL_TARGET_ANSWER);
ao2_ref(props, -1);
break;
}
@@ -1261,7 +1268,7 @@
if (self == props->transferee_bridge) {
stimulate_attended_transfer(props, STIMULUS_TRANSFEREE_HANGUP);
} else {
- stimulate_attended_transfer(props, STIMULUS_TARGET_HANGUP);
+ stimulate_attended_transfer(props, STIMULUS_TRANSFER_TARGET_HANGUP);
}
}
@@ -1273,7 +1280,7 @@
}
if (bridge_channel->chan == props->recall_target) {
- stimulate_attended_transfer(props, STIMULUS_TARGET_HANGUP);
+ stimulate_attended_transfer(props, STIMULUS_RECALL_TARGET_HANGUP);
return;
}
More information about the asterisk-commits
mailing list