URGENT - capturing who 'answered'

Hello everyone.
I need a quick help on how to capture who answered the call with agi.

Here is an example:

-- Zap/32-1 is ringing
-- Zap/33-1 is ringing
-- Zap/34-1 is ringing
-- Zap/35-1 is ringing
-- SIP/operator1-e77f answered Zap/23-1  

So how can I capture this value and write it to mysql?

I already have this in ruby script that we are using:

                                            $my.query("UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}")

And i need to do something like:

                                            $my.query("UPDATE call_log SET endtime = NOW(),answeredby= #{$agi.WHOANSWEREDTHEPHONE} WHERE id = #{call_log_id}")

And in above example it would write SIP/operator1-e77f into answeredby.

Any help is greatly appreciated!

Forgot to say. If possible without CDR - I dont know how to capture CDR info in ruby.

so if its possible via agi or something else - let me know.

Hi Are you using queues ? if so capture the queues log its in real time and not like the cdr

Ian

Hi Ian,

I am not sure about queues. I use ruby scripts that are called when extension rings.

In that ruby script i have this line:

		$my.query("UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}")

i was looking for a way to do something like:

                     $my.query("UPDATE call_log SET endtime = NOW(),answeredby= #{$agi.WHOANSWEREDTHEPHONE} WHERE id = #{call_log_id}")

anyone ?

AFAIK, cdr_mysql will record who picks up the call

I know if I have a Dial(SIP/101&SIP/102&SIP/103)
I end up with three CDRs relating to the call. One is recorded as answered and two are recorded as missed.

You can then use RUBY to pull out the call that was answered from the CDR database

Does this help ??

Cheers
Chris