<br><br><div class="gmail_quote">On Fri, Mar 8, 2013 at 4:17 PM, Optical Phoenix <span dir="ltr"><<a href="mailto:opticalphoenix@gmail.com" target="_blank">opticalphoenix@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks very much for the positive response, I will try to keep things reasonable.<div><br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1) If you just want to be able to have "hot-lines" that<br>
connect stations without dialing, you might not even need to<br>
add a new signaling type. Check out the 'immediate' option in<br>
chan_dahdi which could be used to configure an extension to<br>
automatically ring a group of extensions as opposed to<br>
providing dial-tone and reading digits.<br></blockquote></div><div>Yes, I am familiar withe the immediate=yes command, but as I will mention below, I have a different need</div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2) If you *really* do need PLAR specific signaling because<br>
you're connecting to another system that implements this, are<br>
you using a channel bank and digital lines or an analog<br>
interface card? The analog interface cards handle the<br>
signaling a little differently than the digital cards.<br></blockquote><div><br></div></div><div>Right again, I am connecting directly to a t1 line with PLAR signalling using a sangoma a104 t1 card. The carrier looped line 1 to line 2, and I am testing on my own. Earlier, when I got TX working I was testing with a live person with the carrier. </div>
<div><br></div><div>So thats the whole story. so far my edits of the dahdi_rbsbits have created... interesting results. Now when I get a call in on the line, when the rx bits go from 1111 to 0000 ,I get nothing. no ring, or anything. Then, when the line is hung up, and the 0000 goes to 1111 THEN I get a ring on the line I am assuming I have fouled something up. Do you know if "cursig" a single bit or the whole abcd bit pattern? That is the only thing I can think of that could be fouling this up.</div>
<div><div><br></div><div><span style="white-space:pre-wrap">        </span> case DAHDI_SIG_FXSLS:</div><div><span style="white-space:pre-wrap">                </span>if (!(cursig & DAHDI_BITS_ABCD)) { </div><div class="im">
<div><span style="white-space:pre-wrap">                        </span>/* Check for ringing first */</div><div><span style="white-space:pre-wrap">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_RING);</div>
<div><span style="white-space:pre-wrap">                        </span>break;</div><div><span style="white-space:pre-wrap">                </span>}</div></div><div><span style="white-space:pre-wrap">                </span>if ((chan->sig != DAHDI_SIG_FXSLS) && (!(~cursig & DAHDI_BITS_ABCD))) {</div>
<div class="im">
<div><span style="white-space:pre-wrap">                        </span> /* if went on hook */</div><div><span style="white-space:pre-wrap">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_ONHOOK);</div><div>
<span style="white-space:pre-wrap">                </span>} else {</div><div><span style="white-space:pre-wrap">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_OFFHOOK);</div><div><span style="white-space:pre-wrap">                </span>}</div>
</div><div><span style="white-space:pre-wrap">                </span>break;</div></div><div><br></div><div>Still Digging,</div><div>Dennis</div></div></div>
</blockquote></div><br><div><br></div><div><br></div><div>Great News, </div><div>I was able to get PLAR signalling working! Thanks for the help! (Now onto creating a proper signalling type!)</div><div><br></div><div>After learning a bit more about debugging c code, I was able to get it up and running so I could test. Here is the code changes I made, for people in a hurry. I am editing dahdi-base.c in the 2.6.1 source.</div>
<div><br></div><div><div>line number</div><div>2581<span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ABCD,</div><div>2582<span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = (0),</div>
<div>2583<span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD, </div></div><div><br></div><div>8233<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>if ((cursig & DAHDI_BITS_ABCD)) {</div>
<div><br></div><div>8238<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>if ((chan->sig != DAHDI_SIG_FXSLS) && (!(~cursig & DAHDI_BITS_ABCD))) {</div>
<div><br></div><div><br></div><div>More complete code below</div><div>at around line 2559</div><div><div>static void dahdi_rbs_sethook(struct dahdi_chan *chan, int txsig, int txstate,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>int timeout)</div>
<div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>static const struct {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>unsigned int sig_type;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>/* Index is dahdi_txsig enum */</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>unsigned int bits[DAHDI_TXSIG_TOTAL];</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>} outs[NUM_SIGS] = {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>/*</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> * We set the idle case of the DAHDI_SIG_NONE to this pattern to make idle E1 CAS</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span> * channels happy. Should not matter with T1, since on an un-configured channel,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> * who cares what the sig bits are as long as they are stable</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span> */</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_NONE,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ACD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_EM,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = (0),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD, /*changed by Dennis Wright for PLAR BUT NOT USED*/</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXSLS,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ABCD, /*changed by Dennis Wright for PLAR*/</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = (0), /*changed by Dennis Wright for PLAR. perhaps can use DAHDI_SIG_NONE instead*/</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD, /*changed by Dennis Wright for PLAR*/</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXSGS,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ABCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = (0),</div><div>#ifndef CONFIG_CAC_GROUNDSTART</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD,</div>
<div>#endif</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXSKS,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ABCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = (0),</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXOLS,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = (0), /*changed by Dennis Wright for PLAR BUT NOT USED*/</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_BITS_ABCD, /*changed by Dennis Wright for PLAR BUT NOT USED*/</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXOGS,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_ABCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_BITS_BD,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_FXOKS,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_BD,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_BITS_BD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_KEWL] = DAHDI_BITS_ABCD,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_SF,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_BITS_BCD,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_BITS_ABCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABCD,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_KEWL] = DAHDI_BITS_BCD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}, {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.sig_type = DAHDI_SIG_EM_E1,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_ONHOOK] = DAHDI_DBIT,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_OFFHOOK] = DAHDI_BITS_ABD,</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_START] = DAHDI_BITS_ABD,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>.bits[DAHDI_TXSIG_KEWL] = DAHDI_DBIT,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>};</div>
</div><div><br></div><div>and later at around 8174</div><div><div><br></div><div>/**</div><div> * dahdi_hooksig() - send a signal on a channel to userspace</div><div> * @chan:<span class="Apple-tab-span" style="white-space:pre">        </span>the DAHDI channel</div>
<div> * @rxsig:<span class="Apple-tab-span" style="white-space:pre">        </span>signal (number) to send</div><div> *</div><div> * Called from a channel driver to send a DAHDI signal to userspace.</div><div> * The signal will be queued for delivery to userspace.</div>
<div> *</div><div> * If the signal is the same as previous one sent, it won't be re-sent.</div><div> */</div><div>void dahdi_hooksig(struct dahdi_chan *chan, enum dahdi_rxsig rxsig)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> /* skip if no change */</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>unsigned long flags;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>spin_lock_irqsave(&chan->lock, flags);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>__dahdi_hooksig_pvt(chan,rxsig);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>spin_unlock_irqrestore(&chan->lock, flags);</div><div>}</div><div><br></div><div><br></div><div>/**</div><div> * dahdi_rbsbits() - set Rx RBS bits on the channel</div>
<div> * @chan:<span class="Apple-tab-span" style="white-space:pre">        </span>the DAHDI channel</div><div> * @cursig:<span class="Apple-tab-span" style="white-space:pre">        </span>the bits to set</div><div> *</div><div> * Set the channel's rxsig (received: from device to userspace) and act</div>
<div> * accordingly.</div><div> */</div><div>void dahdi_rbsbits(struct dahdi_chan *chan, int cursig)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>unsigned long flags;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>chan_notice(chan, "DENNIS dahdi_rbsbits started,Detected sigbits change to %04x\n", cursig);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>if (cursig == chan->rxsig)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ((chan->flags & DAHDI_FLAG_SIGFREEZE)) return;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>spin_lock_irqsave(&chan->lock, flags);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>switch(chan->sig) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXOGS: /* FXO Groundstart */</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>/* B-bit only matters for FXO GS */</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if (!(cursig & DAHDI_BBIT)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_START);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>break;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>/* Fall through */</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_EM: /* E and M */</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_EM_E1:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXOLS: /* FXO Loopstart */</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXOKS: /* FXO Kewlstart */</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (cursig & DAHDI_ABIT) /* off hook */</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan,DAHDI_RXSIG_OFFHOOK);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>else /* on hook */</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan,DAHDI_RXSIG_ONHOOK);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXSKS: /* FXS Kewlstart */</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXSGS: /* FXS Groundstart */</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>/* Fall through */</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_FXSLS:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ((cursig & DAHDI_BITS_ABCD)) { /*Dennis RINGING. Not super sure if I did this correctly, or its just not used. will be true if given anything BUT 0000, which is logically incorrect. */</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>/* Check for ringing first */</div><div><br></div><div> if ((debug & DEBUG_RBS)) {</div><div> chan_notice(chan, "DENNIS RING SIGNAL,Detected sigbits change to %04x\n", cursig); /*added for debugging these notices show up in the */</div>
<div> }</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_RING);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>break;</div><div>
<span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ((chan->sig != DAHDI_SIG_FXSLS) && (!(~cursig & DAHDI_BITS_ABCD))) { /* DENNIS added PLAR. checks if bit pattern is 1111. is false (and goes off hook) for everything else*/</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span> /* if went on hook */</div><div><br></div><div> if ((debug & DEBUG_RBS)) {</div><div> chan_notice(chan, "DENNIS ONHOOK,Detected sigbits change to %04x\n", cursig); /*added for debugging*/</div>
<div> }</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_ONHOOK);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>} else {</div>
<div><br></div><div> if ((debug & DEBUG_RBS)) {</div><div> chan_notice(chan, "DENNIS OFFHOOK,Detected sigbits change to %04x\n", cursig); /*added for debugging*/</div><div> }</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>__dahdi_hooksig_pvt(chan, DAHDI_RXSIG_OFFHOOK);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> case DAHDI_SIG_CAS:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>/* send event that something changed */</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>__qevent(chan, DAHDI_EVENT_BITSCHANGED);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> default:</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>break;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div></div><div><br></div><div> There are several gotchas I ran into. I am using sangoma cards, so to reload I was doing a "wanrouter stop" and "wanrouter start" to reload dahdi after recompiling. When this didn't seem to be working, I started using service dahdi stop. I then checked the running programs with ps aux |grep dahdi, I saw there was a dahdi_tool still running. To do the debugging I used "cat /sys/module/dahdi/parameters/debug" to check the debug level, then "echo 32 >/sys/module/dahdi/parameters/debug" to debug for rbs. I turned this off when I figured out I could put chan_notice(chan,"WORDS HERE") to generate my own debug comments. Debugging this way was a big help, as it led to the discovery that the changes weren't being made. I used replaced FXSLS to make my PLAR signalling work, so you have to set your signalling to FXSLS if you want to use this code. </div>
<div><br></div><div>I will post the cleaned up code shortly, and shortly after that I will post the new Signaling type, so you can set your signalling type to PLAR in the chan_dahdi.conf. I am going to search out all the places where DAHDI_SIG_FXSLS is mentioned, and try to replicate it. If anyone knows of a guide that might help with this, or has done it before, feel free to chime in. </div>
<div><br></div><div>Oh, and I noticed that in the default wanrouter auto configure for chan_dahdi.conf sets usecallerid to yes. This creates a 10 second delay while asterisk is waiting for caller id signals that will never come, so set it to no.</div>
<div><br></div><div>Thanks,<br>Dennis</div><div><br></div><div><br></div>