Log Incoming Calls Without Answering

Home » Asterisk Users » Log Incoming Calls Without Answering
Asterisk Users 13 Comments

Hi,

I’ve some analogic lines and I’m asked if it’s possible to program an asterisk for “checking” the inbound calls without answering them, doing something like this:

analog line 1 —–+———- asterisk
|
\______ analog phone

when a call enter, asterisk sense it and store its values (callerid, date and time, etc) somewhere, but nothing more, people will answer using the old analog phone. The goal is to have a log of the inbound calls without touching the old analog system (it’s shared between different subjects).

I’m pretty sure it’s something possible, but how to tell asterisk: “ok, call this AGI, and then don’t answer and do nothing more”.

Any idea?

Thanks

13 thoughts on - Log Incoming Calls Without Answering

  • This gets kinda Rube Golberg-ish, but convert the incoming analog line to sip, route it through asterisk and have asterisk do its thing before converting it back to analog to send to the phone. Only problem is you get a lot of extra hardware involved in the mix to make it work. It will be a lot of expense and trouble, so you need to make sure that whatever part you want asterisk to play is worth that effort. Also, I wouldn’t touch a fax line in this manner.

    If you could give a bit more info on what you want asterisk to do, we could maybe give better advice on how to solve your problem.

  • Il 20/04/2017 17:32, kevin.larsen@pioneerballoon.com ha scritto:

    Hi Kevin,

    I’ve already proposed your solution (is the most reasonable) but they have more than 60 analogs lines (no faxes) and some of them terminate in appliances like alarms, etc, so the solution must not touch in any way the connection between the line and his termination: doing a analog to digital conversion, passing it to asterisk and the convert it back to analog is prone to problems (what if asterisk crashes? or if a gateway fail?). I can split the existing lines (there are no complex things like adsl or digital signaling), convert the branches to digital and terminate then into an asterisk machine, so any failure will not affect the old circuit, but of course I’ve to configure asterisk to ONLY LOG calls and nothing more.

    This is what they want:
    – line 1 ring
    – line 1 is splitted in two, the first branch (let’s say the “analog”
    branch) go to an analog phone, that rings
    – the second branch go through a gateway and then to asterisk
    – asterisk log (with an AGI for example) “line 1 rings at …. from ….”
    no more is required from asterisk, if someone answer the analog phone or not is not my business.

  • ….”
    Ok, so I would agree with them that a conversion to digital and back again would tend to break things like fax lines and alarm lines. My analog lines in my facilities are there because a lot of alarm systems just don’t work with SIP at all. It’s something the alarm companies are going to have to figure out in the next decade or so as the Telcos are moving away from copper and switched networks and towards fiber and packet based networks.

    I honestly don’t know if you can do what you want without some piece of equipment picking up the line. What I would do is get an analog line, an analog phone, an analog to sip device (there are many to choose from) and a basic asterisk instance. I would then make a small test setup where the analog line goes to a splitter. One side of the splitter goes to your analog phone. One side goes to your analog to SIP converter and then into your asterisk instance via your ethernet network. Use your cell phone to call the number of your analog line and see if it works. You would have to code a basic dialplan on the asterisk side and set up the trunk to your converter, which I am assuming you know how to do.

    This would at least give you a fairly low cost way to test to see if you can trigger what you want on the Asterisk side without also triggering the line itself to be answered. I would also note that you would only be able to log incoming calls this way. I can’t see a way you would be able to detect an outgoing call from the analog extension.

  • Il 20/04/2017 18:09, kevin.larsen@pioneerballoon.com ha scritto:

    Yes, I’ll definitely do the test before set up the whole proyect, but the point basically is: it is possibile for asterisk to log a call without answering it? How to do it in the dialplan? Or I’m wasting time because an analog line who enter asterisk is always answered?

  • Fabio Moretti wrote:
    I used to do something similar, though not for 60 lines. I had ports off a channel bank bridged to a propitiatory ( think Vonage ) device, or even a copper PSTN line. Not sure where you are in the world, but different analog lines deliver caller id differently, so timing can become an issue, and you will have no clue when the call is either answered or abandoned. Here in the US it is between the first and second ring You would need to work through the timing, as if the line rings several times you need to detect the ring, capture the CLID, then ignore any additional rings for x period of time as there will only be one CLID string sent per call.

    Once I converted all lines to VOIP it all became much easier. If your analog lines are NOT in the US or Canada, you may run into different issues, or it might even become easier.

    John Novack

  • FM> when a call enter, asterisk sense it and store its values (callerid, FM> date and time, etc) somewhere, but nothing more, people will answer FM> using the old analog phone. The goal is to have a log of the inbound FM> calls without touching the old analog system (it’s shared between FM> different subjects).

    IIUC, the pots line has both some number of analog phones a/o fax machines on it, plus a fxo->sip gateway, yes?

    You can route the sip portion to asterisk and have the dialplan log everything but never answer.

    You may want to call the Ringing dialplan application, but even that may not be required. OTOH, calling Ringing should prevent the gateway from assuming that the asterisk machine never saw the INVITE.

    Eventually, when the other extension answers, the fxo->sip gateway will cancel the sip call just like it would if the caller hung up.

    (There is a possibility that any given gateway may not cancel the sip call until the analog call is completed; you need to test.)

    -JimC

  • Fabio, this doesn’t answer your question directly and it’s not Asterisk related in any way, but it’s another way to engineer a solution to the problem and I’ve seen it done before.

    Many analog modems will decode the caller ID on the analog line and provide it as part of the ‘RING’ notification on their serial port. This can be used as input on a script on a computer to log the caller ID and datestamp.

    For the Asterisk solution you propose to be able to work, the analog line has to support caller ID. If it does that then it will work with any of these modems too.

    It’s a purely passive connection to the line (just bridge it over the pair) and it may be cheaper/simpler/easier for you to build.

    Food for thought?

    Pete

  • –Apple-Mail=_B1B0664C-0091-4E52-BD3B-98CBB1FAB028
    Content-Transfer-Encoding: quoted-printable Content-Type: text/plain;
    charset=us-ascii

    Yes.

    Something similar to this will work (untested, possibly with syntax errors, but gives the idea):

    exten => s,1,NoOp(Inbound call from callerID $CALLERID(num))
    exten => s,n,Hangup

    The ‘Hangup’ will simply tell the FXS box (which you’ve used to terminate the line) that Asterisk isn’t accepting the call.

    One problem could be the FXS box re-inviting Asterisk over and over (causing duplicate NoOp logs), but you could add a Wait in there for 2-3 minutes before ‘Hangup’. Not many calls would ring for more than 2-3 minutes. In fact the PSTN may limit the number of rings (I have a feeling here in NZ it’s about 250 rings or so).

    exten => s,1,NoOp(Inbound call from callerID $CALLERID(num))
    exten => s,n,Wait(180)
    exten => s,n,Hangup
    
    Pete

    –Apple-Mail=_B1B0664C-0091-4E52-BD3B-98CBB1FAB028
    Content-Transfer-Encoding: quoted-printable Content-Type: text/html;
    charset=us-ascii

    On 21/04/2017, at 9:33 am, Fabio Moretti <fmoretti@tecytal.com> wrote:


    the point basically is: it is possibile for asterisk to log a call
    without answering it? How to do it in the dialplan? Or I’m wasting time
    because an analog line who enter asterisk is always answered?


    Yes.

    Something similar to this will work (untested, possibly with syntax errors, but gives the idea):

    exten => s,1,NoOp(Inbound call from callerID $CALLERID(num))
    exten => s,n,Hangup

    The ‘Hangup’ will simply tell the FXS box (which you’ve used to terminate the line) that Asterisk isn’t accepting the call.

    One problem could be the FXS box re-inviting Asterisk over and over (causing duplicate NoOp logs), but you could add a Wait in there for 2-3 minutes before ‘Hangup’. Not many calls would ring for more than 2-3 minutes. In fact the PSTN may limit the number of rings (I have a feeling here in NZ it’s about 250 rings or so).

    exten => s,1,NoOp(Inbound call from callerID $CALLERID(num))
    exten => s,n,Wait(180)
    exten => s,n,Hangup
    
    Pete


    –Apple-Mail=_B1B0664C-0091-4E52-BD3B-98CBB1FAB028

  • You can get FXO cards, such as the TDM410P/E; which connect to an analogue line just like a telephone and then allow the line to be treated as a DAHDI
    channel. (You would need an FXS card to connect to an analogue telephone;
    this has an additional power supply to generate the 48V DC line voltage and
    80V, 25 Hz ringing voltage. Usually these cards have 4 or 8 slots for either FXO or FXS modules; make sure you buy the right ones. Explaining to the vendor what you want it for may be the best way.)

    So you could have Asterisk as an extension to your analogue line, and it could monitor incoming calls. (You would not be able to monitor outgoing calls, though; unless you connected each analogue telephone to an FXS port, and used Asterisk as a simple PABX.)

    You do not need to Answer() the line to get the caller ID; it comes down the line (either as 300 baud modem tones representing ASCII, or DTMF digit tones, depending on your telephone company) between the polarity reversal and the first ring. And there is no need to have Answer()ed before running an AGI (in fact, you might have good reasons why you would want to have a pre-answer script, such as deciding which extension to ring, if you want to direct inbound callers straight back to the agent who called them earlier).

    All your AGI need do is fork(), and now — as far as you are concerned

  • Simple dialplan. Depending on the type of caller ID system, you may need to wait a few seconds (in case the caller ID is sent after the first ring).

    Thus, assuming you have a DAHDI device, your dialplan is:

    exten => s,1,Wait(5) ; check how much and if waiting is needed same => s,n,NoOp(Caller ID is ${CALLERID(num)} on DAHDI channel ${CHANNEL(dahdi_channel)})

    And move on to report from there.

    If you also need to report the total time of the call: that might be possible if the remote side reverses polarity of the channels on call start and end. Information about it is currently only reported in debug messages by chan_dahdi. So it is possible (given polarity reversal), but tricky.

  • Thank for all the replies, a lot of input and information!

    Sorry for this useless mail, but I really wanted to say thank you.

    Il 20/04/2017 17:26, Fabio Moretti ha scritto:

  • I used to play with an analog telephone line and Asterisk by using a Linksys SPA-3102 Voice Gateway.

    I think it is no longer manufactured, but maybe you con buy a used one on eBay or you can find an equivalent device from another manufacturer.