Max character count for curl realtime

Hi,

I am using curl with extconfigf for MusicOnHold. Asterisk does a curl request to a web server. The web server gives back something like name=652&mode=custom&application= followed by 540 characters. It seems that asterisk only seems to get the first 255 characters. If I do a ps aux and look for the application path that I pass back I only see the first 255 characters. How would I go about extending this to say 768?

EDIT: Using a URL that does a 302 seems to be a good work around.

I just did a quick test using curl via realtime and there was no issue retrieving data longer than 256 characters however, the definition of “mohclass” in res_musiconhold.c does have some fixed 256 byte buffers including args. Speaking of which… shouldn’t application be args for the custom mode?

@gjoseph What do you mean by “shouldn’t application be args for the custom mode?” In order to figure out what I needed to send back to curl I looked a the different options that could be set in musiconhold.conf. My response looks something like this

name=652&mode=custom&application=/opt/my_code/ffmpeg_all_with_ua.sh https://example.org/some_very_long_url_logner_than_255_characters.mp3

Is there a different way that I should be doing it?

I was being dumb. application is correct from a configuration perspective. It gets copied into the args member of the mohclass structure. I forgot it was named differently internally. It is fixed at 256 bytes however which explains the issue you’re seeing.

a little off topic but there is a newer option playlist performance is huge over custom

; playlist	– provide a fixed list of filenames or HTTP(S) URLs to play

; =========
; Playlist (native) music on hold
; =========
;
; This mode is similar to ‘files’ mode in that it plays through a list
; of files, but instead of scanning a directory the files are
; explicitly configured using one or more ‘entry’ options.
;
; Each entry must be one of:
;
;   * An absolute path to the file to be played, without an extension.
;   * An HTTP(S) URL
;
; The entries are played in the order in which they appear in the
; configuration. The ‘sort’ option is not used for this mode.
;

Thanks. In my case I am calling a custom bash script which calls ffmpeg to play an online stream.