Skip to content

Instantly share code, notes, and snippets.

@marcelog
Created May 8, 2016 16:22
Show Gist options
  • Save marcelog/2f9491d4283ab154c5225f8a09179c23 to your computer and use it in GitHub Desktop.
Save marcelog/2f9491d4283ab154c5225f8a09179c23 to your computer and use it in GitHub Desktop.
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}"
}
log "------------ call start ------------"
dumpvar "config dir" ${AST_CONFIG_DIR}
dumpvar "configfile" ${AST_CONFIG_FILE}
dumpvar "module dir" ${AST_MODULE_DIR}
dumpvar "spool dir" ${AST_SPOOL_DIR}
dumpvar "monitor dir" ${AST_MONITOR_DIR}
dumpvar "var dir" ${AST_VAR_DIR}
dumpvar "data dir" ${AST_DATA_DIR}
dumpvar "log dir" ${AST_LOG_DIR}
dumpvar "agi dir" ${AST_AGI_DIR}
dumpvar "key dir" ${AST_KEY_DIR}
dumpvar "run dir" ${AST_RUN_DIR}
line='init'
while [ "${#line}" -gt "2" ]; do
read line
log ${line}
done
log "------------ call done ------------"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment