First ring tone detection

Hi all,

I’m writing to ask if anybody knows if there is a way to detect when the first ring tone is played on a outgoing call.
The problem is that I would like to know how much time is passing since the DIAL command execution in the dialplan and
the first ring tone played.

Thanks in advance,

Luca

Do you mean ring back tone or ringing?

For SIP there is no reliable way of knowing as the 180 Ringing response may get lost, and, in any case, the phone is in control of the generation of ringing.

There is, in any case, no reliable way of knowing on the PSTN, as ring back tone phase is not sychnonised with ringing current.

Hi David,

first of all, thanks for your reply.
I forgot to mention that my problem is related to PSTN.
I’m going to explain my problem a little deeper, just to be clear:

I’ve implemented an IVR that pick up incoming calls from customers, redirecting calls to
some service centers.
I have to define the service center’s efficiency in responding to customers calls.
This efficency is based on how much time is passing since the moment they hear the first ring on their phone to the moment they pick up the call.
I know the ringing is not synchronized but I’m looking for the most precise way to define this value.

Before dial command you can define channel variable which equal time. Then write macro for dialling. In this macro again get time and calculate difference

Thanks for you reply ramin, but I don’t think this would be a solution for my problem.
Infact the value I get in the macro for dialing would be the difference between the moment the dial command is executed and a undefined moment in the macro execution.

I have this situation:
Caller A
Callee B

A ------> Dial() ------> RING 1 ----- RING 2 --------> RING 3 -----> B

I need to detect the moment the RING 1 is played.
So I actually know the moment the Dial() command is executed, but I need to know
the RING 1 - Dial() time value.

Thanks for you reply ramin, but I don’t think this would be a solution for my problem.
Infact the value I get in the macro for dialing would be the difference between the moment the dial command is executed and a undefined moment in the macro execution.

I have this situation:
Caller A
Callee B

A ------> Dial() ------> RING 1 ----- RING 2 --------> RING 3 -----> B

I need to detect the moment the RING 1 is played.
So I actually know the moment the Dial() command is executed, but I need to know
the RING 1 - Dial() time value.[/quote]
difference between Dial() and Macro() execute time and between first RING time and Macro() execute time approximately is equal. Because after Dial() command immediately generate first RING. Also you can substract 10ms-100ms.

What I believe you are looking to determine is the amount of time that the caller waits in queue or ‘answer delay’. You are attempting to eliminate the call setup time in your calculation.

I believe, as David stated, that there is no reliable way to do this unless you have direct access to the far end switch. There are a couple of reasons for this.

  1. The ring-back tone that caller hears is not directly related to the ringing of a physical handset. Ring-back may be generated in differently depending on your connections. Try calling a cell phone from a land line. Do you hear ring-back before your cell actually starts ringing? My guess is you probably will.

  2. If the far end switch answers the call, ring back may stop, but that does not mean an agent has actually answered the call, it could simply mean that the switch answered the call and placed the caller in queue. It may be 1 second or 100 seconds before the call is presented to an agent and is actually answered. It is conceivable that during the time in queue, the caller continues to hear ring back tone. They could also be listening to music or advertising messages. But as far as Asterisk knows, the call was answered.

[quote=“dalenoll”]What I believe you are looking to determine is the amount of time that the caller waits in queue or ‘answer delay’. You are attempting to eliminate the call setup time in your calculation.

I believe, as David stated, that there is no reliable way to do this unless you have direct access to the far end switch. There are a couple of reasons for this.

  1. The ring-back tone that caller hears is not directly related to the ringing of a physical handset. Ring-back may be generated in differently depending on your connections. Try calling a cell phone from a land line. Do you hear ring-back before your cell actually starts ringing? My guess is you probably will.

  2. If the far end switch answers the call, ring back may stop, but that does not mean an agent has actually answered the call, it could simply mean that the switch answered the call and placed the caller in queue. It may be 1 second or 100 seconds before the call is presented to an agent and is actually answered. It is conceivable that during the time in queue, the caller continues to hear ring back tone. They could also be listening to music or advertising messages. But as far as Asterisk knows, the call was answered.[/quote]

Hi dalenoll,

effectively I think there is no solution to my problem.
You are saying the same things stated by David and I think you both are right.
I know there’s no synch beetwen ringings but I was looking for a way to approximate that delay.
Anyway thanks for your reply, now I’m sure it cannot be done.

Hi all again,

I’m reopening this thread because if I look at my Asterisk console in the moment a call is placed,
I see the following lines logged in the console:

DAHDI/32-1 is ringing DAHDI/32-1 answered DAHDI/18-1

So, if Asterisk is showing that the channel is ringing, it means that it’s capable of detecting the event triggered by the first ring tone.

I would like to know if there is the possibility to catch that event in the dialplan.

Thanks in advance.

This indicates that ring back tone is being generated by Asterisk, or for ISDN, by the network. It doesn’t mean that the called party is hearing ringing.

If you want to handle events, you need to use AMI, or possibly call event logging, although I don’t know i that event is logged to CEL.