#!/bin/bash
# Vorarbeiten
mkdir /etc/iaxmodem/save
mv /etc/asterisk/extension* /etc/asterisk/save/
mv /etc/asterisk/iax* /etc/asterisk/save/
mv /etc/asterisk/misdn.conf /etc/asterisk/save/
mv /etc/iaxmodem/* /etc/asterisk/save/
echo "Bitte sage mir deine Faxnummer ohne Vorwahlen"
read faxnummer
echo "sage mir nur deine Vorwahl z.b. 08331 für Memmingen"
read vorwahl
cat <<EOF > /etc/asterisk/iaxprov.conf
[*]
template=iax
EOF
cat <<EOF > /etc/asterisk/iax.conf
[general]
allow=alaw,ulaw
disallow=slin16
bandwidth=high
delayreject=yes
bindport=4569
bindaddr=0.0.0.0
[fax]
callerid=$vorwahl$faxnummer
context=iax
host=dynamic
ipaddr=127.0.0.1
name=fax
port=4570
type=friend
permit=127.0.0.1
secret=12345
EOF
cat <<EOF > /etc/asterisk/extensions.conf
[iax]
exten => _.*,1,Set(CHANNEL(transfercapability(3K1AUDIO)))
exten => _.*,2,Dial(mISDN/g:isdn-extern/${EXTEN}/e0:vt0)
; der "/e0:vt0" ist so richtig das komma ist falsch "," !
[isdn-extern]
exten => _.*,1,Set(CHANNEL(transfercapability(3K1AUDIO)))
exten => _.*,2,misdn_set_opt(e0:vt0)
exten => _.*,3,Dial(IAX2/fax)
[isdn-intern]
exten => _.*,1,Set(CHANNEL(transfercapability(3K1AUDIO)))
exten => _.*,2,misdn_set_opt(e0:vt0)
exten => _.*,3,Dial(IAX2/fax)
EOF
cat <<EOF > /etc/asterisk/misdn.conf
[general]
misdn_init=/etc/misdn-init.conf
debug=0
ntdebugflags=0
ntdebugfile=/var/log/misdn-nt.log
ntkeepcalls=no
bridging=no
stop_tone_after_first_digit=yes
append_digits2exten=yes
dynamic_crypt=no
[default]
context=isdn-intern
language=de
musicclass=default
senddtmf=yes
far_alerting=no
allowed_bearers=all
nationalprefix=0
internationalprefix=00
rxgain=0
txgain=0
te_choose_channel=no
pmp_l1_check=no
reject_cause=16
need_more_infos=no
nttimeout=no
method=standard
overlapdial=yes
early_bconnect=yes
incoming_early_audio=no
nodialtone=no
presentation=-1
screen=-1
echocancel=128
jitterbuffer=0
hdlc=no
max_incoming=-1
max_outgoing=-1
astdtmf=yes
[isdn-extern]
ports=1
context=isdn-extern
msns=*
language=de
[isdn-intern]
ports=2
context=isdn-intern
msns=*
language=de
EOF
cat <<EOF > /etc/iaxmodem/ttyIAX0
device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 50
server 127.0.0.1
peername fax
secret 12345
codec alaw
EOF
mkdir -p /var/spool/hylafax/dev
cp -a /dev/null /var/spool/hylafax/dev/
cp -a /dev/random /var/spool/hylafax/dev/
cp -a /dev/urandom /var/spool/hylafax/dev/
cp -a /dev/zero /var/spool/hylafax/dev/
echo '
Bitte beachte das
/var/spool/hylafax/etc/config.ttyIAX0
richtig configuriert ist:
ModemType: Class1
ModemResetCmds: "ATH1\nAT+VCID=1"
ModemReadyCmds: ATH0
Class1AdaptRecvCmd: AT+FAR=1
Class1TMConnectDelay: 400 # counteract quick CONNECT response
Class1RMQueryCmd: "!24,48,72,96" # V.17 fast-train recv doesn t work well
CallIDPattern: "NMBR="
CallIDPattern: "NAME="
CallIDPattern: "ANID="
CallIDPattern: "NDID="
'