[asterisk-commits] moy: branch moy/dahdi-advanced-tap-1.6.2 r220579 - /team/moy/dahdi-advanced-t...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 25 18:18:47 CDT 2009
Author: moy
Date: Fri Sep 25 18:18:42 2009
New Revision: 220579
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=220579
Log:
fixes here and there
Modified:
team/moy/dahdi-advanced-tap-1.6.2/channels/chan_dahdi.c
Modified: team/moy/dahdi-advanced-tap-1.6.2/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/dahdi-advanced-tap-1.6.2/channels/chan_dahdi.c?view=diff&rev=220579&r1=220578&r2=220579
==============================================================================
--- team/moy/dahdi-advanced-tap-1.6.2/channels/chan_dahdi.c (original)
+++ team/moy/dahdi-advanced-tap-1.6.2/channels/chan_dahdi.c Fri Sep 25 18:18:42 2009
@@ -6934,11 +6934,12 @@
ast_mutex_unlock(&p->lock); \
return f; \
}
-
if (p->passivefd == -1) {
+ /* do normal reading */
res = read(p->subs[idx].dfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
} else {
- /* first read from the 2 involved dahdi channels */
+ /* passive channel reading */
+ /* first read from the 2 involved dahdi channels just to consume their frames */
res = read(p->subs[idx].dfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
CHECK_READ_RESULT(res);
res = read(p->passivepeer->subs[idx].dfd, readbuf, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
@@ -12547,7 +12548,7 @@
/* create the actual ast_channel but dont start a pbx just yet */
law = layer1 == PRI_LAYER_1_ULAW ? DAHDI_LAW_MULAW : DAHDI_LAW_ALAW;
- c = dahdi_new(pri->pvts[chanpos], AST_STATE_RINGING, 0, SUB_REAL, law, AST_TRANS_CAP_SPEECH);
+ c = dahdi_new(pri->pvts[chanpos], AST_STATE_RING, 0, SUB_REAL, law, AST_TRANS_CAP_SPEECH);
if (!c) {
ast_log(LOG_ERROR, "Failed to create channel for call on channel %d/%d on span %d\n",
PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
@@ -12600,6 +12601,7 @@
/* TODO: what about setting DAHDI_POLICY_IMMEDIATE and buf size? DAHDI_SETLINEAR?? */
if (fd < 0 || ioctl(fd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_ERROR, "Unable to create dahdi conference for tapping\n");
+ ast_hangup(c);
break;
}
pri->pvts[chanpos]->passiveconf = dahdic.confno;
@@ -12611,6 +12613,7 @@
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
if (ioctl(pri->pvts[chanpos]->subs[SUB_REAL].dfd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_ERROR, "Unable to add chan to conference for tapping devices: %s\n", strerror(errno));
+ ast_hangup(c);
break;
}
dahdic.chan = 0;
@@ -12618,6 +12621,7 @@
dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER;
if (ioctl(peerpri->pvts[chanpos]->subs[SUB_REAL].dfd, DAHDI_SETCONF, &dahdic)) {
ast_log(LOG_ERROR, "Unable to add peer chan to conference for tapping devices: %s\n", strerror(errno));
+ ast_hangup(c);
break;
}
ast_log(LOG_DEBUG, "Created conference %d with fd %d between dahdi chans %d and %d for ast channel %s\n",
@@ -12628,17 +12632,6 @@
c->name);
/* from now on, reading from the conference has the mix of both tapped channels, we can now launch the pbx thread */
- law = 1;
- pri->pvts[chanpos]->subs[SUB_REAL].linear = 1;
- peerpri->pvts[peerpos]->subs[SUB_REAL].linear = 1;
- dahdi_setlinear(pri->pvts[chanpos]->subs[SUB_REAL].dfd, law);
- dahdi_setlinear(pri->pvts[chanpos]->passivefd, law);
- dahdi_setlinear(peerpri->pvts[peerpos]->subs[SUB_REAL].dfd, law);
- c->rawreadformat = AST_FORMAT_SLINEAR;
- c->nativeformats = AST_FORMAT_SLINEAR;
- if (ast_set_read_format(c, AST_FORMAT_SLINEAR)) {
- ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", c->name);
- }
if (ast_pbx_start(c) != AST_PBX_SUCCESS) {
ast_log(LOG_ERROR, "Failed to launch PBX thread for passive channel %s\n", c->name);
ast_hangup(c);
@@ -12665,7 +12658,11 @@
/* set the owner state as UP */
c = pri->pvts[chanpos]->owner;
- ast_setstate(c, AST_STATE_UP);
+ ast_channel_lock(c);
+ if (c->_state == AST_STATE_RING) {
+ ast_setstate(c, AST_STATE_UP);
+ }
+ ast_channel_unlock(c);
break;
case PRI_EVENT_HANGUP:
@@ -12708,7 +12705,7 @@
case PRI_EVENT_HANGUP_ACK:
- ast_log(LOG_NOTICE, "Hangup ack on channel %d of span %d\n", e->hangup.channel, pri->span);
+ ast_log(LOG_DEBUG, "Hangup ack on channel %d of span %d\n", e->hangup.channel, pri->span);
/* put back the passive call slot, if any was used */
pri_put_pcall(pri, e->hangup.call);
break;
More information about the asterisk-commits
mailing list