Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- AMI_HOST=127.0.0.1
- AMI_PORT=5038
- AMI_USER=test
- AMI_PASS=test
- CALLERID='"Petr Pyatochkin" <23450392089>'
- CALL_CONTEXT=from-local-dialer
- TARGET_CONTEXT=conf
- FAILED_LIST=failed.txt
- :> ${FAILED_LIST}
- for num in $*; do
- res_str=$(cat <<EOF| nc ${AMI_HOST} ${AMI_PORT} | grep -E '^Message:\ Originate'
- Action: Login
- Username: ${AMI_USER}
- Secret: ${AMI_PASS}
- Events: off
- Action: Originate
- Channel: Local/${num}@${CALL_CONTEXT}/n
- CallerID: ${CALLERID}
- Context: ${TARGET_CONTEXT}
- Priority: 1
- Async: false
- Action: Logoff
- EOF
- )
- res_code=$?
- if [ ${res_code} -ne 0 -o "$(echo ${res_str} | grep failed)" ]; then
- echo ${num} >> ${FAILED_LIST}
- fi
- done
- cat ${FAILED_LIST} | mail -s Ne_Dozvon testmail@example.com
- rm -f ${FAILED_LIST}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement