From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- net-misc/asterisk/files/1.6.2/asterisk.logrotate3 | 25 +++++++++++++++++ net-misc/asterisk/files/1.6.2/asterisk.logrotate4 | 27 ++++++++++++++++++ net-misc/asterisk/files/1.6.2/call_data.txt | 32 ++++++++++++++++++++++ net-misc/asterisk/files/1.6.2/find_call_ids.sh | 17 ++++++++++++ .../asterisk/files/1.6.2/find_call_sip_trace.sh | 21 ++++++++++++++ net-misc/asterisk/files/1.6.2/sip_calc_auth | 25 +++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 net-misc/asterisk/files/1.6.2/asterisk.logrotate3 create mode 100644 net-misc/asterisk/files/1.6.2/asterisk.logrotate4 create mode 100644 net-misc/asterisk/files/1.6.2/call_data.txt create mode 100644 net-misc/asterisk/files/1.6.2/find_call_ids.sh create mode 100644 net-misc/asterisk/files/1.6.2/find_call_sip_trace.sh create mode 100644 net-misc/asterisk/files/1.6.2/sip_calc_auth (limited to 'net-misc/asterisk/files/1.6.2') diff --git a/net-misc/asterisk/files/1.6.2/asterisk.logrotate3 b/net-misc/asterisk/files/1.6.2/asterisk.logrotate3 new file mode 100644 index 000000000000..69296c99e66d --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/asterisk.logrotate3 @@ -0,0 +1,25 @@ +/var/log/asterisk/messages /var/log/asterisk/queue_log { + missingok + notifempty + + postrotate + /usr/sbin/asterisk -rnx "logger reload" || /bin/true + endscript +} + +/var/log/asterisk/debug /var/log/asterisk/full { + missingok + notifempty + daily + + postrotate + /usr/sbin/asterisk -rnx "logger reload" || /bin/true + endscript +} + +/var/log/asterisk/cdr-csv/*.csv /var/log/asterisk/cdr-custom/*.csv { + missingok + notifempty + weekly + rotate 52 +} diff --git a/net-misc/asterisk/files/1.6.2/asterisk.logrotate4 b/net-misc/asterisk/files/1.6.2/asterisk.logrotate4 new file mode 100644 index 000000000000..29e78eb16064 --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/asterisk.logrotate4 @@ -0,0 +1,27 @@ +/var/log/asterisk/messages /var/log/asterisk/queue_log { + missingok + notifempty + + postrotate + test -e /run/openrc/softlevel && /etc/init.d/asterisk --quiet status && /usr/sbin/asterisk -rnx "logger reload" || /bin/true + test -e /run/systemd/system && systemctl is-active --quiet asterisk.service && /usr/sbin/asterisk -rnx "logger reload" || /bin/true + endscript +} + +/var/log/asterisk/debug /var/log/asterisk/full { + missingok + notifempty + daily + + postrotate + test -e /run/openrc/softlevel && /etc/init.d/asterisk --quiet status && /usr/sbin/asterisk -rnx "logger reload" || /bin/true + test -e /run/systemd/system && systemctl is-active --quiet asterisk.service && /usr/sbin/asterisk -rnx "logger reload" || /bin/true + endscript +} + +/var/log/asterisk/cdr-csv/*.csv /var/log/asterisk/cdr-custom/*.csv { + missingok + notifempty + weekly + rotate 52 +} diff --git a/net-misc/asterisk/files/1.6.2/call_data.txt b/net-misc/asterisk/files/1.6.2/call_data.txt new file mode 100644 index 000000000000..ba9cbbba98b5 --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/call_data.txt @@ -0,0 +1,32 @@ +It's sometimes useful to look at SIP conversations in retrospect. If you have +a troublesome system, enable sip debug (in the CLI: sip set debug on), set up +logger.conf to log it to some file and then you can use the two scripts here to +extract the SIP converssations as seen by asterisk. + +find_call_ids.sh: + +This script will locate Call-ID values given an A and B number. Just invoke it with: + +find_call_ids.sh /path/to/log A-num B-num + +eg: + +find_call_ids.sh /var/log/asterisk/debug 102 105 + +To find the Call-IDs for calls going from ext 102 to ext 105 (depends on your +exact setup and the actual values being passed in the SIP INVITE packets) + +find_call_sip_trace.sh + +This script will extract a SIP conversation from the log for one or more +Call-ID values. Invoke with: + +find_call_sip_trace.sh /path/to/log Call-ID [...] + +Eg: + +find_call_sip_trace.sh /var/log/asterisk/debug 12341665haf434qgrq3@192.168.0.5 123123@192.168.0.3 + +This will find the SIP packets for those two conversations from the log +(interleaving the packets in the order asterisk output them - useful for +analysing the two SIP legs of the same call). diff --git a/net-misc/asterisk/files/1.6.2/find_call_ids.sh b/net-misc/asterisk/files/1.6.2/find_call_ids.sh new file mode 100644 index 000000000000..c4689bd1579d --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/find_call_ids.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +logfile=$1 +anum=$2 +bnum=$3 + +function usage() +{ + echo "USAGE: $1 logfile anum bnum" + exit -1 +} + +[ -r "${logfile}" ] || usage $0 +[ -n "${anum}" ] || usage $0 +[ -n "${bnum}" ] || usage $0 + +grep -B2 -P '^INVITE sip:'"${bnum}"'@.*\n(([^F].*|F[^r].*|Fr[^o].*|Fro[^m].*|From[^:]|From:.*.*)\r\n)+\r\n' "${logfile}" | awk '$4 ~ "^VERBOSE" { dt=$1" "$2" "$3 } $1=="Call-ID:" { if (cid != $2) { cid=$2; print dt" "cid; }}' diff --git a/net-misc/asterisk/files/1.6.2/find_call_sip_trace.sh b/net-misc/asterisk/files/1.6.2/find_call_sip_trace.sh new file mode 100644 index 000000000000..5b2e69e517b4 --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/find_call_sip_trace.sh @@ -0,0 +1,21 @@ +#! /bin/bash + +logfile=$1 +callid=$2 + +function usage() +{ + echo "USAGE: $1 logfile Call-ID [Call-ID ...]" + exit -1 +} + +[ -r "${logfile}" ] || usage $0 +[ -n "${callid}" ] || usage $0 + +shift; shift; +while [ $# -gt 0 ]; do + callid="${callid}|$1" + shift +done + +dos2unix < "${logfile}" | grep -P '^.*\n<--- (SIP read|(Reliably )?(Ret|T)ransmitting) .*\n([^<\n].*\n)*Call-ID: ('"${callid//./\\.}"')\n((|[^<\n].*)\n)*<-+>$|^.* chan_sip.c: (Reliably )?(Ret|T)ransmitting .*\n([^-\n].*\n)*Call-ID: ('"${callid//./\\.}"')\n((|[^-\n].*)\n)*---$' diff --git a/net-misc/asterisk/files/1.6.2/sip_calc_auth b/net-misc/asterisk/files/1.6.2/sip_calc_auth new file mode 100644 index 000000000000..3f050ada5738 --- /dev/null +++ b/net-misc/asterisk/files/1.6.2/sip_calc_auth @@ -0,0 +1,25 @@ +#! /bin/bash + +[ $# -lt 7 ] && echo "USAGE: $0 username realm password method uri algorithm nonce" && exit 1 + +un=$1 +realm=$2 +pw=$3 +method=$4 +uri=$5 +alg=$6 +nonce=$7 + +echo "Using $un@$realm (secret $pw) for method $method to $uri with nonce $nonce (alg=$alg)" + +a1=$un:$realm:$pw +a2=$method:$uri +ha1=$(echo -n "$a1" | openssl $alg) +ha2=$(echo -n "$a2" | openssl $alg) +resp=$(echo -n "$ha1:$nonce:$ha2" | openssl $alg) + +echo "a1=$a1" +echo "a2=$a2" +echo "ha1=$ha1" +echo "ha2=$ha2" +echo "resp=$resp" -- cgit v1.2.3