Adhearsion 2.5.4 + Asterisk not playing file from URL

421 views
Skip to first unread message

Eric Ravelo

unread,
Oct 24, 2014, 11:51:34 AM10/24/14
to adhea...@googlegroups.com
Hello,

I have setup an Asterisk VM with the great Telephony-Dev-Box vagrant project.
In a very basic Adhearsion app, I was able to play a file from the Asterisk file system :

  def run
    answer
    play
'/var/lib/asterisk/sounds/en/demo-thanks.gsm'
 
end


But when the same file is played from an URL, I'm getting Adhearsion + Asterisk Errors :

  def run
    answer
    play
'http://server.domain.com/demo-thanks.gsm'
 
end


I have noticed the file extension .gsm is not shown in the Asterisk logs (see below).
Is this a bug, or a misconfiguration from my side?

Thanks,
Eric


The application logs:



[2014-10-24 17:35:38.662] ERROR Adhearsion::Call: 6b94de5f-3c9e-4f0f-93d7-1c80dd2f72fc@: <Adhearsion::CallController::Output::PlaybackError> Output failed due to #<Adhearsion::Error: Terminated due to playback error: #<Punchblock::Component::Output target_call_id="6b94de5f-3c9e-4f0f-93d7-1c80dd2f72fc", target_mixer_name=nil, component_id="8d6563e1-14f6-4d1f-8a0e-54989200170e", source_uri="8d6563e1-14f6-4d1f-8a0e-54989200170e", domain=nil, transport=nil, timestamp=Fri, 24 Oct 2014 17:35:38 +0200, request_id="1beb2e44-63e8-491a-838a-e8d61911d4ce", voice=nil, interrupt_on=nil, start_offset=nil, start_paused=nil, repeat_interval=nil, repeat_times=nil, max_time=nil, renderer=nil, render_documents=[#<Punchblock::Component::Output::Document target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Fri, 24 Oct 2014 17:35:38 +0200, url=nil, content_type="application/ssml+xml", value=<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
 
<audio src="http://server.domain.com/demo-thanks.gsm"/>
</speak>>]>>
    /
home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller/output/player.rb:23:in `rescue in output'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller/output/player.rb:13:in `
output'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller/output/abstract_player.rb:18:in `play_ssml'

   
/home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller/output.rb:102:in `play'
    /home/eravelo/ahn_apps/tuto-tdb/app/call_controllers/simon_game.rb:9:in `
