summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorAlec L Davis <sivad.a@paradise.net.nz>2010-07-22 23:14:50 +0000
committerAlec L Davis <sivad.a@paradise.net.nz>2010-07-22 23:14:50 +0000
commit85bfe38f2f7a22e7ff300efbe48a1b658896866c (patch)
tree46a9b237320ec45b34bbc4c57965d79679fb8688 /channels/chan_dahdi.c
parentab0b255455bcd8ccd78de24d61be8b1b1cf2f44d (diff)
Support FXS module Polarity Reversal on remote party Answer and Hangup
FXS lines normally connect to a telephone. However, when FXS lines are routed to an external PBX or Key System to act as "external" or "CO" lines, it is extremely difficult, if not impossible for the external PBX to know when the call has been disconnected without receiving a polarity reversal on the line. Now using answeronpolarityswitch and hanguponpolarityswitch keywords that previously were used only for FXO ports, now applies like functionality for an FXS port, but from the connected equipment's point of view. (closes issue #17318) Reported by: armeniki Patches: fxs_linepolarity.diff5.txt uploaded by alecdavis (license 585) Tested by: alecdavis Review: https://reviewboard.asterisk.org/r/797/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278809 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 85855e6a4..d2a567135 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -2737,6 +2737,52 @@ static void my_set_needringing(void *pvt, int value)
p->subs[SUB_REAL].needringing = value;
}
+static void my_set_polarity(void *pvt, int value)
+{
+ struct dahdi_pvt *p = pvt;
+
+ if (p->channel == CHAN_PSEUDO) {
+ return;
+ }
+ p->polarity = value;
+ ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETPOLARITY, &value);
+}
+
+static void my_start_polarityswitch(void *pvt)
+{
+ struct dahdi_pvt *p = pvt;
+
+ if (p->answeronpolarityswitch || p->hanguponpolarityswitch) {
+ my_set_polarity(pvt, 0);
+ }
+}
+
+static void my_answer_polarityswitch(void *pvt)
+{
+ struct dahdi_pvt *p = pvt;
+
+ if (!p->answeronpolarityswitch) {
+ return;
+ }
+
+ my_set_polarity(pvt, 1);
+}
+
+static void my_hangup_polarityswitch(void *pvt)
+{
+ struct dahdi_pvt *p = pvt;
+
+ if (!p->hanguponpolarityswitch) {
+ return;
+ }
+
+ if (p->answeronpolarityswitch) {
+ my_set_polarity(pvt, 0);
+ } else {
+ my_set_polarity(pvt, 1);
+ }
+}
+
static int my_start(void *pvt)
{
struct dahdi_pvt *p = pvt;
@@ -3454,6 +3500,10 @@ static struct analog_callback dahdi_analog_callbacks =
.set_pulsedial = my_set_pulsedial,
.get_orig_dialstring = my_get_orig_dialstring,
.set_needringing = my_set_needringing,
+ .set_polarity = my_set_polarity,
+ .start_polarityswitch = my_start_polarityswitch,
+ .answer_polarityswitch = my_answer_polarityswitch,
+ .hangup_polarityswitch = my_hangup_polarityswitch,
};
/*! Round robin search locations. */