get_ilbc_source.patch v2011090301 remove get_ilbc_source.sh which needs files from www.ilbcfreeware.org since ilbcfreeware.org is now offline/decommissioned. replace with get_ilbc_source.pl which is self-dependent and has error handling. tar zxf asterisk-1.8.6.0.tar.gz patch -p1 -d asterisk-1.8.6.0/ < get_ilbc_source.patch cd asterisk-1.8.6.0 chmod ugo+x contrib/scripts/get_ilbc_source.pl contrib/scripts/get_ilbc_source.pl ./configure [...] make menuselect # codecs section, turn on codec_ilbc make make install jkister 20110903 http://jeremy.kister.net./ ######################################################################## diff -rubN asterisk-1.8.6.0.orig/UPGRADE-1.6.txt asterisk-1.8.6.0/UPGRADE-1.6.txt --- asterisk-1.8.6.0.orig/UPGRADE-1.6.txt 2010-05-07 12:05:24.000000000 -0400 +++ asterisk-1.8.6.0/UPGRADE-1.6.txt 2011-09-03 00:09:49.000000000 -0400 @@ -270,7 +270,7 @@ (http://www.gipscorp.com). This code is not licensed for distribution, and thus has been removed from the Asterisk source code distribution. If you wish to use codec_ilbc to support iLBC - channels in Asterisk, you can run the contrib/scripts/get_ilbc_source.sh + channels in Asterisk, you can run the contrib/scripts/get_ilbc_source.pl script to download the source and put it in the proper place in the Asterisk build tree. Once that is done you can follow your normal steps of building Asterisk. You will need to run 'menuselect' and enable diff -rubN asterisk-1.8.6.0.orig/contrib/scripts/get_ilbc_source.pl asterisk-1.8.6.0/contrib/scripts/get_ilbc_source.pl --- asterisk-1.8.6.0.orig/contrib/scripts/get_ilbc_source.pl 1969-12-31 19:00:00.000000000 -0500 +++ asterisk-1.8.6.0/contrib/scripts/get_ilbc_source.pl 2011-09-03 00:23:39.000000000 -0400 @@ -0,0 +1,109 @@ +#!/usr/bin/perl + +# this code parses the reference implementation of iLBC +# out of RFC3951 itself. No other tools, utilities, or +# 3rd party software is required. +# +# the licensing blurb below is probably not needed, but +# im including it since IANAL. +# +# http://jeremy.kister.net./ +# + +use strict; +use IO::Socket; +use Getopt::Std; + +my %opt; +getopts('Dfa', \%opt); +# D Debug +# f force +# a acknowlege license + +my $VER = '2011090301'; # my version +my $host = 'www.ietf.org'; # host to download file from +my $file = '/rfc/rfc3951.txt'; # file containing reference source code +my $dir = 'codecs/ilbc'; # directory to dump parsed iLBC code + + +open(ASTVER, ".version") || die "cannot read file '.version': $! - are you in the asterisk root source dir?\n"; +chomp(my $aver=); +close ASTVER; + +print <<__EOLICENSE__ +*** +This script will download the Gobal IP Solutions iLBC encoder/decoder +source code. Use of this code requires agreeing to the license agreement(s) at: + +http://www.webrtc.org/license-rights + +This script assumes that you have already agreed to the license agreement(s). +If you have not done so you can abort the script now, or press ENTER/RETURN to continue. +*** +__EOLICENSE__ +; +unless( $opt{a} ){ + my $x=; +} + +# manually for those who don't have LWP installed.. +verbose( "Connecting to ${host}..." ); +my $sock = IO::Socket::INET->new(PeerAddr => 'www.ietf.org', + PeerPort => 80, + Proto => 'tcp', + Timeout => 20, + ); + +die "cannot connect to $host on port 80: $!\n" unless $sock; + +debug( "Sending HTTP request to host." ); +print $sock "GET $file HTTP/1.1\r\n", + "Host: $host\r\n", + "User-Agent: Mozilla/5.0 (compatible; Asterisk/v${aver}; get_ilbc_source.pl/v${VER}; Perl $];)\r\n", + "Accept-Language: en-US\r\n", + "Connection: close\r\n", + "\r\n"; + +debug( "Waiting for HTTP reply from host." ); +chomp(my $code=<$sock>); +die "HTTP error from $host: $code\n" unless( $code =~ /200 OK/ ); +debug( "Got code: $code" ); + +while(<$sock>){ + last if( /^\s*$/ ); + chop; + debug( "from header: $_" ); +} +my $files = 0; +while(<$sock>){ + if( /^A\.[0-9]{1,2}\.\s*([a-zA-Z_0-9]+\.[ch])/ ){ + my $file = $1; + verbose( "creating: $file" ); + close FILE if $files; + open(FILE, "> $dir/$file") || die "cannot write to $dir/$file: $!\n"; + $files++; + }elsif( /^Andersen,\s/ || / / || /Internet Low Bit Rate Codec\s+December 2004/ ){ + next; + }elsif( /^Authors' Addresses/ ){ + last; + }elsif( $files ){ + s/^ //; + print FILE; + } +} + +verbose( "Parsed out $files files." ); +unless( $files == 48 ){ + verbose( "Likely problem with parsing/extracting." ); + die "will not continue without the '-f' flag.\n" unless $opt{f}; +} + +sub verbose { + my ($msg) = join('', @_); + + warn "$msg\n"; +} + +sub debug { + verbose(@_) if $opt{D}; +} diff -rubN asterisk-1.8.6.0.orig/contrib/scripts/get_ilbc_source.sh asterisk-1.8.6.0/contrib/scripts/get_ilbc_source.sh --- asterisk-1.8.6.0.orig/contrib/scripts/get_ilbc_source.sh 2009-04-22 10:30:47.000000000 -0400 +++ asterisk-1.8.6.0/contrib/scripts/get_ilbc_source.sh 1969-12-31 19:00:00.000000000 -0500 @@ -1,33 +0,0 @@ -#!/bin/sh -e - -if [ -f codecs/ilbc/iLBC_define.h ]; then - echo "***" - echo "The iLBC source code appears to already be present and does not" - echo "need to be downloaded." - echo "***" - - exit 1 -fi - -echo "***" -echo "This script will download the Global IP Solutions iLBC encoder/decoder" -echo "source code from http://ilbcfreeware.org. Use of this code requires" -echo "agreeing to the license agreement present at that site." -echo "" -echo "This script assumes that you have already agreed to the license agreement." -echo "If you have not done so, you can abort the script now." -echo "***" - -read tmp - -wget -P codecs/ilbc http://www.ietf.org/rfc/rfc3951.txt - -wget -q -O - http://www.ilbcfreeware.org/documentation/extract-cfile.awk | tr -d '\r' > codecs/ilbc/extract-cfile.awk - -(cd codecs/ilbc && awk -f extract-cfile.awk rfc3951.txt) - -echo "***" -echo "The iLBC source code download is complete." -echo "***" - -exit 0