diff -urN --exclude '.svn*' --exclude '*.a' --exclude '.depend*' --exclude '*.*o' trunk-orig/configs/misdn.conf.sample trunk/configs/misdn.conf.sample --- trunk-orig/configs/misdn.conf.sample 2005-12-08 14:50:14.000000000 +0100 +++ trunk/configs/misdn.conf.sample 2005-12-08 21:23:46.000000000 +0100 @@ -20,6 +20,7 @@ ; debug=0 + ; the big trace ; ; default value: [not set] @@ -40,7 +41,7 @@ ; ; default value: yes ; -bridging=yes +bridging=no ; stops dialtone after getting first digit on nt Port ; @@ -68,15 +69,6 @@ ; clear_l3=no -; set the method to use for channel selection: -; standard - always choose the first free channel with the lowest number -; round_robin - use the round robin algorithm to select a channel. use this -; if you want to balance your load. -; -; default value: standard -; -method=standard - ;;; CRYPTION STUFF ; Wether to look for dynamic crypting attempt @@ -125,6 +117,16 @@ ; language=en +; +; sets the musiconhold class +; +musicclass=default + +; +; Either if we should produce DTMF Tones ourselve +; +senddtmf=yes + ; Prefixes for national and international, those are put before the ; oad if an according dialplan is set by the other end. ; @@ -149,11 +151,23 @@ ; te_choose_channel=no +; set the method to use for channel selection: +; standard - always choose the first free channel with the lowest number +; round_robin - use the round robin algorithm to select a channel. use this +; if you want to balance your load. +; +; default value: standard +; +method=standard + +; +; dialplan means Type Of Number in ISDN Terms (for outgoing calls) +; ; dialplan options: ; ; 0 - unknown -; 1 - National -; 2 - International +; 1 - International +; 2 - National ; 4 - Subscriber ; ; This setting is used for outgoing calls @@ -161,6 +175,7 @@ ; default value: 0 ; dialplan=0 +localdialplan=0 ; This is only for asterisk head and will result in only considering ; misdn.confs and misdn_set_opts callingpresentation informations if set to no. @@ -170,6 +185,13 @@ ; use_callingpres=yes + + +; +; turn this to no if you don't mind correct handling of Progress Indicators +; +early_bconnect=yes + ; uncomment the following to get into s extension at extension conf ; there you can use DigitTimeout if you can't or don't want to use ; isdn overlap dial. @@ -236,6 +258,17 @@ ; echotraining=yes +; +; chan_misdns jitterbuffer, default 1000 +; +jitterbuffer=1000 + +; +; change this threshold to enable dejitter functionality +; +jitterbuffer_upper_threshold=0 + + [intern] ; define your ports, e.g. 1,2 (depends on mISDN-driver loading order) ports=1,2 diff -urN --exclude '.svn*' --exclude '*.a' --exclude '.depend*' --exclude '*.*o' trunk-orig/contrib/init.d/rc.debian.misdn trunk/contrib/init.d/rc.debian.misdn --- trunk-orig/contrib/init.d/rc.debian.misdn 1970-01-01 01:00:00.000000000 +0100 +++ trunk/contrib/init.d/rc.debian.misdn 2005-12-08 21:23:46.000000000 +0100 @@ -0,0 +1,527 @@ +#!/bin/bash + +################################################################################ +# +# misdn-init init script +# +# Copyright (C) 2005, Nadi Sarrar +# +# Nadi Sarrar +# +# This program is free software, distributed under the terms of +# the GNU General Public License +# + +# +# USAGE: +# +# /etc/init.d/misdn-init start|stop|restart|config|scan|help +# + +# +# CONFIGURATION: +# +# Path to your misdn-init.conf: +# +misdn_init_conf="/etc/misdn-init.conf" +# +################################################################################ + + +MODPROBE=modprobe +RMMOD=rmmod +INSMOD=insmod +LSPCI=lspci +MKNOD=mknod + +# HFC 8/4 (S0) Options +master_clock=16 + +# HFC-E1 Options +optical=16 +los=18 +ais=19 +slip=20 + +# Card Settings +ulaw=8 +dtmf=9 +pcm_slave=11 + + +function expand_port_line { + expval="" + result="" + IFS=$',' + for str in ${1}; + do + if [ "$(echo "${str}" | grep "-")" != "" ]; then + from="$(echo ${str} | sed -e 's/^\([0-9]\+\)-[0-9]\+$/\1/')" + to="$(echo ${str} | sed -e 's/^[0-9]\+-\([0-9]\+\)$/\1/')" + while [ "${from}" -le "${to}" ]; do + result="${result}${from}," + let "from = ${from} + 1" + done + else + result="${result}${str}," + fi + done + IFS=$'\n' + expval="$(echo ${result} | sed -e 's/^\(.*\),$/\1/')" +} + +function load_card_modules { + + IFS=$'\n' + + for line in $(sed -n -e '/^[^#]/p' ${misdn_init_conf}); + do + var=`echo "${line}" | sed -e "s/^\(.*\)=.*/\1/"` + val=`echo "${line}" | sed -e "s/^.*=\(.*\)/\1/"` + + case "${var}" in + card) + nr=`echo "${val}" | sed -e "s/^\([0-9]*\),.*/\1/"` + mod=`echo "${val}" | sed -e "s/^[^,]*,\([^,]*\).*/\1/"` + if [ ${#val} -gt $(echo "obase=10;${#nr}+${#mod}+1" | bc) ]; then + opns=`echo "${val}" | sed -e "s/^[^,]*,[^,]*,\(.*\)/\1/"` + else + opns="" + fi + case "${mod}" in + 0x*) + hfcmulti[${nr}]=$(echo ${mod} | sed -e "s/^0x\([0-9]*\)/\1/") + let "hfcports = ${hfcports} + ${hfcmulti[${nr}]}" + IFS=$',' + for li in ${opns}; do + hfcmulti[${nr}]=$(echo "obase=10;2^(${!li}-1)+${hfcmulti[${nr}]}" | bc) + done + IFS=$'\n' + ;; + *) + other_card[${nr}]=${mod} + ;; + esac + ;; + te_ptp) + expand_port_line "${val}" + IFS=$',' + for li in ${expval}; do + layermask[${li}]="0xf" + protocol[${li}]=34 # 0x22 == 34 + done + IFS=$'\n' + ;; + te_ptmp) + expand_port_line "${val}" + IFS=$',' + for li in ${expval}; do + layermask[${li}]="0xf" + protocol[${li}]=2 # 0x2 == 2 + done + IFS=$'\n' + ;; + nt_*) + expand_port_line "${val}" + IFS=$',' + for li in ${expval}; do + layermask[${li}]="0x3" + protocol[${li}]=18 # 0x12 == 18 + done + IFS=$'\n' + ;; + option) + port=`echo "${val}" | sed -e "s/^\([0-9]*\),.*/\1/"` + opt=`echo "${val}" | sed -e "s/^[0-9]*,\(.*\)/\1/"` + + if [ -z ${protocol[${port}]} ]; then + protocol[${port}]="0" + fi + + IFS=$',' + for li in ${opt}; do + protocol[${port}]=$(echo "obase=10;2^(${!li}-1)+${protocol[${port}]}" | bc) + done + IFS=$'\n' + ;; + poll) + poll=${val} + ;; + pcm) + pcm=${val} + ;; + debug) + debug=${val} + ;; + *) + echo "unknown variable: ${var}" + ;; + esac + + done + + echo "-----------------------------------------" + echo " Loading module(s) for your misdn-cards:" + echo "-----------------------------------------" + + card_index=1 + port_index=1 + while [ ! -z ${hfcmulti[${card_index}]} ] || [ ! -z ${other_card[${card_index}]} ]; + do + if [ ! -z ${hfcmulti[${card_index}]} ]; then + # MODPROBE COMMAND FOR hfcmulti CARD + hfcmulti_type="type=" + hfcmulti_prot="protocol=" + hfcmulti_layer="layermask=" + while [ ! -z ${hfcmulti[${card_index}]} ]; + do + hfcmulti_type="${hfcmulti_type}$(echo "obase=16;\"0x\";${hfcmulti[${card_index}]}" | bc )," + let "card_index = ${card_index} + 1" + done + while [ ${hfcports} -gt 0 ]; + do + if [ ! -z ${protocol[${port_index}]} ]; then + hfcmulti_prot="${hfcmulti_prot}$(echo "obase=16;\"0x\";${protocol[${port_index}]}" | bc)," + else + hfcmulti_prot="${hfcmulti_prot}0x2," + fi + if [ ! -z ${layermask[${port_index}]} ]; then + hfcmulti_layer="${hfcmulti_layer}${layermask[${port_index}]}," + else + hfcmulti_layer="${hfcmulti_layer}0xf," + fi + let "port_index = ${port_index} + 1" + let "hfcports = ${hfcports} - 1" + done + hfcmulti_type="$(echo ${hfcmulti_type} | sed -e 's/^\(.*\),$/\1/')" + hfcmulti_prot="$(echo ${hfcmulti_prot} | sed -e 's/^\(.*\),$/\1/')" + hfcmulti_layer="$(echo ${hfcmulti_layer} | sed -e 's/^\(.*\),$/\1/')" + hfcmulti_cmd="modprobe hfcmulti ${hfcmulti_type} ${hfcmulti_prot} ${hfcmulti_layer}" + if [ ! -z ${poll} ]; then + hfcmulti_cmd="${hfcmulti_cmd} poll=${poll}" + fi + if [ ! -z ${pcm} ]; then + hfcmulti_cmd="${hfcmulti_cmd} pcm=${pcm}" + fi + if [ ! -z ${debug} ]; then + hfcmulti_cmd="${hfcmulti_cmd} debug=${debug}" + fi + + echo ${hfcmulti_cmd} + eval ${hfcmulti_cmd} + else + # MODPROBE COMMAND FOR _NON_ hfcmulti CARD + other_cmd="modprobe ${other_card[${card_index}]}" + if [ ! -z ${protocol[${port_index}]} ]; then + other_prot="protocol=$(echo "obase=16;\"0x\";${protocol[${port_index}]}" | bc)," + else + other_prot="protocol=0x2," + fi + if [ ! -z ${layermask[${port_index}]} ]; then + other_layer="layermask=${layermask[${port_index}]}," + else + other_layer="layermask=0xf," + fi + + let "prev = ${card_index}" + let "card_index = ${card_index} + 1" + let "port_index = ${port_index} + 1" + while [ "${other_card[${card_index}]}" == "${other_card[${prev}]}" ]; + do + if [ ! -z ${protocol[${port_index}]} ]; then + other_prot="${other_prot}$(echo "obase=16;\"0x\";${protocol[${port_index}]}" | bc)," + else + other_prot="${other_prot}0x2," + fi + if [ ! -z ${layermask[${port_index}]} ]; then + other_layer="${other_layer}${layermask[${port_index}]}," + else + other_layer="${other_layer}0xf," + fi + let "prev = ${card_index}" + let "card_index = ${card_index} + 1" + let "port_index = ${port_index} + 1" + done + + other_prot="$(echo ${other_prot} | sed -e 's/^\(.*\),$/\1/')" + other_layer="$(echo ${other_layer} | sed -e 's/^\(.*\),$/\1/')" + other_cmd="${other_cmd} ${other_prot} ${other_layer}" + echo "${other_cmd}" + eval ${other_cmd} + fi + done +} + +function unload_card_modules { + + IFS=$'\n' + + for line in $(sed -ne '/^[^#]/p' ${misdn_init_conf}); + do + var=`echo "${line}" | sed -e "s/^\(.*\)=.*/\1/"` + val=`echo "${line}" | sed -e "s/^.*=\(.*\)/\1/"` + + case "${var}" in + card) + nr=`echo "${val}" | sed -e "s/^\([0-9]*\),.*/\1/"` + mod=`echo "${val}" | sed -e "s/^[^,]*,\([^,]*\).*/\1/"` + case "${mod}" in + 0x*) + modulelist[${nr}]=hfcmulti + ;; + *) + modulelist[${nr}]=${mod} + ;; + esac + ;; + esac + + done + + echo "-------------------------------------------" + echo " Unloading module(s) for your misdn-cards:" + echo "-------------------------------------------" + + rmmod_cmd="${RMMOD} ${modulelist[1]}" + echo "${rmmod_cmd}" + eval ${rmmod_cmd} + + index=2 + prev=1 + while [ ! -z ${modulelist[${index}]} ]; + do + if [ ${modulelist[${index}]} != ${modulelist[${prev}]} ]; then + rmmod_cmd="${RMMOD} ${modulelist[${index}]}" + echo "${rmmod_cmd}" + eval ${rmmod_cmd} + fi + let "prev = ${index}" + let "index = ${index} + 1" + done +} + +function create_misdn_init_conf { + + cardcount=1 + cardconf="" + IFS=$'\n' + NL=" +" + + function die { + echo "[!!] ${1}" + exit 1 + } + + function addcard { + cardline="${cardline}card=${cardcount},${1}${NL}" + let "cardcount = ${cardcount} + 1" + } + + function addport { + let "portcount = ${portcount} + ${1}" + } + + portcount=0 + + for line in $(${LSPCI} -n -d 1397:30b1); do + addcard "0x1" + addport 1 + done + for line in $(${LSPCI} -n -d 1397:08b4); do + addcard "0x4" + addport 4 + done + for line in $(${LSPCI} -n -d 1397:16b8); do + addcard "0x8" + addport 8 + done + for line in $(${LSPCI} -n | grep "1397:\(2bd\(0\|6\|7\|8\|9\|a\|b\|c\)\|b100\)\|1043:0675\|0871:ffa\(1\|2\)\|1051:0100\|15b0:2bd0\|114f:007\(0\|1\|2\|3\)\|13d1:2bd1\|182d:3069"); do + addcard "hfcpci" + addport 1 + done + for line in $(${LSPCI} -n -d 1244:0xa00); do + addcard "avmfritz" + addport 1 + done + + if [ "${1}" == "scan" ]; then + echo "[OK] found the following devices:" + echo "${cardline}[ii] run \"/etc/init.d/misdn-init config\" to store this information to ${misdn_init_conf}" + else + + index=1 + portline="te_ptmp=" + while [ ${index} -le ${portcount} ]; do + portline="${portline}${index}," + let "index = ${index} + 1" + done + portline="$(echo ${portline} | sed -e 's/^\(.*\),$/\1/')" + + misdn_cfg_pt1="# +# Configuration file for your misdn hardware +# +# Usage: /etc/init.d/misdn-init start|stop|restart|config|scan|help +# + +# +# Card Settings +# +# Syntax: card=,[,