aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-13 21:42:33 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-13 21:42:33 +0000
commitefde89dea60efe85915c27c067e4af39edbbbf56 (patch)
treeffa1ad5623180021c298abe1c4478b44d8ac26b7 /channels/chan_zap.c
parent0345153cc77f381b04c79b057da9fcf9e8fb6a1e (diff)
Merged revisions 92815 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r92815 | tilghman | 2007-12-13 15:28:39 -0600 (Thu, 13 Dec 2007) | 5 lines Properly initialize polarity statuses, so that they are detected properly. Reported by: julianjm Patch by: julianjm (Closes issue #10238) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@92816 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 231cd6fbd..6574bff15 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -4282,6 +4282,11 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
ast_setstate(ast, AST_STATE_UP);
p->subs[index].f.frametype = AST_FRAME_CONTROL;
p->subs[index].f.subclass = AST_CONTROL_ANSWER;
+ /* If aops=0 and hops=1, this is necessary */
+ p->polarity = POLARITY_REV;
+ } else {
+ /* Start clean, so we can catch the change to REV polarity when party answers */
+ p->polarity = POLARITY_IDLE;
}
}
}
@@ -6933,6 +6938,14 @@ static void *ss_thread(void *data)
if (i & ZT_IOMUX_SIGEVENT) {
res = zt_get_event(p->subs[index].zfd);
ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
+ /* If we get a PR event, they hung up while processing calerid */
+ if ( res == ZT_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
+ ast_log(LOG_DEBUG, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
+ p->polarity = POLARITY_IDLE;
+ callerid_free(cs);
+ ast_hangup(chan);
+ return NULL;
+ }
res = 0;
/* Let us detect callerid when the telco uses distinctive ring */
@@ -7305,6 +7318,12 @@ static int handle_init_event(struct zt_pvt *i, int event)
case SIG_FXSLS:
case SIG_FXSKS:
case SIG_FXSGS:
+ /* We have already got a PR before the channel was
+ created, but it wasn't handled. We need polarity
+ to be REV for remote hangup detection to work.
+ At least in Spain */
+ if (i->hanguponpolarityswitch)
+ i->polarity = POLARITY_REV;
if (i->cid_start == CID_START_POLARITY || i->cid_start == CID_START_POLARITY_IN) {
i->polarity = POLARITY_REV;
ast_verb(2, "Starting post polarity "