Add limited overlap sending for PRI, eg: exten => 9,1,Dial,Zap/g1/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Martin Pycko 22 years ago
parent 54d3735b7b
commit 697c33c81d

@ -671,17 +671,20 @@ static int zt_digit(struct ast_channel *ast, char digit)
int res = 0; int res = 0;
int index; int index;
p = ast->pvt->pvt; p = ast->pvt->pvt;
index = zt_get_index(ast, p, 0); index = zt_get_index(ast, p, 0);
if (index == SUB_REAL) { if (index == SUB_REAL) {
zo.op = ZT_DIAL_OP_APPEND; if (p->sig == SIG_PRI && ast->_state == AST_STATE_DIALING) {
zo.dialstr[0] = 'T'; pri_information(p->pri->pri,p->call,digit);
zo.dialstr[1] = digit; } else {
zo.dialstr[2] = 0; zo.op = ZT_DIAL_OP_APPEND;
if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &zo))) zo.dialstr[0] = 'T';
ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit); zo.dialstr[1] = digit;
else zo.dialstr[2] = 0;
p->dialing = 1; if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &zo)))
ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit);
else
p->dialing = 1;
}
} }
return res; return res;
@ -5473,24 +5476,26 @@ static void *pri_dchannel(void *vpri)
case PRI_EVENT_INFO_RECEIVED: case PRI_EVENT_INFO_RECEIVED:
case PRI_EVENT_RING: case PRI_EVENT_RING:
chan = e->ring.channel; chan = e->ring.channel;
if ((chan < 1) || (chan > pri->channels)) { if (e->e==PRI_EVENT_RING) {
ast_log(LOG_WARNING, "Ring requested on odd channel number %d span %d\n", chan, pri->span); if ((chan < 1) || (chan > pri->channels)) {
chan = 0; ast_log(LOG_WARNING, "Ring requested on odd channel number %d span %d\n", chan, pri->span);
} else if (!pri->pvt[chan]) { chan = 0;
ast_log(LOG_WARNING, "Ring requested on unconfigured channel %d span %d\n", chan, pri->span); } else if (!pri->pvt[chan]) {
chan = 0; ast_log(LOG_WARNING, "Ring requested on unconfigured channel %d span %d\n", chan, pri->span);
} else if (pri->pvt[chan]->owner) {
if (pri->pvt[chan]->call == e->ring.call) {
ast_log(LOG_WARNING, "Duplicate setup requested on channel %d already in use on span %d\n", chan, pri->span);
break;
} else {
ast_log(LOG_WARNING, "Ring requested on channel %d already in use on span %d. Hanging up owner.\n", chan, pri->span);
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
chan = 0; chan = 0;
} else if (pri->pvt[chan]->owner) {
if (pri->pvt[chan]->call == e->ring.call) {
ast_log(LOG_WARNING, "Duplicate setup requested on channel %d already in use on span %d\n", chan, pri->span);
break;
} else {
ast_log(LOG_WARNING, "Ring requested on channel %d already in use on span %d. Hanging up owner.\n", chan, pri->span);
pri->pvt[chan]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
chan = 0;
}
} }
if (!chan && (e->ring.flexible))
chan = pri_find_empty_chan(pri);
} }
if (!chan && (e->ring.flexible))
chan = pri_find_empty_chan(pri);
if (chan) { if (chan) {
if (e->e==PRI_EVENT_RING) { if (e->e==PRI_EVENT_RING) {
/* Get caller ID */ /* Get caller ID */
@ -5506,10 +5511,15 @@ static void *pri_dchannel(void *vpri)
/* Get called number */ /* Get called number */
if (strlen(e->ring.callednum)) { if (strlen(e->ring.callednum)) {
strncpy(pri->pvt[chan]->exten, e->ring.callednum, sizeof(pri->pvt[chan]->exten)-1); strncpy(pri->pvt[chan]->exten, e->ring.callednum, sizeof(pri->pvt[chan]->exten)-1);
} else }
#if 0
else
strcpy(pri->pvt[chan]->exten, "s"); strcpy(pri->pvt[chan]->exten, "s");
#endif
else
strcpy(pri->pvt[chan]->exten, "");
/* Make sure extension exists */ /* Make sure extension exists */
if (ast_exists_extension(NULL, pri->pvt[chan]->context, pri->pvt[chan]->exten, 1, pri->pvt[chan]->callerid)) { if (strlen(pri->pvt[chan]->exten) && ast_exists_extension(NULL, pri->pvt[chan]->context, pri->pvt[chan]->exten, 1, pri->pvt[chan]->callerid)) {
/* Setup law */ /* Setup law */
int law; int law;
if (e->ring.layer1 == PRI_LAYER_1_ALAW) if (e->ring.layer1 == PRI_LAYER_1_ALAW)
@ -5537,7 +5547,7 @@ static void *pri_dchannel(void *vpri)
pri->pvt[chan]->call = 0; pri->pvt[chan]->call = 0;
} }
} else { } else {
if (ast_matchmore_extension(NULL, pri->pvt[chan]->context, pri->pvt[chan]->exten, 1, pri->pvt[chan]->callerid)) if (!strlen(pri->pvt[chan]->exten) || ast_matchmore_extension(NULL, pri->pvt[chan]->context, pri->pvt[chan]->exten, 1, pri->pvt[chan]->callerid))
{ {
if (e->e==PRI_EVENT_RING) pri_need_more_info(pri->pri, e->ring.call, chan, 1); if (e->e==PRI_EVENT_RING) pri_need_more_info(pri->pri, e->ring.call, chan, 1);
} else { } else {

Loading…
Cancel
Save