Skip to content

Instantly share code, notes, and snippets.

View marcelog's full-sized avatar

Marcelo Gornstein marcelog

View GitHub Profile
php src/mg/AsterTrace/bin/astertrace.php ./conf
@marcelog
marcelog / gist:b22941edc5ec93ca23393d023b7edfdd
Created May 8, 2016 15:48
Part of: http://marcelog.github.io/articles/php_asterisk_agi_protocol_tutorial.html Log of a sample communication between Asterisk and a shell script by using the Asterisk Gateway Interface
------------ call start ------------
channel variable: config dir = /export/users/marcelog/config/asterisk
channel variable: configfile = /export/users/marcelog/config/asterisk/asterisk.conf
channel variable: module dir = /usr/lib/asterisk/modules
channel variable: spool dir = /tmp/marcelog/asterisk/spool
channel variable: monitor dir = /tmp/marcelog/asterisk/spool/monitor
channel variable: var dir = /tmp/marcelog/asterisk
channel variable: data dir = /tmp/marcelog/asterisk
channel variable: log dir = /tmp/marcelog/asterisk/logs
channel variable: agi dir = /tmp/marcelog/asterisk/agi-bin
@marcelog
marcelog / agi.sh
Created May 8, 2016 15:51
Part of: http://marcelog.github.io/articles/php_asterisk_agi_protocol_tutorial.html Sending commands and receiving responses from Asterisk by using a shell script and the Asterisk Gateway Interface
#!/bin/bash
filedump=/tmp/dump.txt
function log() {
echo ${@} >> ${filedump}
}
function dumpvar() {
log "channel variable: ${1} = ${2}"
------------ call start ------------
channel variable: config dir = /export/users/marcelog/config/asterisk
channel variable: configfile = /export/users/marcelog/config/asterisk/asterisk.conf
channel variable: module dir = /usr/lib/asterisk/modules
channel variable: spool dir = /tmp/marcelog/asterisk/spool
channel variable: monitor dir = /tmp/marcelog/asterisk/spool/monitor
channel variable: var dir = /tmp/marcelog/asterisk
channel variable: data dir = /tmp/marcelog/asterisk
channel variable: log dir = /tmp/marcelog/asterisk/logs
channel variable: agi dir = /tmp/marcelog/asterisk/agi-bin
@marcelog
marcelog / sample_agi.sh
Created May 8, 2016 16:22
Part of: http://marcelog.github.io/articles/php_asterisk_agi_protocol_tutorial.html Sample IVR application in a shell script for the Asterisk PBX by using Asterisk Gateway Protocol
#!/bin/bash
filedump=/tmp/dump.txt
function log() {
echo ${@} >> ${filedump}
}
function dumpvar() {
log "channel variable: ${1} = ${2}"
export PATH=${PATH}:/usr/cross-freebsd/bin
export LD_LIBRARY_PATH=/usr/cross-freebsd/lib
./configure --prefix=/usr/cross-freebsd --host=x86_64-pc-freebsd7
gmake
gmake install
$ gcc helloworld.c -o helloworld
$ file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
$ LD_LIBRARY_PATH=/usr/cross-freebsd/lib
$ /usr/cross-freebsd/bin/x86_64-pc-freebsd7-gcc helloworld.c -o helloworld
$ file helloworld
helloworld: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), for FreeBSD 7.2, dynamically linked (uses shared libs), FreeBSD-style, not stripped
#include<stdio.h>
int
main(int argc, char *argv[])
{
fprintf(stdout, "Hello world\n");
return 0;
}
tar jxf gcc-4.5.2.tar.bz2
cd gcc-4.5.2
mkdir objdir
cd objdir
../configure --without-headers --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --enable-libssp --enable-gold --enable-ld --target=x86_64-pc-freebsd7 --prefix=/usr/cross-freebsd --with-gmp=/usr/cross-freebsd --with-mpc=/usr/cross-freebsd --with-mpfr=/usr/cross-freebsd --disable-libgomp
LD_LIBRARY_PATH=/usr/cross-freebsd/lib gmake
gmake install
tar jxf mpc-0.8.1.tar.bz2
cd mpc-0.8.1
./configure --prefix=/usr/cross-freebsd --with-gnu-ld --with-gmp=/usr/cross-freebsd --with-mpfr=/usr/cross-freebsd --enable-static --enable-shared --host=x86_64-pc-freebsd7
gmake
gmake install