Check for Dialtone before dialing outbound call

Hello! Questions surrounding this have been asked previously, I have not found a direct reply.

Can FreePBX check for a dialtone before dialing out, and if there is not one, move on to the next line?

Here’s the background / problem I’m trying to solve:
Our setup uses one phone line from the cable company which converts to copper wire at the modem in the building as well as three other coper wire lines from the telephone company. Copper wire is more reliable than internet in my area, so I’m stuck with that for now.
We use the cable company line for our outbound calls, as it’s the newest and the line our clients are least likely to phone in on. Every once in a while (like today), the line is dead for 30-60 minutes. The cable company has is happy to comp us the time (about 3 bucks each time it happens), but since it’s such a small amount of time, they can’t figure out what the problem is. I want the phone system to find a dialtone before it dials out, or in some other way, test the line before attempting to dial. Do you have any other way we can accomplish this?

drnate

Need to know how you’re interfacing with the POTS line. DAHDI? ATA? Gateway?

@lgaetz We are using a DAHDI PCI card.

The cards and analog telephony in general uses voltages for call control. Dialtone is mostly for humans and is generally unnecessary from a technical perspective.

On the cards if the line is providing > 9vDC it will probably be seen as valid.

When we test the line with our phone, we hear nothing. Could the line still be providing voltage?

The best way to know is a meter, I use to suggest the light up phones but those aren’t a thing anymore I don’t think.

Voltages:

  • ~48vdc Idle
  • ~9vdc under load (off hook)
  • ~110vac ring.
  • +/- 0v (~500ms) hangup

Or just listen to the earpiece , if you have ‘battery’ you should hear DTMF tones as you press buttons, also as you ‘hook-flash’ with your finger will make an audible click.

Well it’s working now. Next time it happens, I will try the DTMF tone thing. It doesn’t really get me to where I need to be as far as selecting an outgoing line, but maybe the results will help us continue to troubleshoot the problem. Thank you for your help!

One possible solution might be to pickup (Answer()) the channel then listen for ‘energy’ (dialtone) with talk-detect before dialing.

@dicko
Interesting. So I can put a little script together that tells FreePBX to “answer” the line and listen for the buzz, then dial out if there is something there. If not, go on to the next line in the dialing plan? Did I get that right?

You can’t answer an outgoing line from the calling side!

I can sort of think of ways of doing this, but they will be outside the GUI environment, and fiddly.

@david55 I’m OK with fiddly - a little. Maybe I should have said pickup? or is that the same as answer?

The shell command

 dahdi_monitor   1 -r /dev/stdout 2>/dev/null|if [ $(read -t 5)  ];then exit 0;else exit -1 ;fi

should (maybe) exit with 0 as soon as it detects any sound on the receive channel of dahdi channel 1, hopefully the ‘dial-tone’ , and with 255 if there is not sound within 5 seconds. You can call it perhaps with asterisk’s system() command in your dialplan

@dicko
Thank you. I’ll give this a try. I will need some time to study what I’m doing, then we should be set.

You can

dahdi_monitor 1 -vv

to visually see what dahdi ‘sees’. Perhaps extend the read timeout to catch no ‘ringback’ on the RX channel in an inordinate timeframe

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.