Basics
My configuration:
<===>a/b (and door bell)
|
|
extern<===>NTBA<===>HFC-S(TE)<===>Asterisk<===>HFC-S(NT)<===>ISDN-PBX
| |
| |
| <===>internal S0 (with internal phones)
|
<===>VoIP (SIP and IAX2)ISDN:
TE mode is used for connection between PBX and NTBA.
NT mode is used for transparent connection, e.g. PBX and internal S0 bus.
| Group 2 | Group 1 | Mode | ||
|---|---|---|---|---|
| b2 | a2 | b1 | a1 | |
| 6 | 3 | 5 | 4 | TE-Mode |
| 5 | 4 | 6 | 3 | NT-Mode |
| yellow | black | green | red or brown |
Codecs
| Codec number | Codec | Bitrate |
|---|---|---|
| G.711 | ulaw | 64kbps |
| G.711 | alaw | 64kbps |
| G.726 | ADPCM | 16/24/32/40 kbps |
| G.729 | 8 kbps (requires license) | |
| GSM | 13kbps |
http://www.readytechnology.co.uk/open/ipp-codecs-g729-g723.1/
ISDN
__
___| |____
| |
| 12345678 |
------------For crossed cable:

Twisted-Pair-Kabel Steckerbelegung und Pinbelegung
für Netzwerk- und ISDN-Kabel bzw. -Dosen RJ45
Stecker: RJ45 (HIROSE)
Kabel: Cat.5-Leitung, 100 Ohm Wellenwiderstand, geschirmt/ungeschirmt
Verwendung: Ethernet 10/100 MBit/s, Twisted-Pair, 10/100-Base-T/x, ISDN
Pin Ethernet [A] [B] [E] [I] ISDN Pin
--------------------------------------------------------------------------------------
1 Transmit Data + grün/weiß rot/weiß braun/weiß 1
2 Transmit Data - grün rot braun 2
3 Receive Data + rot/weiß grün/weiß blau/weiß braun/weiß A2 3
4 ungenutzt - blau blau blau A1 4
5 ungenutzt + blau/weiß blau/weiß blau/weiß B1 5
6 Receive Data - rot grün blau braun B2 6
7 ungenutzt + braun/weiß braun/weiß 7
8 ungenutzt - braun braun 8
STANDART-KABEL 1:1 "Plain/Normal/Straight":
Die Stecker an beiden Enden werden mit dem gleichen Farbcode belegt.
Ethernet: entweder beide Enden mit Farbcode [A] oder beide [B]
(HUB <-> PC oder HUB <-> HUB)
ISDN: beide Enden mit Farbcode [I]
(Telefon <-> Anlage oder Dose <-> Dose)
GEKREUZTES KABEL "Crossed":
Jeweils ein Stecker wird mit Farbcode [A] und
(der am anderen Ende) mit Farbcode [B] belegt.
Ethernet: (PC <-> PC oder auch HUB <-> HUB)
EINZELDOSEN: Kabel <-> Dose Farbcode:
Ethernet Pin 1,2,3,6 <-> Pin 1,2,3,6 entweder beide [A] oder beide [B]
ISDN Pin 3,4,5,6 <-> Pin 3,4,5,6 beide [I]
DOPPELDOSEN: Kabel <-> Dose
1. Buchse: Ethernet Pin 1,2,3,6 [B] <-> Pin 1,2,3,6 [B]
2. Buchse: Ethernet Pin 4,5,7,8 [E] <-> Pin 1,2,3,6 [B]
(Kabel:braun<->Dose:rot und Kabel:blau<->Dose:grün verbinden)
2. Buchse: ISDN Pin 4,5,7,8 [I] <-> Pin 3,4,5,6 [B]
(Kabel:braun<->Dose:grün und Kabel:blau<->Dose:blau verbinden)
WICHTIG: die Buchsen der Dose sollten nach unten zeigen (Staubfang) !
Mit dieser Pinbelegung ist es möglich 2 Anschlüsse mit einem Kabel zu bedienen.
Dabei muß darauf geachtet werden, daß das Ende des Kabels, welches die
Doppeldose bedient auch 2 Stecker bekommt !
Beide Enden müssen die gleichen Farbcodes wie die Dose aufweisen:
also zweimal Farbcode B für zwei Ethernet-Anschlüsse bzw.
einmal Farbcode B für das Kabelende von der ersten Buchse (Ethernet) und
einmal Farbcode I für das Kabelende von der zweiten Buchse (ISDN).
PINBELEGUNG BUCHSE "RJ-45":
(Draufsicht: dort wo der Stecher hineinkommt)
----------
|12345678|
| |
---| |---
----
PINBELEGUNG STECKER "RJ-45":
(Draufsicht: so herum kommt er in die Buchse hinein)
/--------/|
/12345678/ |
/--------/ /
/ / /|
|--------| /-- <- Nase am Stecker
| () | /
---()-----
()
Kabel -> ()
()
MOH
be sure that /usr/ports/net/asterisk-addons/ is installed.
Edit the file /usr/local/etc/asterisk/musiconhold.conf
[[default]]
mode=files
directory=/usr/local/moh-asterisk
random=yesNow copy the mp3s in the folder /usr/local/moh-asterisk and restart asterisk. You can test MoH with editing extensions.conf:
exten => 50,1,Answer
exten => 50,2,MusicOnHold
exten => 50,3,HangUpNow dial 50 and you should hear MoH.
CDR
Create a file mysql_odbc:
[[MySQL]]
Description = MySQL ODBC MyODBC Driver
Driver = /usr/local/lib/libmyodbc3.so
FileUsage = 1Then load the file with:
odbcinst -i -d -f mysql_odbcCreate a file mysql_odbc_ini:
[[MySQL-asterisk]]
Description = MySQL ODBC Driver Testing
Driver = MySQL
Socket = /tmp/mysql.sock
Server = localhost
User = username
Password = password
Database = asteriskcdrdb
Option = 3
- Port ======Then load the file with:
odbcinst -i -s -f mysql_odbc_iniTo test it:
isql MySQL-asterisk <username> <password>Create the file /usr/local/etc/asterisk/cdr_odbc.conf:
;
; cdr_unixodbc.conf
;
[[global]]
dsn=MySQL-asterisk
username=<username>
password=<password>
loguniqueid=yesCreate the following table in the mysql database:
CREATE TABLE cdr (
calldate datetime NOT NULL default '0000-00-00 00:00:00',
clid varchar(80) NOT NULL default //,
src varchar(80) NOT NULL default //,
dst varchar(80) NOT NULL default //,
dcontext varchar(80) NOT NULL default //,
channel varchar(80) NOT NULL default //,
dstchannel varchar(80) NOT NULL default //,
lastapp varchar(80) NOT NULL default //,
lastdata varchar(80) NOT NULL default //,
duration int(11) NOT NULL default '0',
billsec int(11) NOT NULL default '0',
disposition varchar(45) NOT NULL default //,
amaflags int(11) NOT NULL default '0',
accountcode varchar(20) NOT NULL default //,
uniqueid varchar(32) NOT NULL default //,
userfield varchar(255) NOT NULL default // ```
);Capi
For active ISDN cards with FreeBSD 5.x use Capi for BSD from the side http://www.shellbang.org/freebsd/introducingc4b.html and http://www.shellbang.org/freebsd/asteriskcapi.html .
For FreeBSD 6.x and newer use I4B (active cards are not working right now (ITK TK1)).
Get the new version with subversion:
mkdir -p /usr/local/src/i4b
cd !$
svn --username anonsvn --password anonsvn checkout svn://svn.turbocat.net/i4bGo to the directory:
/usr/local/src/i4b/i4b/trunk/i4b/modulecompile module with:
make depend all installcd ../src/sys/dev/usb
cp usb_subr*[[ch]] /usr/src/sys/dev/usb/
make -C /usr/src/sys/modules/usb all installok now it’s time to reboot. After the pc is up again, load the kernel modules with:
kldload usb
kldload i4bIf you got an error message here be sure that usb is not included in the kernel, remove it recompile kernel and reboot again.
To debug use:
isdnconfig -u 0 -p DRVR_DSS1_NT
isdndecode -u 0 -i -o -x
cd /usr/local/src/i4b/i4b/trunk/i4b/FreeBSD.i4benter
make distclean
make clean
make S=../src package
make install
make install-userspaceConfigure the Kernelconfiguration
# I4B section
#
options IPR_VJ
device "i4bdss1"
device "i4b"
device "i4btrc"
device "i4bctl"
device "i4brbch"
device "i4btel"
device "i4bipr"
device "i4bisppp"
#
device ihfc
device usb
device pcm
#or device sound
#if device pcm does not existRecompile the kernel with (my kernel file is SERVER2, use your file here)
cd /usr/src && make buildkernel installkernel KERNCONF=SERVER2_I4B -DNOCLEAN -DNO_CLEANThe Backupkernel can be found under:
/usr/local/src/i4b/i4b/devfs/trunk/FreeBSD.i4b/kernelReboot the system.
Now we can test if the isdn card is working. I use two ISDN cards, one in NT mode (device 0) and one in TE mode (device 1). For the device 0 (NT-mode) a crosslink ISDN cable is necessary. Connect for TE mode your ISDN card to your ISDN bus (ISDN phone has number *93 at home). Connect for NT mode a phone to a NTBA with a crosslinked cable (ISDN phone has number 93).
isdnconfig -u 0 -p DRVR_DSS1_NT
capitest -u 0 -o "93"
capitest -u 1 -o "*93"For both tests the phone should ring.
Now compile and install the chan_capi module:
cd /usr/local/src/i4b/i4b/trunk/chan_capi
gmake
gmake install
gmake cleanNow make the configuration in asterisk. Edit capi.conf:
[general]
nationalprefix=0
internationalprefix=00
rxgain=1.0
txgain=1.0
digit_timeout=2
[ISDNTE] ;this example interface gets name 'ISDN1' and may be any
;name not starting with 'g' or 'contr'.
isdnmode=msn ;'MSN' (point-to-multipoint)
incomingmsn=* ;allow incoming calls to this list of MSNs/DIDs, * == any
controller=1 ;ISDN4BSD default (first controller)
group=1 ;dialout group
;prefix=0 ;set a prefix to calling number on incoming calls
softdtmf=on ;enable/disable software dtmf detection, recommended for AVM cards
relaxdtmf=on ;in addition to softdtmf, you can use relaxed dtmf detection
accountcode= ;Asterisk accountcode to use in CDRs
context=capi-extern ;context for incoming calls
holdtype=local ;when Asterisk puts the call on hold, ISDN HOLD will be used. If
;set to 'local' (default value), no hold is done and Asterisk may
;play MOH.
;immediate=yes ;immediate start of pbx with extension 's' if no digits were
;received on incoming call (no destination number yet)
echocancel=no ;disable echo canceller
echosquelch=no ;primitive echo suppression
;echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for older eicon drivers)
;echotail=64 ;echo cancel tail setting
;bridge=yes ;native bridging (CAPI line interconnect) if available
;callgroup=1 ;Asterisk call group
;deflect=1234567 ;deflect incoming calls to 1234567 if all B channels are busy
devices=2 ;number of concurrent calls on this controller
;(2 makes sense for single BRI, 30 for PRI)
[ISDNNT] ;this example interface gets name 'ISDN1' and may be any
;name not starting with 'g' or 'contr'.
isdnmode=did ;'MSN' (point-to-multipoint)
ntmode=yes
incomingmsn=* ;allow incoming calls to this list of MSNs/DIDs, * == any
controller=0 ;ISDN4BSD default (first controller)
group=1 ;dialout group
;prefix=0 ;set a prefix to calling number on incoming calls
softdtmf=on ;enable/disable software dtmf detection, recommended for AVM cards
relaxdtmf=on ;in addition to softdtmf, you can use relaxed dtmf detection
accountcode= ;Asterisk accountcode to use in CDRs
context=capi-intern ;context for incoming calls
holdtype=local ;when Asterisk puts the call on hold, ISDN HOLD will be used. If
;set to 'local' (default value), no hold is done and Asterisk may
;play MOH.
;immediate=yes ;immediate start of pbx with extension 's' if no digits were
;received on incoming call (no destination number yet)
echocancel=yes ;disable echo canceller
echosquelch=no ;primitive echo suppression
;echocancelold=yes;use facility selector 6 instead of correct 8 (necessary for older eicon drivers)
;echotail=64 ;echo cancel tail setting
bridge=yes ;native bridging (CAPI line interconnect) if available
;callgroup=1 ;Asterisk call group
;deflect=1234567 ;deflect incoming calls to 1234567 if all B channels are busy
devices=2 ;number of concurrent calls on this controller
;(2 makes sense for single BRI, 30 for PRI)Write e.g. the following in your extensions.conf:
[capi-in]
exten => 97,1,Ringing
exten => 97,2,Set(LANGUAGE()=de)
exten => 97,3,GotoIf($["${CALLERID}" = "91"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,4,GotoIf($["${CALLERID}" = "92"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,5,GotoIf($["${CALLERID}" = "93"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,6,GotoIf($["${CALLERID}" = "94"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,7,GotoIf($["${CALLERID}" = "12"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,8,GotoIf($["${CALLERID}" = "13"]?97,1000) ; Myself, move to voicemail Menu
exten => 97,9,GotoIf($["${CALLERID}" = ""]?97,2000) ; No dialnumber move to voicemail
exten => 97,10,DIAL(${IDEFIXGROUP})
exten => 97,11,Hangup
exten => 97,1000,Answer
exten => 97,1001,VoicemailMain(2000) ; hear voicemail
exten => 97,1002,Hangup
; Caller without number, wait and then transfer to voicemail
exten => 97,2000,DIAL(${IDEFIXGROUP},15,j) ; No dialnumber, move to voicemail after some seconds
exten => 97,2001,Answer
exten => 97,2002,Voicemail(u2000)
exten => 97,2003,Hangup
; No callerid, no phone available
exten => 97,2101,Wait(15)
exten => 97,2102,Answer
exten => 97,2103,Voicemail(u2000)
exten => 97,2104,Hangup
[iax-out]
; Call from VoIP to ISDN
exten => _*.,1,Dial(CAPI/ISDN1/98:${EXTEN:1})
exten => _*.,2,Congestion
exten => _*.,3,HangUpNow we must fix the permission problem with the capi device. For this we edit the file /etc/devfs.conf:
own capi20 root:asterisk
perm capi20 0660Restart asterisk with:
asterisk -r
restart gracefullyCAPI from ports
To simplify installation Hans Petter moved everything to ports. To install by ports download it with:
svn --username anonsvn --password anonsvn \
checkout svn://svn.turbocat.net/i4b/trunk/portsCleanup old files:
rm -f /usr/lib/libcapi*
rm -f /usr/share/man/*/i4b*
rm -f /usr/share/man/*/ihfc*
rm -f /usr/share/man/*/iavc*
rm -f /usr/share/man/*/capi20*
rm -f /usr/sbin/isdn*
rm -f /usr/sbin/capi*
rm /boot/kernel/i4b.koTo install or upgrade:
svn up
cd comms
cd libcapi
make deinstall
make all install clean
cd ..
cd isdn4bsd-kmod
make deinstall
make all install clean
cd ..
cd isdn4bsd-utils
make deinstall
make all install clean
cd ..
cd chan_capi
make deinstall
make all install clean
cd ..
rebootDebugging ISDN Protocol
You can trace the protocol with:
isdndecode -u 1 -i -o -xHardphones
- The Grandstream GXP-2000 is working fine here with firmware 1.1.0.13.
- Linksys SPA-941/942 I recommend the Linksys/Cisco/Sipura SPA-941
- Polycom 501/601
- Cisco 7960
- Polycom 301
- Snom 320/360
The pa1688 soon to be ra-1688 chipp speaks iax/sip/h323 Yughen phones YWH 10/12 YWH 100/110 to stata a few.
Yughen phones speak iax. ywh10 ywh12 ywh10 to point out a few PA 1688 chip set now new ar 1688 chip
http://www.voip-info.org/wiki/view/VOIP+Phones+Reviews
Good phones could be:
- Zulty WIP 2 (Wireless via WLAN) (http://www.zultys.com/index.jsp?tab=productdetail&product=wip2&detail=datasheet-wip2&type=phones )
- hard phone- The Aastra 480i (http://www.aastratelecom.com )
- cellphone and WiFi phone: http://www.abptech.com/products/Pirelli/DPL10.html doro isdn 2600 (ISDN wireless)
Softphones
IAX2 Software:
http://www.marccharbonneau.com/asterisk/mediaxphone.php
SIP Software:
http://www.kapanga.net/IP/home.cfm
Sipgate
Edit sip.conf and sip_custom.conf replace
sip.conf:
[general]
...
disallow=all ; First disallow all codecs
;allow=speex
allow=alaw
allow=ulaw ; Allow codecs in order of preference
allow=g729
allow=slinear
allow=gsm
allow=ilbc ; Note: codec order is respected only in [general]
nat=yes
register => <userid>:<password>@sipgate.de/<userid>sip_custom.conf
[sipgate-out]
type=friend
context=incoming_sipgate
username=<userid>
fromuser=<userid>
authuser=<userid>
secret=<password>
host=sipgate.de
fromdomain=sipgate.de
;dtmfband=inband
insecure=very ; otherwise I get authentication errors
nat=yes
qualify=yes
canreinvite=no
[200]
type=friend
username=testuser
secret=geheim
host=dynamic
dtmfmode=rfc2833
context=sip-out
canreinvite=no
mailbox=2000@defaultEdit extensions_custom.conf:
[incoming_sipgate]
exten => <userid>,1,Ringing
exten => <userid>,2,Set(LANGUAGE()=de)
exten => <userid>,3,DIAL(${IDEFIXGROUP})
exten => <userid>,4,Hangup
exten => _X.,1,NoOp(--- ${CALLERID} calling on sipgate (${EXTEN}) ---)
exten => _X.,2,Set(LANGUAGE()=de)
exten => _X.,3,Ringing
exten => _X.,4,Wait,4
exten => _X.,5,Answer
exten => _X.,6,Playback(invalid)
exten => _X.,7,Hangup
[sip-out]
include => sip-sipgate-out
[sip-sipgate-out]
exten => _1XXX.,1,SetCallerId(<userid>)
exten => _1XXX.,2,Dial(SIP/${EXTEN:1}@sipgate-out,,trRg)
exten => _1XXX.,3,HangupSipport
Sipport can use SIP and IAX2 so I splitted it into two sections.
SIP
Replace
[general]
...
qualify=yes
disallow=all ; First disallow all codecs
;allow=speex
allow=alaw
allow=ulaw ; Allow codecs in order of preference
allow=g729
allow=slinear
allow=gsm
allow=ilbc ; Note: codec order is respected only in [general]
nat=yes
register => <userid>:<password>@sip.sipport.deEdit sip_custom.conf
[sipportunity-out]
type=friend
context=incoming_portunity
username=<userid>
fromuser=<userid>
authuser=<userid>
secret=<password>
host=sip.sipport.de
fromdomain=sip.sipport.de
;dtmfband=inband
;insecure=very ; otherwise I get authentication errors
nat=yes
qualify=yes
canreinvite=no
[200]
type=friend
username=testaccount
secret=geheim
host=dynamic
dtmfmode=rfc2833
context=sip-out
canreinvite=no
;callerid=5550273
mailbox=2000@defaultThe incoming rule [incoming-portunity] for IAX2 and SIP is equal, edit extensions_custom.conf:
[incoming-portunity]
exten => s,1,DIAL(${IDEFIXGROUP})
exten => s,2,Hangup
;exten => s,1,NoOp(--- ${CALLERID} calling on portunity over IAX2 (${EXTEN}) ---)
;exten => s,2,Set(LANGUAGE()=de)
;exten => s,3,Ringing
;exten => s,4,Wait,4
;exten => s,5,Answer
;exten => s,6,Playback(invalid)
;exten => s,7,Hangup
[sip-out]
include => sip-sipport-out
...
[sip-sipport-out]
; with leading 2 using SIP-sipport
exten => _2XXX.,1,Dial(SIP/${EXTEN:1}@sipportunity-out,,trRg)
exten => _2XXX.,2,HangupIAX2
Replace
[general]
...
register => <userid>:<password>@iax.iaxport.deEdit iax_custom.conf:
[portunity-out]
type=peer
host=iax.iaxport.de
username=<userid>
secret=<password>
;peercontext=iaxport
context=incoming-portunity
;notransfer=yes
[portunity-in]
type=user
context=incoming-portunity
permit=82.139.223.1/255.255.255.255
disallow=all
allow=ulaw ; asterisk 1.2.8 seems to have a codec problem so force it to ulaw
;allow=alaw
;allow=gsm
[202]
type=friend
host=dynamic
context=iax-out
username=testaccount
secret=geheim
permit=192.168.0.0/255.255.255.0
mailbox=2000@default
notransfer=1The dialin context [incoming-portunity] is for IAX2 and SIP equal, edit extensions_custom.conf:
[incoming-portunity]
exten => s,1,DIAL(${IDEFIXGROUP})
exten => s,2,Hangup
;exten => s,1,NoOp(--- ${CALLERID} calling on portunity over IAX2 (${EXTEN}) ---)
;exten => s,2,Set(LANGUAGE()=de)
;exten => s,3,Ringing
;exten => s,4,Wait,4
;exten => s,5,Answer
;exten => s,6,Playback(invalid)
;exten => s,7,Hangup
[iax-out]
include => iax2-sipport-out
[iax2-sipport-out]
; with leading 3 using IAX-sipport
exten => _3XXX.,1,Dial(IAX2/portunity-out/${EXTEN:1},,trRg)
exten => _3XXX.,2,HangupBLF
Edit extensions_custom.conf:
...
[iax-out]
include => internal
...
[sip-out]
include => internal
...
[internal]
include => hint
exten => 200,1,Dial(SIP/200)
exten => 200,2,Hangup
exten => 201,1,Dial(SIP/201)
exten => 201,2,Hangup
exten => 202,1,Dial(IAX2/202)
exten => 202,2,Hangup
[hint]
exten => 200,hint,SIP/200
exten => 201,hint,SIP/201
exten => 202,hint,IAX2/202
...Edit sip.conf:
[general]
...
subscribecontext=hint
...Reload asterisk and control it with:
asterisk -r
reload
show hintsYou should see something like:
-= Registered Asterisk Dial Plan Hints =-
202 : IAX2/202 State:Idle Watchers 1
201 : SIP/201 State:Idle Watchers 1
200 : SIP/200 State:Unavailable Watchers 1
----------------
- 3 hints registeredNow configure your phone to display the status.
Fax
We will use iaxmodem and hylafax.
Install necessary software:
cd /usr/ports/comms/spandsp-devel
make install
cd /usr/ports/net/iaxmodem/
make install
cd /usr/ports/comms/hylafax
make installAsterisk can receive and send fax with spandsp and the application app_rxfax and app_txfax. Test the script with:
/usr/local/share/asterisk/scripts/fax2mail "54" "" "1" "email" "/var/spool/asterisk/fax/1157137152.7"Receiving a fax
Edit the extensions.conf:
; =========== START fax stuff ===========
[macro-faxreceive]
exten => s,1,Wait(3)
exten => s,n,SetVar(SCRIPTFILE=/usr/local/share/asterisk/scripts/fax2mail)
exten => s,n,SetVar(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID})
exten => s,n,SetVar(MAILADDR=idefix@fechner.net)
exten => s,n,rxfax(${FAXFILE})
exten => s,n,system("${SCRIPTFILE}" "${CALLERIDNUM}" "${CALLERIDNAME}" "${FAXPAGES}" "${MAILADDR}" "${FAXFILE}")
[fax]
exten => 666,1,Macro(faxreceive)
exten => 666,2,Hangup
; ^^^^^^^^^^^^^^ END fax stuff ^^^^^^^^^^^^^^ Install perl modules:
cd /usr/ports/mail/p5-MIME-Lite
make install cleanUse the script /usr/local/share/asterisk/scripts/fax2mail:
#!/usr/local/bin/perl
use strict;
use MIME::Lite;
use File::Temp qw(tempdir);
my $emailFrom= 'email';
my $faxFrom=shift(@ARGV);
my $faxFromName=shift(@ARGV);
my $faxPages=shift(@ARGV);
my $emailTo=shift(@ARGV);
my $file=shift(@ARGV);
system("tiff2pdf -o $file.pdf -j $file");
my $mail=new MIME::Lite(
From => $emailFrom,
To => $emailTo,
Type => 'text/plain; charset=iso-8859-1',
Subject => sprintf('Fax from %s (%s)',$faxFrom,$faxPages),
Data => sprintf('Fax station ID of the sender..: %s
Caller-ID of the sender.......: %s
Number of pages...............: %d',$faxFrom,$faxFromName,$faxPages)
);
$mail->attach(
Type => 'application/pdf',
Filename => sprintf('Fax.pdf'),
Path => "$file.pdf"
);
$mail->send();
unlink("$file.pdf"); Sending a Fax
Download http://www.inter7.com/eps/eps-1.5.tar.gz .
tar xzvf eps-1.5.tar.gz
cd eps-1.5Edit Makefile:
LIBDIR = /usr/local/lib
INCDIR = /usr/local/include/epsCompile and install it with:
make
make install
make cleanDownload http://www.inter7.com/astfax/astfax-1.0.tar.gz .
tar xzvf astfax-1.0.tar.gz
cd astfax-1.0Edit Makefile:
DEFS=-Wall -I/usr/local/include/eps -DVERSION=1.0
LIBS=-leps -L/usr/local/libCompile it with:
makeNow we configure ast_fax by editing the file ast_fax.call:
Channel: CAPI/ISDNTE/FROMNUMBER:$[[PHONE]]/b
MaxRetries: 0
WaitTime: 20
Application: txfax
Data: $[[FILE]]|callerNow we can test if astfax works correctly:
cp testfax.eml my_testfax.emlEdit my_testfax.eml.
From: <idefix@fechner.net>
To: <54@fax>Now send it with:
cat my_testfax.eml|./ast_faxAdding G.722 - Support
To add support for G.722, decompress and copy this File to /usr/local/lib/asterisk/modules/:
Download compressed codec here: Codec g722.so.tar.bz2
It’s possible the File “libpthread.so.0” is missing. You can avoid this by creating /etc/libmap.conf
and add/enter the following code:
[/usr/local/lib/asterisk/modules/codec_g722.so]
libpthread.so.0 libpthread.so.2LDAP Lookup
For asterisk 1.4 I used an asterisk addon that searches the name for the given phonenumber in my ldap directory. With the update of asterisk to version 1.6 that addon stops compiling. I replaced now the line:
exten => s,n,Set(CALLERID(name)=${SHELL(ldapsearch -w password -D "cn=x,dc=x,dc=x" -h localhost -b "ou=people,dc=x,dc=x" -s children
"(&(objectClass=person)(|(telephoneNumber=${CALLERID(number)})(otherPhone=${CALLERID(number)})(primaryPhone=${CALLERID(number)})
(companyPhone=${CALLERID(number)})(mobile=${CALLERID(number)})(homePhone=${CALLERID(number)})(pager=${CALLERID(number)})
(primaryPhone=${CALLERID(number)})))" cn | grep ^cn |
perl -MMIME::Base64 -lpe 's/^([^:]*:):(\s*)(.*)/"$1$2".decode_base64($3)/e' |cut -d: -f2 | xargs echo -n)})