How to find who answered the call

Hello, everyone.

Has one problem which I do not know how to solve. I have ringgroup of 2 extensions, for example 101 and 102. When I ring them using Dial I pass the call to macros after call is answered. But I need to know who exactly answered the call to make decision based on it in macros.

Is there any workaround for that?

Thank you.

Howdy,

This function should help you:

wiki.asterisk.org/wiki/display/ … VICE_STATE

Do I correctly understand that I need to check all devices from ring group in macros and according to their state (BUSY?) detect who picked up?

Yes.

I guess I will have false results, if there will be 2 calls in a raw and 1st will be answered by 101, and second by 102. Both extensions will be BUSY in this time. This also will be, during 3rd call if one of BUSY extensions will answer that call.

May be there existing some other approach?

The other approach would be to watch the manager interface (AMI) to see who’s talking to the incoming channel, and then make your decision based upon that.

So, there is no way to see who answered with simple macro? AMI is not seems to be solution I want as require to be separate from dial plans and I guess need to be launched and being watching channels all the time.

Why do you need to ring them at the same time at the end?

Why not use device state to see who’s free, then ring that person? In this case, you know that person has the call.

Basically it is because both extensions should rang together in case both of them are available. Who first picks the phone - wins the call. It’s normal call group, so I’m not inventing something new.

But it seems to me there is no mechanics to find who is the winner.

There are mechanisms, there just are mechanisms inside the dialplan itself other than the device state function.

Cheers.