[asterisk-users] URGENT - who picked up the call??

Zarko Zivanovic outlaw011 at gmail.com
Mon Jul 26 04:28:11 CDT 2010


Hello,

 

I've been looking for this on voip-info and this list threads, and I am
guessing I am not looking right.

What I need is the way to capture (and write to DB) the information on who
'picked' or 'received' the incoming call.

 

Here is the example of .rb file that is called from extensions.conf:

 

 

                private  

                def lokal

                                call_log_id = nil

                                begin

                                                call_log_id = call_log()

                                

                                                $agi.answer

                                                $agi.exec('WAIT', '2')

                                

                                                local_channels =
get_locals()

                                                dial_params =
local_channels.join('&')

                                                dial_params <<
"||m(moh-0900-#{@moh_id})" if moh_available?()

 

                                                1.times do

                                                                r =
$agi.exec('DIAL', dial_params)

                                                                r =
$agi.get_variable('DIALSTATUS')

                                                                retry if
r.message.include?('BUSY')

                                                end

                                                

                                ensure

                                                call_log(call_log_id) unless
call_log_id.nil?

                                end

                end

                 

                private

                def get_locals

                                local_channels = @locals.map { |x|
'Sip/operator1&Zap/' + x.strip }

                                # FIX - ovaj raise treba da prijavi
nedefinisane lokale za servis a ne za telefon

                                raise "Nisu definisani lokalni kanali u
settings za telephone_id = #{@settings_row['telephone_id']}" if
local_channels.empty?

                                local_channels

                end

 

 

 

As you see the call can be picked either by the Zap channels in locals of
SIP/operator user. Now i Need to know here:

 

 

                                                $my.select_db('tvr2')

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

                                                raise 'Cant write from log:
call_log_id = #{call_log_id}' if $my.affected_rows() != 1

 

 

 if place of #SOMETHINGHERE# - where the call was transferred (from the part
above).

 

Anyone?>

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100726/18f1920a/attachment.htm 


More information about the asterisk-users mailing list