Review Board 1.7.16


Dahdi FXS line polarity reversal when remote party Answers and/or Hangups

Review Request #797 - Created July 22, 2010 and submitted

Alec Davis
trunk
17318
Reviewers
asterisk-dev
Asterisk
Quoting armeniki:
"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."

Implementation was to use existing keywords as used for FXO modules 'answeronpolityswitch' and 'hanguponpolarityswitch', with a similar function for the FXS module but from the Legacy PBX's point of view.
Using TDM800P FXS modules:

Inbound and outbound calls, using answeronpolarityswitch and hanguponpolarityswitch 

Diff revision 3

This is not the most recent revision of the diff. The latest diff is revision 5. See what's changed.

1 2 3 4 5
1 2 3 4 5

  1. trunk/channels/chan_dahdi.c: Loading...
  2. trunk/channels/sig_analog.h: Loading...
  3. trunk/channels/sig_analog.c: Loading...
trunk/channels/chan_dahdi.c
Revision 278424 New Change
[20] 2741 lines
[+20] [+] static int my_off_hook(void *pvt)
2742
{
2742
{
2743
	struct dahdi_pvt *p = pvt;
2743
	struct dahdi_pvt *p = pvt;
2744
	p->subs[SUB_REAL].needringing = value;
2744
	p->subs[SUB_REAL].needringing = value;
2745
}
2745
}
2746

    
   
2746

   

    
   
2747
static void my_set_polarity(void *pvt, int value)

    
   
2748
{

    
   
2749
	struct dahdi_pvt *p = pvt;

    
   
2750
	int res;

    
   
2751

   

    
   
2752
	if (p->channel == CHAN_PSEUDO)

    
   
2753
		return;

    
   
2754
	p->polarity = value;

    
   
2755
	res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETPOLARITY, &value);

    
   
2756
}

    
   
2757

   

    
   
2758
static void my_start_polarityswitch(void *pvt)

    
   
2759
{

    
   
2760
	struct dahdi_pvt *p = pvt;

    
   
2761

   

    
   
2762
	if (p->answeronpolarityswitch || p->hanguponpolarityswitch) {

    
   
2763
		my_set_polarity(pvt, 0);

    
   
2764
	}

    
   
2765
}

    
   
2766

   

    
   
2767
static void my_answer_polarityswitch(void *pvt)

    
   
2768
{

    
   
2769
	struct dahdi_pvt *p = pvt;

    
   
2770

   

    
   
2771
	if (!p->answeronpolarityswitch) {

    
   
2772
		return;

    
   
2773
	}

    
   
2774

   

    
   
2775
	my_set_polarity(pvt, 1);

    
   
2776
}

    
   
2777

   

    
   
2778
static void my_hangup_polarityswitch(void *pvt)

    
   
2779
{

    
   
2780
	struct dahdi_pvt *p = pvt;

    
   
2781

   

    
   
2782
	if (!p->hanguponpolarityswitch) {

    
   
2783
		return;

    
   
2784
	}

    
   
2785

   

    
   
2786
	if (p->answeronpolarityswitch) {

    
   
2787
		my_set_polarity(pvt, 0);

    
   
2788
	} else {

    
   
2789
		my_set_polarity(pvt, 1);

    
   
2790
	}

    
   
2791
}

    
   
2792

   
2747
static int my_start(void *pvt)
2793
static int my_start(void *pvt)
2748
{
2794
{
2749
	struct dahdi_pvt *p = pvt;
2795
	struct dahdi_pvt *p = pvt;
2750
	int x = DAHDI_START;
2796
	int x = DAHDI_START;
2751

    
   
2797

   
[+20] [20] 707 lines
[+20] [+] static struct analog_callback dahdi_analog_callbacks =
3459
	.cancel_cidspill = my_cancel_cidspill,
3505
	.cancel_cidspill = my_cancel_cidspill,
3460
	.confmute = my_confmute,
3506
	.confmute = my_confmute,
3461
	.set_pulsedial = my_set_pulsedial,
3507
	.set_pulsedial = my_set_pulsedial,
3462
	.get_orig_dialstring = my_get_orig_dialstring,
3508
	.get_orig_dialstring = my_get_orig_dialstring,
3463
	.set_needringing = my_set_needringing,
3509
	.set_needringing = my_set_needringing,

    
   
3510
	.set_polarity = my_set_polarity,

    
   
3511
	.start_polarityswitch = my_start_polarityswitch,

    
   
3512
	.answer_polarityswitch = my_answer_polarityswitch,

    
   
3513
	.hangup_polarityswitch = my_hangup_polarityswitch,
3464
};
3514
};
3465

    
   
3515

   
3466
/*! Round robin search locations. */
3516
/*! Round robin search locations. */
3467
static struct dahdi_pvt *round_robin[32];
3517
static struct dahdi_pvt *round_robin[32];
3468

    
   
3518

   
[+20] [20] 14398 lines
trunk/channels/sig_analog.h
Revision 278424 New Change
 
trunk/channels/sig_analog.c
Revision 278424 New Change
 
  1. trunk/channels/chan_dahdi.c: Loading...
  2. trunk/channels/sig_analog.h: Loading...
  3. trunk/channels/sig_analog.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.