EzDevInfo.com

adhearsion

A Ruby framework for building telephony applications Adhearsion: Open Source Telephony Application Framework

How to originate phone calls from Rails application using Adhearsion?

I am using Ruby on Rails and Adhearsion. I have created both applications as stated in documentation provided on Adhearsion's website. I have workers running in background, from which I want to originate a phone call how should I achieve that ?

I am using :

Adhearsion::OutboundCall.originate 'SIP/channel_name/0018008001300', from: "<sip:1111@xxx.xxx.xxx.xxx>"

which is working fine in ahn console, how should I give use it in my worker ?

I searched and I have found results and solutions for older versions of Adhearsion.


Source: (StackOverflow)

Generating events in Ruby

I am developing a project using Adhearsion, Asterisk and Ruby on Rails. I need to generate an event or an alert box or a popup, or just anything else to simply appear on the screen when a new call is received.

I am sending the caller id from my Adhearsion app to my Rails app using Faraday. When I make a call, Faraday sends the value to a controller "Test" in Rails. This is when I need an event to show a new incoming call from that caller id.

I'm using Rails 2.3.8

Any help would be much appreciated.

Thanks :)

EDIT:

This is the code I tried. But it didn't quite do what I thought it would do. The first hurdle is that initially the value of 'somevar' WILL be empty because no call has been made. It is only after a call is received that it will get a value. But then I will need to reload the screen. I need it to be done automatically.

class TestController < ApplicationController
  def check
   somevar = params[:some_param]
    if !somevar.nil?
      render :partial => 'newcall', :locals => {:number => somevar}
    else render :partial => 'homescreen'
    end
  end
end

Source: (StackOverflow)

Advertisements

Does adhearsion record blocking record within non-blocking record?

i have been using asterisk for my current system for few months. Now I try to replace it with adhearsion. But i faced little problem to replace following asterisk dialplan to adhearsion dialplan.

exten=>mnt,1,MixMonitor(${filename}.wav) same=>n,Playback(1098/ur-name) same=>n,Record(wav_recordings/name-${issue_no}.wav,10) same=>n,Playback(1098/ur-age) same=>n,Record(wav_recordings/age-${issue_no}.wav,10) same=>n,Playback(1098/problem) same=>n,Record(wav_recordings/problem-${issue_no}.wav,10) same=>n,Playback(1098/thank-u)

In above dialplan,it records whole channel by MixMonitor as well as each portion by Record in different audio files. I done following in adhearsion to achieve same result.

class SystemRecord < Adhearsion::CallController def run answer record async: true do |event| logger.info "Async recording saved to #{event.recording.uri}" end play "file:///home/achyut/newproject/ur-name.gsm" record_result = record start_beep: true, max_duration:6,interruptible:"#" play "file:///home/achyut/newproject/ur-age.gsm" record_result = record start_beep:true, max_duration:4,interruptible:"#" play "file:///home/achyut/newproject/problem.gsm" record_result = record start_beep:true, max_duration:20,interruptible:"#" play "file:///home/achyut/newproject/thank-u.gsm" end end

But it doesn't work. First blocking recording (i.e. record) starts and doesn't stop recording. It creates only one recorded audio file of non-blocking recording (i.e.record async). But i need separate recorded file and whole channel recorded file same as asterisk dialplan do. How can i do that ?


Source: (StackOverflow)

asterisk to adhearsion agi async call transfer confusion

We have a telephony service (build on asterisk and adhearsion) in production and now i need another stage server for development and testing. What i need is one asterisk server and two adhearsion one for live and another for stage. Same asterisk for both stage and live adhearsion is because i have telecom sip trunk connection to asterisk. For that i create two AMI connection from manager.conf and configure adhearsion.rb according to AMI configuration.
But confusion is call transfer from asterisk to adhearsion. if i do as follow where a call will transfer. which AMI connection the call use to connect to asterisk ?

[stage]
exten =>_stage_numbers,1,AGI(agi:async)

[live]
exten => _live_numbers,1,AGI(agi:async)

I know call can be handle from router according to number. but i dont wanna mess same live system code.

if call from live number then asterisk transfer call to live adhearsion and call from stage number call transfer to stage adhearsion. Can we do that from asterisk ?


Source: (StackOverflow)

Some outbound calls are recorded others are not on Asterisk

I am using FreePBX with Asterisk (1.8.15-cert1) and I am making calls through Adhearsion application. Now the scenario is that recording files are generated for every call, but only some contain actual recording others are empty having size 44 bytes.

I observed that calls made to regular phones are getting recorded while calls which are answered by an automated machine i.e. answering machine are not recorded (empty recording file is saved).


Source: (StackOverflow)

how can configure queue agent in Adhearsion-Asterisk

I want to know how adhearsion 2.3.5 create asterisk config generator for queues such as new agent and auto generate queues.conf ...

config_generator = Adhearsion::Asterisk::ConfigGenerator::Queue.new

asterisk_config_file = "queues.conf"

How does this work .. any help would be appreciated


Source: (StackOverflow)

store the recordings on s3 with mod_rayo and mod_http_cache on freeswitch

i'm trying to get my recordings stored on s3.

Here is my rayo.conf.xml:

