Re: [asterisk-users] [asterisk-app-dev] AGI stream audio from URI

2018-07-20 Thread Matthew Jordan
So, that's not quite a debug log, but just the console log with Verbose+
output.

A debug log will show a lot more information, including what the media
cache modules are trying to do when they go to get the file.

You can find information on getting debug information on the Asterisk here:

https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information

You may also want to verify that the res_http_media_cache module is loaded.
That module is what actually does the work of pulling the remote file down
for local playback.

On Fri, Jul 20, 2018 at 3:10 PM Naftoli Gugenheim 
wrote:

> In one terminal tab:
>
> $ sudo nc -kl 80
>
> In another (note: asterisk is running in docker with --net=host):
>
> $ docker-compose exec asterisk cat /etc/hosts
> 127.0.0.1localhost
> 127.0.0.1example.com
> 127.0.1.1naftoli-ThinkPad-W540
>
> # The following lines are desirable for IPv6 capable hosts
> ::1 ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
>
> $ docker-compose exec asterisk curl http://example.com/dummyfile.wav
> ^C⏎
>
> The HTTP request headers show up in nc.
>
> However,
>
> $ docker-compose exec asterisk asterisk -rvddT
> Seeding global EID '5c:51:4f:a5:bf:59' from 'wlp3s0' using 'siocgifhwaddr'
> Parsing /etc/asterisk/asterisk.conf
> Asterisk 15.5.0, Copyright (C) 1999 - 2016, Digium, Inc. and others.
> Created by Mark Spencer  target="_blank">marks...@digium.com>
> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for 
> details.
> This is free software, with components licensed under the GNU General Public
> License version 2 and other licenses; you are welcome to redistribute it under
> certain conditions. Type 'core show license' for details.
> =
> Connected to Asterisk 15.5.0 currently running on naftoli-ThinkPad-W540 (pid 
> = 8)
> Core debug is still 6.
> [Jul 20 20:00:16] == Setting global variable 'SIPDOMAIN' to 'localhost'
> [Jul 20 20:00:16] -- Executing [1400@inbound:1] Set("PJSIP/local-004e", 
> "JITTERBUFFER(adaptive)=default") in new stack
> [Jul 20 20:00:16] -- Executing [1400@inbound:2] AGI("PJSIP/local-004e", 
> "agi://127.0.0.1/route") in new stack
> [Jul 20 20:00:16] > 0x7f9e8000cb00 -- Strict RTP learning after remote 
> address set to: 173.124.23.24:7078
> [Jul 20 20:00:16] > 0x7f9e8000cb00 -- Strict RTP qualifying stream type: audio
> [Jul 20 20:00:16] > 0x7f9e8000cb00 -- Strict RTP switching source address to 
> 127.0.0.1:7078
> [Jul 20 20:00:16] -- AGI Script Executing Application: (MixMonitor) Options: 
> (/sounds/monitor-2018-07-20T20:00:16.992040Z.wav)
> [Jul 20 20:00:16] == Begin MixMonitor Recording PJSIP/local-004e*[Jul 20 
> 20:00:16] WARNING[6384][C-0050]: file.c:772 ast_openstream_full: File 
> http://example.com/dummyfile.wav  does not 
> exist in any format
> *[Jul 20 20:00:17] --  Playing 
> '/sounds/prompts/welcome-to.slin' (escape_digits=) (sample_offset 0) 
> (language 'en')
> [Jul 20 20:00:17] WARNING[6384][C-0050]: chan_iax2.c:1228 
> jb_warning_output: Resyncing the jb. last_delay 0, this delay -359631367, 
> threshold 1000, new offset 359631367
> [Jul 20 20:00:18] --  Playing 
> '/sounds/prompts/some-org.slin' (escape_digits=) (sample_offset 0) (language 
> 'en')
> [Jul 20 20:00:19] --  Playing 
> '/sounds/prompts/press-2-now-to-use-a-phone-number-other-than-the-one-you-are-calling-from-.slin'
>  (escape_digits=0123456789#*) (sample_offset 0) (language 'en')
> [Jul 20 20:00:20] WARNING[6370]: res_pjsip_registrar.c:957 
> find_registrar_aor: AOR '' not found for endpoint 'local'
> [Jul 20 20:00:21] > 0x7f9e8000cb00 -- Strict RTP learning complete - Locking 
> on source address 127.0.0.1:7078
> [Jul 20 20:00:21] -- AGI Script agi://127.0.0.1/route 
> completed, returning -1
> [Jul 20 20:00:21] == MixMonitor close filestream (mixed)
> [Jul 20 20:00:21] == End MixMonitor Recording PJSIP/local-004e
>
> Nothing shows up in nc.
>
> P.S. I have no idea why it thinks the other prompts are .slin when in
> reality they are .wav
>
> Thanks.
> ​
> ___
> asterisk-app-dev mailing list
> asterisk-app-...@lists.digium.com
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
>


-- 
Matthew Jordan
Digium, Inc. | CTO
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start h

Re: [asterisk-users] [asterisk-app-dev] AGI stream audio from URI

2018-07-20 Thread Matthew Jordan


> On Jul 20, 2018, at 1:39 PM, Naftoli Gugenheim  wrote:
> 
> I've tried it with .wav. Same result. It doesn't even hit my server.
> 

Can you provide a debug level 5 log (including all higher level verbose+ 
messages) from Asterisk that shows the playback operation?



> 
> On Fri, Jul 20, 2018, 11:45 AM Matthew Jordan  > wrote:
> 
>> On Jul 15, 2018, at 11:37 PM, Naftoli Gugenheim > > wrote:
>> 
>> Crickets...
>> 
>> I've tried this now on 15.5.0. Still completely broken.
>> 
>> 
> 
> I suspect you’re encountering behavior that is working as intended.
> 
> Normally, when Asterisk plays back a file, it scans the file system for all 
> files with the provided sound file name. For each file that it finds with a 
> given file extension, it picks the best media file (where best is given by 
> transcoding cost) that matches the channel capabilities. That works great 
> when you have a file system that can be scanned quickly.
> 
> You can probably guess why that approach isn’t used with a remote HTTP 
> server: making a lot of HEAD/GET requests to ‘scan’ the remote server for 
> available file types is not a good idea for a multitude of reasons.
> 
> As such, the remote playback determines the type of file it is playing back 
> from the extension of the resource it downloads from the remote server. If 
> the remote resource doesn’t have an extension, then Asterisk is going to 
> complain that it does not know what type of media it just downloaded.
> 
> That is: if your remote resource was named “sounds/prompts/nine.wav” you’d 
> probably be okay.
> 
> Now, it would be nice if there was a way for Asterisk to be told to expect 
> the remote resource to be in a particular file format, but to my knowledge, 
> that feature hasn’t been added.
> 
> (As an aside, I use this functionality through AGI, so I know it isn’t 
> “completely broken”.)
> 
> 
> 
>> 
>> On Sun, Apr 8, 2018 at 11:28 PM Naftoli Gugenheim > > wrote:
>> I've come back to this because of issues with the other approach I took.
>> 
>> I've set up everything so that curl http://local.XXX.com/sounds/prompts/nine 
>>  hits my dev server, yet passing 
>> the same URL to STREAM FILE does not. I still get WARNING[103][C-0001]: 
>> file.c:774 ast_openstream_full: File 
>> http://local.mikvahbook.com/sounds/prompts/please%2Dmake%2Da%2Dselection 
>>  
>> does not exist in any format, and my server is not being hit.
>> 
>> Please help!
>> 
>> 
>> On Mon, Mar 5, 2018 at 2:49 AM Naftoli Gugenheim > > wrote:
>> Interesting!
>> 
>> Anyway I've deployed my app, and I left it with filenames. I have a Google 
>> Cloud Storage bucket that's mounted via gcsfuse into both the app and to 
>> Asterisk. That way they both act like they're working with their own local 
>> filesystem but really it's shared but distributed. Maybe I'll change it to 
>> use URLs and serve the files from the app in the future. I feel like it's 
>> more elegant for the app to own everything and treat asterisk like a 
>> stateless service, but there's no immediate reason to change the status quo.
>> 
>> 
>> On Fri, Mar 2, 2018, 2:36 PM Ross Buggins > > wrote:
>> Just monitors for changes in a directory, takes the file, processes it 
>> (sends off to a web service) it and then removes it from the local file 
>> system
>> 
>>  
>> 
>> From: asterisk-app-dev-boun...@lists.digium.com 
>>  
>> [mailto:asterisk-app-dev-boun...@lists.digium.com 
>> ] On Behalf Of Naftoli 
>> Gugenheim
>> Sent: 02 March 2018 19:30
>> 
>> 
>> To: Asterisk Application Development discussion 
>> > >
>> Subject: Re: [asterisk-app-dev] AGI stream audio from URI
>> 
>> 
>>  
>> 
>> How does the background service know when something was recorded?
>> 
>>  
>> 
>> ___
>> asterisk-app-dev mailing list
>> asterisk-app-...@lists.digium.com 
>> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev 
>> 
>> ___
>> asterisk-app-dev mailing list
>> asterisk-app-...@lists.digium.com 
>> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev 
>> 
> ___
> asterisk-app-dev mailing list
> asterisk-app-...@lists.digium.com 
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev 
> 

Re: [asterisk-users] [asterisk-app-dev] AGI stream audio from URI

2018-07-20 Thread Matthew Jordan


> On Jul 15, 2018, at 11:37 PM, Naftoli Gugenheim  wrote:
> 
> Crickets...
> 
> I've tried this now on 15.5.0. Still completely broken.
> 
> 

I suspect you’re encountering behavior that is working as intended.

Normally, when Asterisk plays back a file, it scans the file system for all 
files with the provided sound file name. For each file that it finds with a 
given file extension, it picks the best media file (where best is given by 
transcoding cost) that matches the channel capabilities. That works great when 
you have a file system that can be scanned quickly.

You can probably guess why that approach isn’t used with a remote HTTP server: 
making a lot of HEAD/GET requests to ‘scan’ the remote server for available 
file types is not a good idea for a multitude of reasons.

As such, the remote playback determines the type of file it is playing back 
from the extension of the resource it downloads from the remote server. If the 
remote resource doesn’t have an extension, then Asterisk is going to complain 
that it does not know what type of media it just downloaded.

That is: if your remote resource was named “sounds/prompts/nine.wav” you’d 
probably be okay.

Now, it would be nice if there was a way for Asterisk to be told to expect the 
remote resource to be in a particular file format, but to my knowledge, that 
feature hasn’t been added.

(As an aside, I use this functionality through AGI, so I know it isn’t 
“completely broken”.)



> 
> On Sun, Apr 8, 2018 at 11:28 PM Naftoli Gugenheim  > wrote:
> I've come back to this because of issues with the other approach I took.
> 
> I've set up everything so that curl http://local.XXX.com/sounds/prompts/nine 
>  hits my dev server, yet passing 
> the same URL to STREAM FILE does not. I still get WARNING[103][C-0001]: 
> file.c:774 ast_openstream_full: File 
> http://local.mikvahbook.com/sounds/prompts/please%2Dmake%2Da%2Dselection 
>  
> does not exist in any format, and my server is not being hit.
> 
> Please help!
> 
> 
> On Mon, Mar 5, 2018 at 2:49 AM Naftoli Gugenheim  > wrote:
> Interesting!
> 
> Anyway I've deployed my app, and I left it with filenames. I have a Google 
> Cloud Storage bucket that's mounted via gcsfuse into both the app and to 
> Asterisk. That way they both act like they're working with their own local 
> filesystem but really it's shared but distributed. Maybe I'll change it to 
> use URLs and serve the files from the app in the future. I feel like it's 
> more elegant for the app to own everything and treat asterisk like a 
> stateless service, but there's no immediate reason to change the status quo.
> 
> 
> On Fri, Mar 2, 2018, 2:36 PM Ross Buggins  > wrote:
> Just monitors for changes in a directory, takes the file, processes it (sends 
> off to a web service) it and then removes it from the local file system
> 
>  
> 
> From: asterisk-app-dev-boun...@lists.digium.com 
>  
> [mailto:asterisk-app-dev-boun...@lists.digium.com 
> ] On Behalf Of Naftoli 
> Gugenheim
> Sent: 02 March 2018 19:30
> 
> 
> To: Asterisk Application Development discussion 
> mailto:asterisk-app-...@lists.digium.com>>
> Subject: Re: [asterisk-app-dev] AGI stream audio from URI
> 
> 
>  
> 
> How does the background service know when something was recorded?
> 
>  
> 
> ___
> asterisk-app-dev mailing list
> asterisk-app-...@lists.digium.com 
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev 
> 
> ___
> asterisk-app-dev mailing list
> asterisk-app-...@lists.digium.com
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev

___
asterisk-app-dev mailing list
asterisk-app-...@lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users