CDR report does not show destination number (adhearsion - asterisk)

217 views
Skip to first unread message

dev

unread,
Jul 3, 2015, 4:12:19 AM7/3/15
to adhea...@googlegroups.com
I have been using asterisk to connect to adhearsion for my system. System originate call to a sip number by using follow script. 

Adhearsion::OutboundCall.originate number,
  from:                 call_from,
  controller:            controller ,
  controller_metadata:   {id: @id, initiate_from:'outbound'}

and cdr of asterisk is used to maintain call  status. The number that i haved called (destination call number)  is not shown in cdr report.: 
 
`id`, `calldate`, `clid`, `src`, `dst`, `dcontext`, `lastapp`, `lastdata`, `duration`, `billsec`, `disposition`, `channel`, `dstchannel`, `amaflags`, `accountcode`, `uniqueid`, `userfield`, `answer`, `end`
 
CDR report of call originated from adhearsion.
'2015-07-03 11:29:21', '9801243867', '9801243867', '1', 'adhearsion-redirect', 'Dial', 'SIP/ncell-out/playback', 5.12455, 5.89977, ' ANSWER', 'SIP/ncell-out-00000002', NULL, 'DOCUMENTATION', NULL, '1435902231.2', NULL, '0000-00-00 00:00:00', '2015-07-03 11:29:21' 
 
'2015-07-03 11:29:26', '9801243867', '9801243867', '1', 'adhearsion-redirect', 'Dial', 'SIP/ncell-out/9771002', 0.000001, 0, 'NO ANSWER', 'SIP/ncell-out-00000003', NULL, 'DOCUMENTATION', NULL, '1435902236.3', NULL, '0000-00-00 00:00:00', '2015-07-03 11:29:26'

Adhearsion call 1@adhearsion-redirect , 1 destination number.  
 Executing [1@adhearsion-redirect:1] AGI("SIP/ncell-out-00000004", "agi:async")

how should i get destination number in cdr instead of 1 when originate call from adhearsion? 
 
 
 
 

Ben Klang

unread,
Jul 3, 2015, 10:04:56 AM7/3/15
to adhea...@googlegroups.com
It sounds like this is a side-effect of the way we are originating calls, essentially a side-effect of the limitations of dialplan with AsyncAGI.

For now, would you go ahead and open an issue for this at https://github.com/adhearsion/adhearsion/issues/new ? I can’t promise how quickly we can fix it, but at least it will be visible.

Secondarily, I’d suggest making application-specific CDRs. It’s negligible work to capture the same information as Asterisk, and you have the advantage of being able to capture application-specific metrics, such as the amount of time spent in different parts of the application.  With a little extra work, they can be a LOT more helpful/meaningful.

/BAK/

 
 
 
 

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adhearsion+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Cristian Livadaru

unread,
Jul 7, 2015, 9:50:24 AM7/7/15
to adhea...@googlegroups.com

On 3 Jul 2015, at 16:04, Ben Klang wrote:

On Jul 3, 2015, at 4:12 AM, dev achyu...@gmail.com wrote:

I have been using asterisk to connect to adhearsion for my system. System originate call to a sip number by using follow script.

Adhearsion::OutboundCall.originate number,
from: call_from,
controller: controller ,
controller_metadata: {id: @id, initiate_from:'outbound'}

and cdr of asterisk is used to maintain call status. The number that i haved called (destination call number) is not shown in cdr report.:

id, calldate, clid, src, dst, dcontext, lastapp, lastdata, duration, billsec, disposition, channel, dstchannel, amaflags, accountcode, uniqueid, userfield, answer, end

CDR report of call originated from adhearsion.
'2015-07-03 11:29:21', '9801243867', '9801243867', '1', 'adhearsion-redirect', 'Dial', 'SIP/ncell-out/playback', 5.12455, 5.89977, ' ANSWER', 'SIP/ncell-out-00000002', NULL, 'DOCUMENTATION', NULL, '1435902231.2', NULL, '0000-00-00 00:00:00', '2015-07-03 11:29:21'

'2015-07-03 11:29:26', '9801243867', '9801243867', '1', 'adhearsion-redirect', 'Dial', 'SIP/ncell-out/9771002', 0.000001, 0, 'NO ANSWER', 'SIP/ncell-out-00000003', NULL, 'DOCUMENTATION', NULL, '1435902236.3', NULL, '0000-00-00 00:00:00', '2015-07-03 11:29:26'