run'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:120:in `execute!'

   
/home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:95:in `block in exec'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:94:in `
catch'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:94:in `exec'

   
/home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:111:in `exec_with_callback'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/call_controller.rb:105:in `
block (2 levels) in bg_exec'
    /home/eravelo/.rvm/gems/ruby-2.1.2/gems/adhearsion-2.5.4/lib/adhearsion/foundation/exception_handler.rb:5:in `catching_standard_errors'






Asterisk logs:


<------------>
Scheduling destruction of SIP dialog '3d1cc5ec-b64a-4052-aa48-4f91cfd90ce6' in 32000 ms (Method: REGISTER)
    -- AGI Script Executing Application: (Playback) Options: (
http://server.domain.com/demo-thanks)
[Oct 24 15:35:38] WARNING[2172][C-00000006]: file.c:701 ast_openstream_full: File
http://server.domain.com/demo-thanks does not exist in any format
[Oct 24 15:35:38] WARNING[2172][C-00000006]: file.c:1017 ast_streamfile: Unable to open
http://server.domain.com/demo-thanks (format (ulaw)): No such file or directory
[Oct 24 15:35:38] WARNING[2172][C-00000006]: app_playback.c:484 playback_exec: ast_streamfile failed on SIP/usera-00000006 for http://vxml-stage.voicepublisher.net/audio/en/demo-thanks
    -- Manager 'manager' from 10.203.175.1, hanging up channel: SIP/usera-00000006
  == Spawn extension (adhearsion, 22, 1) exited non-zero on 'SIP/usera-00000006'
    -- Executing [h@adhearsion:1] AGI("SIP/usera-00000006", "agi:async") in new stack
  == Spawn extension (adhearsion, h, 1) exited non-zero on 'SIP/usera-00000006'
Scheduling destruction of SIP dialog '97de68ff-d4ae-48e5-801e-e1570ea9a2c3' in 32000 ms (Method: ACK)
set_destination: Parsing
<sip:usera@10.33.35.13:5060> for address/port to send to
set_destination: set destination to 10.33.35.13:5060
Reliably Transmitting (no NAT) to 10.33.35.13:5060:
BYE sip:10.33.35.13:5060 SIP/2.0
v: SIP/2.0/UDP 10.203.175.11:5060;branch=z9hG4bK09797e41;rport
Max-Forwards: 70
f:
<sip:22@asterisk.local-dev.mojolingo.com>;tag=as396c2914
t:
<sip:usera@asterisk.local-dev.mojolingo.com>;tag=d28f592d-ee38-446f-b9a1-d7af42a089a0
i: 97de68ff-d4ae-48e5-801e-e1570ea9a2c3
CSeq: 102 BYE
User-Agent: Asterisk with Adhearsion
Proxy-Authorization: Digest username="usera", realm="asterisk", algorithm=MD5, uri="sip:asterisk.local-dev.mojolingo.com", nonce="4d805c8f", response="59cec369a95030f8d4e5c1f8b278c9c7"
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
l: 0

Ben Klang

unread,
Oct 24, 2014, 12:23:15 PM10/24/14
to adhea...@googlegroups.com
Hi Eric,

Welcome to the Adhearsion community!


Il giorno Oct 24, 2014, alle ore 8:51 AM, Eric Ravelo <era...@gmail.com> ha scritto:

Hello,

I have setup an Asterisk VM with the great Telephony-Dev-Box vagrant project.
In a very basic Adhearsion app, I was able to play a file from the Asterisk file system :

  def run
    answer
    play '/var/lib/asterisk/sounds/en/demo-thanks.gsm'
  end


But when the same file is played from an URL, I'm getting Adhearsion + Asterisk Errors :

  def run
    answer
    play 'http://server.domain.com/demo-thanks.gsm'
  end


I have noticed the file extension .gsm is not shown in the Asterisk logs (see below).
Is this a bug, or a misconfiguration from my side?

This is a limitation of Asterisk.  Unfortunately, Asterisk does not know how to fetch audio resources from a URL for playback. It can only accept file-based URLs.  Note that it also means the audio file has to be readable from the perspective of the Asterisk process, since we just pass that URL back to Asterisk for processing.

If fetching the audio from HTTP is really a requirement, you could fetch the file with Adhearsion and then pass the temporary filename to Asterisk. Of course, to do that, Adhearsion and Asterisk would have to be on the same server, or otherwise share a filesystem.

/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.

Ben Langfeld

unread,
Oct 24, 2014, 12:43:59 PM10/24/14
to adhea...@googlegroups.com
On 24 October 2014 14:23, Ben Klang <bkl...@mojolingo.com> wrote:
Hi Eric,

Welcome to the Adhearsion community!


Il giorno Oct 24, 2014, alle ore 8:51 AM, Eric Ravelo <era...@gmail.com> ha scritto:

Hello,

I have setup an Asterisk VM with the great Telephony-Dev-Box vagrant project.
In a very basic Adhearsion app, I was able to play a file from the Asterisk file system :

  def run
    answer
    play '/var/lib/asterisk/sounds/en/demo-thanks.gsm'
  end


But when the same file is played from an URL, I'm getting Adhearsion + Asterisk Errors :

  def run
    answer
    play 'http://server.domain.com/demo-thanks.gsm'
  end


I have noticed the file extension .gsm is not shown in the Asterisk logs (see below).
Is this a bug, or a misconfiguration from my side?

This is a limitation of Asterisk.  Unfortunately, Asterisk does not know how to fetch audio resources from a URL for playback. It can only accept file-based URLs.  Note that it also means the audio file has to be readable from the perspective of the Asterisk process, since we just pass that URL back to Asterisk for processing.

If fetching the audio from HTTP is really a requirement, you could fetch the file with Adhearsion and then pass the temporary filename to Asterisk. Of course, to do that, Adhearsion and Asterisk would have to be on the same server, or otherwise share a filesystem.

Alternatively you could switch Asterisk for FreeSWITCH and it'll work perfectly!

Eric Ravelo

unread,
Oct 27, 2014, 5:16:33 AM10/27/14
to adhea...@googlegroups.com
Hi Ben & Ben,

Thanks a lot for the replies.

I thought that Adhearsion was dealing with the "impedance adaptation" between the URL and the file needed by Asterisk, since the Play from URL feature is in the documentattion, without a mention to the telephony backend.

Anyway. Is this the only area where FreeSWITCH beats Asterisk when working with Adhearsion? What would be your advise for a production platform?

Ben Klang

unread,
Oct 28, 2014, 6:27:30 PM10/28/14
to adhea...@googlegroups.com
Il giorno Oct 27, 2014, alle ore 5:16 AM, Eric Ravelo <era...@gmail.com> ha scritto:

Hi Ben & Ben,

Thanks a lot for the replies.

I thought that Adhearsion was dealing with the "impedance adaptation" between the URL and the file needed by Asterisk, since the Play from URL feature is in the documentattion, without a mention to the telephony backend.

Thanks for that note. I’ll update the documentation to be a bit more clear on that handling.


Anyway. Is this the only area where FreeSWITCH beats Asterisk when working with Adhearsion? What would be your advise for a production platform?

A couple of things come to mind:

* Asterisk can do Answering Machine Detection (word counting), while FreeSWITCH can’t (it can do beep detection, but that’s not the same thing)
* Asterisk through version 11 has a bug that prevents detecting DTMF while bridged, but this is fixed in Asterisk 13 (not sure about 12, but don’t use 12). Also note that Adhearsion does not yet support Asterisk 13, but will in the near future, as Asterisk 13 only came out yesterday.
* Asterisk has some odd behaviors if you try to pass very long ASR grammars or TTS documents (SSML) due to a hard-coded 1024-character limit in processing AGI commands.  The workaround is to pass grammars and synthesis documents by HTTP or file URL (in this case, yes, Asterisk can handle an http URL)
* FreeSWITCH can handle asymmetric joins (the kind of thing where one side can only speak, or only listen), while Asterisk can only manage full-duplex

Hope this helps,
/BAK/
-- 
Ben Klang
Principal/Technology Strategist, Mojo Lingo

Mojo Lingo -- Voice applications that work like magic
Twitter: @MojoLingo

Andrius Kairiukstis

unread,
Oct 28, 2014, 6:27:30 PM10/28/14
to adhea...@googlegroups.com
Hi Eric, actually you could download file and take care to convert it to the asterisk format. 
I suggest to do that prior starting your AHN application, there are a lot of ruby-ways how to fetch remote file.

Regards,

Andrius Kairiukstis

Eric Ravelo

unread,
Oct 29, 2014, 7:31:37 AM10/29/14
to adhea...@googlegroups.com
Hi Ben and Andrius,

Thanks again.

I realy need to able to play sounds from URLs, and to do so dynamically. Even the call flow in the AHN app needs to be dynamic (i.e. depends on some business logic, out of a data base). So, I will try the FreeSWITCH route then.

Regards,
Eric
Reply all
Reply to author
Forward
0 new messages