[Home]

Summary:ASTERISK-05749: [new app] HTTPPlayback
Reporter:Robby Dermody (robbyd)Labels:
Date Opened:2005-11-30 15:16:35.000-0600Date Closed:2006-02-04 06:48:10.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_httpplayback_curl.c
( 1) app_httpplayback.c
Description:Attached is a new application, HTTPPlayback, that streams audio in a variety of formats (most any format supported by asterisk) over HTTP. It uses wget for the streaming. I've tested it with both a linear16 file sitting on a webserver and realtime-streamed ulaw and it seems to work fine. MP3 format is not supported as MP3Player is a better choice for that.

I created this app because my application streams realtime audio in ulaw format over HTTP, and I wanted to play that audio stream to a caller in asterisk.

Please review it and let me know what you think. (Note that this version will not handle audio file headers correctly.... e.g. if it is to read a ulaw file with a Sun AU header on it, there will be a quick "bleep" at the beginning as it attempts to play the header data. ...this may be something that we may want to address.)

See the source for more info and usage.

Robby
Comments:By: Robby Dermody (robbyd) 2005-11-30 15:23:01.000-0600

I'm not sure exactly what the " Method of Distrobution" means in this context, but this app is just on this page (e.g. it's not in SVN or CVS yet)

By: BJ Weschke (bweschke) 2005-11-30 16:10:49.000-0600

This is an interesting application, but I'm not sure that we want a dependency on wget when we've already use curl in app_curl. Would you be opposed to using what's already used in app_curl to fetch your data? I think it would make more sense to keep it uniform.

By: twisted (twisted) 2005-11-30 18:25:43.000-0600

"Method of Distrobution" means where did you get the codebase you built against?  I probably should reword that.

By: Robby Dermody (robbyd) 2005-11-30 18:32:45.000-0600

bweschke: I wouldn't be against using curl. I could use the 'curl' command line utility easily enough, but I see that app_curl.c depends on libcurl. So if I were to use libcurl (and not curl), it looks like I would need to use the multi/asynchronous API. My goal for this is to get something that works for my purposes that can be included in Asterisk. If going with curl, this conversion would only take a few minutes...libcurl would take much longer for me. Unless we have a libcurl expert willing to attempt this, let me know if I should use libcurl and I can get cracking at it.

Thanks,

Robby

By: Robby Dermody (robbyd) 2005-11-30 18:39:51.000-0600

actually, it looks like I could use the 'easy' curl API...I'd just have to adjust the buffer size (CURLOPT_BUFFERSIZE option) down so that the write callback is called more often to stream the data to asterisk...

By: Russell Bryant (russell) 2005-11-30 23:52:16.000-0600

I think this would also be beneficial as an option in res_musiconhold.c as a MOH source.  Not that this would be necessary in this submission, I'm just suggesting it as something we could do next.  :)

By: Olle Johansson (oej) 2005-12-01 19:02:09.000-0600

Is it safe to use execl this way in an Asterisk application?
The execl lines are not following the format.

The description lacks "\n" on a few lines.

Isn't there a way to use an Asterisk API function to get the format names from the dynamically loaded modules? (wild guess) Seems weird to have to hard code the names for the format modules once again in a module.

By: Olle Johansson (oej) 2006-01-04 14:38:51.000-0600

Any updates on a libcurl implementation?

/O

By: Robby Dermody (robbyd) 2006-01-05 09:30:09.000-0600

oej: I've uploaded app_httpplayback_curl.c ...which is a start to this curl conversion. I believe the way I started to implement it won't work if we needed to be able to terminate the streaming when the user presses a digit and return the captured digit(s). For my uses at least, this is a requirement. I don't know libcurl very well, but from what I could tell, the multi/advanced interface might need to be used to give control over when to stop calling the receive data callback function (i.e. when a digit is pressed).

If anyone wants to take what little work I've done and finish it up, it would be greatly welcomed.

By: BJ Weschke (bweschke) 2006-01-05 18:17:54.000-0600

corydon: can you help/provide some feedback with this since I think you originally wrote app_curl, no?

By: Tilghman Lesher (tilghman) 2006-01-08 10:01:48.000-0600

In WriteFrameCallback(), you have a number of break statements that aren't in a loop.  I think you meant to return -1 there.

Instead of parsing out the format type, then reparsing it to get the samples, just put the sample sizes in the same block of code.  There's no reason to do string comparisons twice.

I'd prefer if you used sscanf() instead of atoi() for your string-to-number conversions, since atoi does not detect an error.

I think you forgot to remove your section of code marked "GET RID OF".

By: Tilghman Lesher (tilghman) 2006-01-21 23:04:00.000-0600

Housekeeping / do you have a new patch coming?

By: Clod Patry (junky) 2006-02-04 06:48:09.000-0600

Reporter seems to has lost interest here.
If you want to re-open, just ask a bug-marshal in #asterisk-bugs@FreeNode.