Adhearsion call 1@adhearsion-redirect , 1 destination number.
Executing [1@adhearsion-redirect:1] AGI("SIP/ncell-out-00000004", "agi:async")

how should i get destination number in cdr instead of 1 when originate call from adhearsion?

It sounds like this is a side-effect of the way we are originating calls, essentially a side-effect of the limitations of dialplan with AsyncAGI.

For now, would you go ahead and open an issue for this at https://github.com/adhearsion/adhearsion/issues/new https://github.com/adhearsion/adhearsion/issues/new ? I can’t promise how quickly we can fix it, but at least it will be visible.

Secondarily, I’d suggest making application-specific CDRs. It’s negligible work to capture the same information as Asterisk, and you have the advantage of being able to capture application-specific metrics, such as the amount of time spent in different parts of the application. With a little extra work, they can be a LOT more helpful/meaningful.

/BAK/

Some hints from my experience if you decide to use before_call and after_call

  • keep in mind that before_call will be called for both, inbound AND outbound calls!
  • if you want some metrics just on inbound calls, you can check with call.is_a?(Adhearsion::OutboundCall)
  • you can't access "call" anymore once the call was hung up. You can increase the after_hangup_lifetime in adhearsion.rb if you want to be able to access "call" after the call is gone, or you can save the data somewhere.

Cris

dev

unread,
Jul 14, 2015, 12:45:58 AM7/14/15
to adhea...@googlegroups.com
Thank you Cris. I have little confusion on  when call is originated from OutboundCall providing a controller, does it execute before_call script if call is failed from asterisk? 

I think controller only executes when call success and, then, router forward call to controller. What if i need reason of call fails like user is busy or congested channel or no answer by user. 

Ben Langfeld

unread,
Jul 16, 2015, 2:40:23 PM7/16/15
to adhea...@googlegroups.com
On 14 July 2015 at 01:45, dev <achyu...@gmail.com> wrote:
Thank you Cris. I have little confusion on  when call is originated from OutboundCall providing a controller, does it execute before_call script if call is failed from asterisk? 

No it does not.
 
I think controller only executes when call success and, then, router forward call to controller.

You are correct.
 
What if i need reason of call fails like user is busy or congested channel or no answer by user. 

You should set an on_end callback on the call, something like this:

call = Adhearsion::OutboundCall.new
call.execute_controller_or_router_on_answer SomeController, {some: 'metadata'}
call.on_end do |end_event|
  puts "Call ended because of reason #{end_event.reason} / #{end_event.platform_code}"
end
call.dial 'sip:f...@bar.com', {some: 'opts'}
 
 

Some hints from my experience if you decide to use before_call and after_call

  • keep in mind that before_call will be called for both, inbound AND outbound calls!
  • if you want some metrics just on inbound calls, you can check with call.is_a?(Adhearsion::OutboundCall)
  • you can't access "call" anymore once the call was hung up. You can increase the after_hangup_lifetime in adhearsion.rb if you want to be able to access "call" after the call is gone, or you can save the data somewhere.

Cris

--

dev

unread,
Jul 21, 2015, 4:11:44 AM7/21/15
to adhea...@googlegroups.com
call = Adhearsion::OutboundCall.new
call.execute_controller_or_router_on_answer SomeController, {some: 'metadata'}
call.on_end do |end_event|
  puts "Call ended because of reason #{end_event.reason} / #{end_event.platform_code}"
end
call.dial 'sip...@bar.com', {some: 'opts'}

Thank you Ben Langfeld. 
It is really helpful  in my project , especially to maintain call status logs.
I am using it as follow:

class MakeOutboundCall
  attr_accessor :id, :number, :call_id
  def initialize(id,number,call_id)
   
@id=id
    @number=number
    @call_id=call_id
  end

  def call_start!
    call = Adhearsion::OutboundCall.new
   
call.execute_controller_or_router_on_answer NoticeBoardCallController, {:id => @id, :initiate_from => 'outbound'}
   
call.on_end do |end_event|
     #maintail call status
     CallLogDetail.create(:status=>end_event.reason, ...)
    end
    puts @number
  call.dial "SIP/#{@number}", :from => @call_id
  end
end


Ben Langfeld

unread,
Jul 21, 2015, 6:13:01 AM7/21/15
to adhea...@googlegroups.com
Note to all, if someone wants to submit a pull request to include this in the Adhearsion::OutboundCall.originate API, I would appreciate it.

Enviado do meu iPhone
Reply all
Reply to author
Forward
0 new messages