Detecting ringing status of Dahdi FXO [SOLVED]

Executive summary: How can I check if a phone line is currently ringing?


Appologies for the nine year gap since my last post, but honestly Asterisk has been fullfilling my limited requirements just fine. Now, to my problem.

I have a Wildecard X100P FXO card which is connected to my phone line together with a DECT phone. I would like Asterisk to act as an anserphone so I have writtin the following in extensions.ael.

context incoming { s => { Wait(15); Answer(); VoiceMail(1000,su); Hangup; }; };
This basically works fine and even reliably detects when the calling party has hung up. So far so good. The problem occurs if we are in and during the 15 second wait someone picks up the DECT phone. We can now talk to the caller, but 15 seconds after the phone started ringing our conversation is interrupted by “Helllo we are not in at the moment, please leave a message” :confused:

Clearly, what is happening here is that Asterisk doesn’t notice that the phone has stopped ringing and just presses on with doing the VoiceMail thing. I have tried to add a “Is the line still ringing test” just before the VoiceMail command using ChanIsAvail and DEVICE_STATE but I can’t seem to get either to tell me anything useful.

Does anyone have any ideas how this might be addressed?

One solution which I could explore is to get Asterisk to immediately answer the phone and then ring the DECT phones via SIP (they are these dual protocol Seimens Gigaset things). I think that this would work as Asterisk would reliably know that someone has picked it up. The problem is that the caller would be charged a connection fee immediately. So, if I phoned home from my mobile and hung up after 10 seconds concluding that everyone was out I would still be charged because Asterisk had ‘answered’ the call.


Instead of Wait(15) try WaitForRing(15). That way it will only perform the Answer if there was a ring after waiting 15 seconds. … aitForRing

1 Like

Woo, that seems to have fixed it. More testing needed, but so far it looks promising. Thanks very mcuh!

Just to say that this solution seems to work just fine. Thanks very much.