<configuration name="rayo.conf">
  <settings>
    <param name="max-idle-sec" value="300"/>
  </settings>
  <domain name="localhost" shared-secret="itsasecret">
    <listen type="c2s" port="5222" address="0.0.0.0" acl=""/>
    <users><user name="adhearsion" password="foo"/></users>
  </domain>

  <record>
    <param name="record-file-prefix" value="{profile=s3}http://bucket.domain.com.s3.amazonaws.com/records/"/>
  </record>

</configuration>

Here is my http_cache.conf.xml

<configuration name="http_cache.conf" description="HTTP GET cache">
  <settings>
    <!-- set to true if you want to enable http:// and https:// formats.  Do not use if mod_httapi is also loaded -->
    <param name="enable-file-formats" value="true"/>
    <param name="max-urls" value="10000"/>
    <param name="location" value="$${base_dir}/http_cache"/>
    <param name="default-max-age" value="86400"/>
    <param name="prefetch-thread-count" value="8"/>
    <param name="prefetch-queue-size" value="100"/>
    <!-- absolute path to CA bundle file -->
    <param name="ssl-cacert" value="$${base_dir}/conf/cacert.pem"/>
    <!-- verify certificates -->
    <param name="ssl-verifypeer" value="true"/>
    <!-- verify host name matches certificate -->
    <param name="ssl-verifyhost" value="true"/>
  </settings>
<profiles>
    <profile name='s3'>
        <aws-s3>
            <access-key-id>
                <![CDATA[AWS_KEY_ID]]>
            </access-key-id>
            <secret-access-key>
                <![CDATA[AWS_KEY_SECRET]]>
            </secret-access-key>
        </aws-s3>
        <domains>
          <domain name='bucket.domain.com.s3.amazonaws.com' />
        </domains>
    </profile>
</profiles>
</configuration>

Here is the debug log:

2014-08-10 01:03:19.405172 [ERR] mod_http_cache.c:351 Received HTTP error 403 trying to save /usr/http_cache/64/6ee5dd-bb6d-49a4-96cc-34bd54ab9827.wav to http://bucket.domain.com.s3.amazonaws.com/records/b5ffe577-c8c1-48c5-847e-a330ddc7b6b9-2.wav

2014-08-10 01:03:19.405172 [ERR] mod_http_cache.c:351 Received HTTP error 403 trying to save /usr/http_cache/64/6ee5dd-bb6d-49a4-96cc-34bd54ab9827.wav to http://bucket.domain.com.s3.amazonaws.com/records/b5ffe577-c8c1-48c5-847e-a330ddc7b6b9-2.wav
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Type] = [log/data]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Length] = [116]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Level] = [5]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Text-Channel] = [3]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-File] = [switch_core_session.c]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Func] = [switch_core_session_thread]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Line] = [1632]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [User-Data] = [b5ffe577-c8c1-48c5-847e-a330ddc7b6b9]
[DEBUG] esl.c:1480 esl_recv_event() RECV MESSAGE
Event-Name: SOCKET_DATA
Content-Type: log/data
Content-Length: 116
Log-Level: 5
Text-Channel: 3
Log-File: switch_core_session.c
Log-Func: switch_core_session_thread
Log-Line: 1632
User-Data: b5ffe577-c8c1-48c5-847e-a330ddc7b6b9
Content-Length: 116

2014-08-10 01:03:19.425141 [NOTICE] switch_core_session.c:1632 Session 2 (sofia/internal/1001@192.168.59.103) Ended

I tried to point it to a local server and turns out the only params i get are is the name of the file: audio_file.wav. looks like it's not sending the file properly...

I double checked my credentials so i'm pretty sure that's not the issue. Also, the records directory is writable by world for now.


Source: (StackOverflow)

Asterisk invalid Hangup cause

I am using Adhearsion on top of Asterisk (version 11.9.0).

To make outbound calls Adhearsion uses AMI originate command. Problem is Asterisk doesn't say why the call got hung up. If the callee is busy or did not pick up the call or hung up the call or switched off i am getting the same reason code ( 0 ).

Is there a way to get different Hung up reasons?


Source: (StackOverflow)

Adhearsion Park Asterisk call

I'm using Asterisk 11.5.1 with Adhersion

Is there any way to put on hold or park an existing call on Adhearsion (known from its call_id) , in order to originate an other call?


Source: (StackOverflow)

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

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`
'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?


Source: (StackOverflow)

Location of Config files in Adhearsion and FreeSWITCH

I'm getting on well, hooking up the ruby engine Adhearsion with the telephony engine FreeSwitch. However, the instructions tell me to give some config files a once over.

Specifically

config.punchblock.platform

and the permissions set on the directory

/var/punchblock/record

Could anyone please tell me where these are located?

Full instructions here:

http://adhearsion.com/docs/getting-started/freeswitch


Source: (StackOverflow)

Accessing call start time in Rails from Adhearsion

I have built a Rails application and connected with Adhearsion for outbound calls via url (virginia). I need to get the time at which the outbound call is answered. How can I get that?


Source: (StackOverflow)

Implement Call queues in adhearsion

I need to implement the below use-case in asterisk + adhearsion and not sure on how to do that

When a customer call comes. I check list of available agents if the agents are busy i need to put the call in a queue with a timeout. If the agents don't become free within the given timeout the call hangs-up otherwise call gets routed to the agent.

Any idea on how to implement this flow?


Source: (StackOverflow)