[svn-commits] wedhorn: trunk r316994 - /trunk/channels/chan_skinny.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu May 5 03:10:18 CDT 2011
Author: wedhorn
Date: Thu May 5 03:10:14 2011
New Revision: 316994
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316994
Log:
Add setsubstate_busy.
Move handling of setting busy state from skinny_indicate to it's own sub.
Also, modified behaviour to not hangup the sub and let the dialplan
have a chance in doing what it wants (eg busy(10); hangup() in the dialplan
now gives a busy indication for 10 secs and then hangs up.
Modified:
trunk/channels/chan_skinny.c
Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=316994&r1=316993&r2=316994
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Thu May 5 03:10:14 2011
@@ -1189,6 +1189,7 @@
#define SUBSTATE_RINGOUT 3
#define SUBSTATE_RINGIN 4
#define SUBSTATE_CONNECTED 5
+#define SUBSTATE_BUSY 6
#define SUBSTATE_DIALING 101
struct skinny_subchannel {
@@ -1415,6 +1416,7 @@
static void setsubstate_ringin(struct skinny_subchannel *sub);
static void setsubstate_ringout(struct skinny_subchannel *sub);
static void setsubstate_connected(struct skinny_subchannel *sub);
+static void setsubstate_busy(struct skinny_subchannel *sub);
static struct ast_channel_tech skinny_tech = {
.type = "Skinny",
@@ -4498,23 +4500,10 @@
break;
}
setsubstate_ringout(sub);
- if (!d->earlyrtp) {
- break;
- }
- return -1; /* Tell asterisk to provide inband signalling */
+ return (d->earlyrtp ? -1 : 0); /* Tell asterisk to provide inband signalling if rtp started */
case AST_CONTROL_BUSY:
- if (ast->_state != AST_STATE_UP) {
- if (!d->earlyrtp) {
- transmit_start_tone(d, SKINNY_BUSYTONE, l->instance, sub->callid);
- }
- transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_BUSY);
- sub->alreadygone = 1;
- ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
- if (!d->earlyrtp) {
- break;
- }
- }
- return -1; /* Tell asterisk to provide inband signalling */
+ setsubstate_busy(sub);
+ return (d->earlyrtp ? -1 : 0); /* Tell asterisk to provide inband signalling if rtp started */
case AST_CONTROL_CONGESTION:
if (ast->_state != AST_STATE_UP) {
if (!d->earlyrtp) {
@@ -4837,6 +4826,25 @@
}
sub->substate = SUBSTATE_CONNECTED;
l->activesub = sub;
+}
+
+static void setsubstate_busy(struct skinny_subchannel *sub)
+{
+ struct skinny_line *l = sub->parent;
+ struct skinny_device *d = l->device;
+
+ if (sub->substate != SUBSTATE_DIALING) {
+ ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_BUSY from %s (on call-%d)\n", substate2str(sub->substate), sub->callid);
+ return;
+ }
+
+ if (!d->earlyrtp) {
+ transmit_start_tone(d, SKINNY_BUSYTONE, l->instance, sub->callid);
+ }
+ transmit_callinfo(sub);
+ transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_BUSY);
+ transmit_displaypromptstatus(d, "Busy", 0, l->instance, sub->callid);
+ sub->substate = SUBSTATE_BUSY;
}
static int skinny_hold(struct skinny_subchannel *sub)
More information about the svn-commits
mailing list