#27 ✓hold
jars

Dosent find CDR record after finishing dial inside adhearsion dialplan

Reported by jars | April 28th, 2008 @ 04:59 PM

Using active record, from adhearsion dialplan, when the call is finished and dial application return, if you make a CDR.find_by_uniqueid, it dosent find the CDR record,

Scenario:

class CDR < ActiveRecord::Base

set_table_name "cdr"

end

and

internal {

...

dial(...)

cdr = CDR.find_by_uniqueid(uniqueid)

puts "Billsec = #{cdr.billsec} seconds"

...

}

Using a SIP client, when you hangup manually the call, it work fine:

[Mon Apr 28 16:48:50 2008] Parsing of extensions.rb complete

Billsec = 6 seconds

...

But when i wait for asterisk to hangup the call after background a recording (in this case is a Background(demo-congrats)) i receive the error:

#

/var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/adhearsion.rb:828:in `instance_eval'

....

Comments and changes to this ticket

  • Jay Phillips

    Jay Phillips April 29th, 2008 @ 04:37 AM

    Sorry, can you please post the entire stack trace? I can't tell what's causing the error you're describing.

    Also, can you elaborate on what you mean by "when i wait for asterisk to hangup the call after background a recording". How does that background affect call hangups? Can you describe the logic you have surrounding that more?

    Thanks!

    Jay Phillips

  • jars

    jars June 7th, 2008 @ 03:04 AM

    Jay, Sorry for my english, my native language is spanish :)

    Ok, here is the entire stack trace:

    [Tue Apr 29 19:54:37 2008] Executing call with variables: {"enhanced"=>"0.0", "uniqueid"=>"1209513277.8", "uri"=>#, "extension"=>"10015333227649", "callingpres"=>"0", "language"=>"en", "callingtns"=>"0", "network"=>"yes", "accountcode"=>"jorge.rodriguez", "priority"=>1, "callingani2"=>"0", "type"=>"SIP", "dnid"=>10015333227649, "calleridname"=>"jorge.rodriguez", "channel"=>"SIP/internal-082130e0", "context"=>"internal", "callington"=>"0", "query"=>{}, "request"=>"//127.0.0.1", "rdnis"=>"unknown", "callerid"=>"internal"}

    [Tue Apr 29 19:54:37 2008] Parsing of extensions.rb complete

    #

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/adhearsion.rb:828:in `instance_eval'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/adhearsion.rb:828:in `run_inside'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/core_extensions.rb:84:in `+@'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/servlet_container.rb:130:in `serve'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/adhearsion.rb:828:in `instance_eval'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/adhearsion.rb:828:in `run_inside'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/servlet_container.rb:125:in `serve'

    /usr/lib/ruby/1.8/gserver.rb:211:in `start'

    /usr/lib/ruby/1.8/gserver.rb:208:in `initialize'

    /usr/lib/ruby/1.8/gserver.rb:208:in `new'

    /usr/lib/ruby/1.8/gserver.rb:208:in `start'

    /usr/lib/ruby/1.8/gserver.rb:198:in `initialize'

    /usr/lib/ruby/1.8/gserver.rb:198:in `new'

    /usr/lib/ruby/1.8/gserver.rb:198:in `start'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/lib/servlet_container.rb:165:in `initialize'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/./ahn:216:in `new'

    /var/lib/gems/1.8/gems/adhearsion-0.7.7/./ahn:216

    /var/lib/gems/1.8/bin/ahn:16:in `load'

    /var/lib/gems/1.8/bin/ahn:16

    [Tue Apr 29 19:55:05 2008] Call routing complete

    So, I will try to elaborate the sentence:

    In the internal extensions.rb, i wrote the logic:

    dial(SIP/127.0.0.1/200953331234567)

    and in the /etc/asterisk/extensions.conf, there is a dialplan that is:

    [default]

    exten => _2009.,1,Background(demo-congrats)

    exten => _2009.,n,Hangup

    I configure my asterisk to write to CDR table in asterisk MySQL database and to fill the column uniqueid that is after accountcode column.

    So, when the dial finish, asterisk record the cdr, but i receive the exception above, it means that CDR activerecord dosent found the record with unique id "1209513277.8", but it is in the database (i realize a select * from cdr where uniqueid='1209513277.8')

    But, in the same scenario, when i press the button hangup in my SIP client (the call is terminated or cancelled by client bofore terminate the background(demo-congrats)) CDR record is found and everythings work fine.

    I hope now you understand now what i tried to say :P

    Jay, If u need more elements just tell me !,

    Thanks in advance and thanks you for your work with adhearsion !, i think it is a great open source project !

  • Jay Phillips

    Jay Phillips June 7th, 2008 @ 03:08 AM

    • State changed from “new” to “hold”

    Have you tried running your app in trunk (version 0.8.0)? This may fix your problem.

    You can get it on our Github repo at http://github.com/jicksta/adhear...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket

Tags

Pages