This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./configure --enable-cgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful to debug rewrite rules and other stuff | |
error_log logs/error.log notice; | |
http { | |
# Debug rewrite rules | |
rewrite_log on; | |
} | |
server { | |
listen 80; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER=nobody | |
PHP_52_BIND=127.0.0.1:9000 | |
PHP_53_BIND=127.0.0.1:9001 | |
PHP_52_CGI=/usr/php-5.2/bin/php-cgi | |
PHP_53_CGI=/usr/php-5.3/bin/php-cgi | |
PHP_FCGI_CHILDREN=15 | |
PHP_FCGI_MAX_REQUESTS=1000 | |
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS" | |
PHP_52_CGI_ARGS="${PHP_CGI_ARGS} ${PHP_52_CGI} -b ${PHP_52_BIND}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
nc 127.0.0.1 5038 -e ./bami.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09/08/11 21:46:40 - DEBUG - Event: Newstate Privilege: call,all Channel: DAHDI/x-1 ChannelState: 5 ChannelStateDesc: Ringing CallerIDNum: x CallerIDName: Uniqueid: 1315529123.320110 | |
09/08/11 21:46:40 - INFO - === Unhandled event: Newstate === | |
09/08/11 21:46:40 - DEBUG - Event: DTMF Privilege: dtmf,all Channel: DAHDI/x-1 Uniqueid: 1315529106.320100 Digit: 6 Direction: Received Begin: No End: Yes | |
09/08/11 21:46:40 - INFO - DTMF | |
09/08/11 21:46:40 - DEBUG - Event: DTMF Privilege: dtmf,all Channel: DAHDI/x-1 Uniqueid: 1315529097.320090 Digit: 0 Direction: Received Begin: Yes End: No | |
09/08/11 21:46:40 - INFO - DTMF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generic function for logging | |
function log() { | |
echo `date "+%D %T - "` "${@}" >> ${log} | |
} | |
# Will call log() with a INFO prefix | |
function info() { | |
log "INFO - ${@}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reads a line from AMI (stdin), will strip \r | |
function readLine() { | |
local line="" | |
read line | |
line=`echo ${line} | tr -d "\r"` | |
echo ${line} | |
} | |
# Reads a full PDU from asterisk. Since Asterisk messages | |
# ends with a \r\n\r\n, and we use "read" to read line by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Performs a Login action. Will terminate with error code 255 if | |
# the asterisk ami welcome message is not found. | |
function login() { | |
local welcome=`readLine` | |
if [ ${welcome} != "Asterisk Call Manager/1.1" ]; then | |
error "Invalid peer. Not AMI." | |
exit 255 | |
fi | |
printf "Action: Login\r\nUsername: ${user}\r\nSecret: ${pass}\r\n\r\n" | |
local response=`readPdu` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Main reading loop. | |
while [ true ]; do | |
pdu=`readPdu` | |
debug "${pdu}" | |
$regex="Event: *" | |
if [[ $pdu =~ $regex ]]; then | |
eventName=`echo ${pdu} | cut -d' ' -f2` | |
case ${eventName} in | |
DTMF) | |
info DTMF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/mg/AsterTrace ==> Main source directory | |
ServerHandlers ==> Server Handlers reside here. These will listen for events triggered from the tcp server. | |
ServerHandler.php ==> A base class for all tcp command listeners. | |
ServerCommandDTO.php ==> DTO to be used when dispatching events from the TCP server. The handlers will get this as the argument of the event. | |
CoreShowChannels.php ==> Event handler when a tcp client issues CoreShowChannels | |
EventHandlers ==> Event Handlers reside here. These are our listening beans. | |
DialListener.php | |
DtmfListener.php | |
EventListener.php | |
PDOListener.php |