Inhaltsverzeichnis

Schritt 1: DNSMasq einrichten

Folgende Konfiguration in der /etc/dnsmasq.conf o.ä. kopieren:

# deactivate DNS
port=0
# listen on specific interface and/or address
interface=eth0
#listen-address=192.168.1.254
listen-address=10.23.42.254
bind-interfaces
## DHCP configuration
#dhcp-range=192.168.1.10,192.168.1.100
dhcp-range=10.23.42.10,10.23.42.100

dhcp-option=option:router,10.23.42.254
dhcp-option=option:dns-server,8.8.8.8

## TFTP configuration
enable-tftp
tftp-root=/var/tftpboot
dhcp-option=150,10.23.42.254

Dann den dnsmasq im Vordergrund starten:

$ dnsmasq -d

Bei einem OpenWRT-Router kann die Konfiguration auch via UCI hinterlegt werden, zum Beispiel so:

config dnsmasq
        option domainneeded     1
        option boguspriv        1
        option filterwin2k      '0'  #enable for dial on demand
        option localise_queries 1
        option local    '/lan/'
        option domain   'lan'
        option expandhosts      1
        option nonegcache       0
        option authoritative    1
        option readethers       1
        option leasefile        '/tmp/dhcp.leases'
        option resolvfile       '/tmp/resolv.conf.auto'
        #list server            '/mycompany.local/1.2.3.4'
        #option nonwildcard     1
        #list interface         br-lan
        #list notinterface      lo
        option enable_tftp             1
        option tftp_root               /srv/tftp

config dhcp lan
        option interface        lan
        option start    100
        option limit    150
        option leasetime        12h
        list 'dhcp_option' '150,192.168.1.254'


config dhcp wan
        option interface        wan
        option ignore   1

Die Konfiguration wird mittels uci commit dhcp im System gespeichert. Natürlich muss hier noch das Verzeichnis /srv/tftp angelegt werden. Die Konfigurationsdateien gehören in dieses Verzeichnis. Via logread kann man dann die Debug-Ausgaben des dnsmasq sehen.

Wenn das Telefon mit Strom versorgt wird, sollte es versuchen, seine IP zu konfigurieren und die Konfigurationsdatei zu laden. Das sieht so aus:

$ sudo dnsmasq -d -i eth0 
dnsmasq: started, version 2.59 DNS disabled
dnsmasq: compile time options: IPv6 GNU-getopt DBus i18n DHCP TFTP conntrack IDN
dnsmasq-dhcp: DHCP, IP range 192.168.1.10 -- 192.168.1.100, lease time 1h
dnsmasq-tftp: TFTP root is /var/tftpboot 
dnsmasq-dhcp: DHCPDISCOVER(eth0) 172.16.2.4 00:15:c6:16:b8:29 
dnsmasq-dhcp: DHCPOFFER(eth0) 192.168.1.47 00:15:c6:16:b8:29 
dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.1.47 00:15:c6:16:b8:29 
dnsmasq-dhcp: DHCPACK(eth0) 192.168.1.47 00:15:c6:16:b8:29 SIP0015C616B829
dnsmasq-tftp: file /var/tftpboot/OS79XX.TXT not found
dnsmasq-tftp: file /var/tftpboot/SIPDefault.cnf not found
dnsmasq-tftp: file /var/tftpboot/SIP0015C616B829.cnf not found

Nun fehlt noch die Konfiguration (siehe die letzten drei Zeilen in obiger Ausgabe). Eine passende Konfiguration findet sich z.B. hier. Die beiden Konfigurationsdateien müssen natürlich entsprechend angepasst werden. Danach sollte das Telefon sauber booten.

SIPDefault.cnf

# CISCO 7960G Beispiel Konfiguration für FritzBox 7170
# An den Stellen wo "FritzBox IP" steht muss die IP Adresse der FritzBox eingetragen werden
# An den Stellen wo "Webserver IP" steht muss die IP Adresse eines Webserver mit XML Service eingetragen werden
# Wird diese Funktionalität nicht genutzt, bitte auskommentiert lassen
#
# Image Version
# image_version: "P0S3-08-8-00"        Auskommentiert da SIP Firmware schon geladen ist

# Proxy Server
#proxy1_address: ""       Auskommentiert da in der SIP<MAC>.cnf schon vergeben
#proxy2_address: ""
#proxy3_address: ""
#proxy4_address: ""
#proxy5_address: ""
#proxy6_address: ""

# Proxy Server Port (default - 5060)   Auskommentiert da in der SIP<MAC>.cnf schon vergeben
#proxy1_port:"5060"
#proxy2_port:""
#proxy3_port:""
#proxy4_port:""
#proxy5_port:""
#proxy6_port:""


# Emergency Proxy info
proxy_emergency: "192.168.255.1"
proxy_emergency_port: "5060"

# Backup Proxy info
#proxy_backup: ""
#proxy_backup_port: "5060"

# Nur einmal definieren -> daher in SIPMAC.cnf
# Outbound Proxy info
# outbound_proxy: ""
# outbound_proxy_port: "5060"

# NAT/Firewall Traversal
nat_enable: "1"
#nat_address: ""
voip_control_port: "5060"
#start_media_port: "16384"
#end_media_port: "32766"
#nat_received_processing: "0"

# Proxy Registration (0-disable (default), 1-enable) Muss auf "1" stehen sonst registriert sich das 7960 nicht an der FritzBox
proxy_register: "1"

# Phone Registration Expiration [1-3932100 sec] (Default - 3600)
timer_register_expires: "3600"

# Codec for media stream (g711ulaw (default), g711alaw, g729)
preferred_codec: "none"

# TOS bits in media stream [0-5] (Default - 5)
tos_media: "5"

# Enable VAD (0-disable (default), 1-enable)
enable_vad: "0"

# Allow for the bridge on a 3way call to join remaining parties upon hangup
cnf_join_enable: "0" ; 0-Disabled, 1-Enabled (default)

# Allow Transfer to be completed while target phone is still ringing
semi_attended_transfer: "0" ; 0-Disabled, 1-Enabled (default)

# Telnet Level (enable or disable the ability to telnet into this phone
telnet_level: "2" ; 0-Disabled (default), 1-Enabled, 2-Privileged

# Inband DTMF Settings (0-disable, 1-enable (default))
dtmf_inband: "1"

# Out of band DTMF Settings (none-disable, avt-avt enable (default), avt_always - always avt )
dtmf_outofband: "0"

# DTMF dB Level Settings (1-6dB down, 2-3db down, 3-nominal (default), 4-3db up, 5-6dB up)
dtmf_db_level: "3"

# SIP Timers
#timer_t1: "500" ; Default 500 msec
#timer_t2: "4000" ; Default 4 sec
#sip_retx: "10" ; Default 11
#sip_invite_retx: "6" ; Default 7
#timer_invite_expires: "180" ; Default 180 sec

# Setting for Message speeddial to UOne box
# Hier habe ich die FritzBox Voice Mail Nummer hinterlegt
messages_uri: "**600"

#********* Release 2 new config parameters **********

# TFTP Phone Specific Configuration File Directory
tftp_cfg_dir: "./"

# Time Server
sntp_mode: "unicast"
sntp_server: "IP eines NTP Servers"
time_zone: "CET"
dst_offset: "0"
dst_start_month: "Jan"
dst_start_day: ""
dst_start_day_of_week: "Mon"
dst_start_week_of_month: "2"
dst_start_time: "02"
dst_stop_month: "Dec"
dst_stop_day: ""
dst_stop_day_of_week: "Sunday"
dst_stop_week_of_month: "1"
dst_stop_time: "2"
dst_auto_adjust: "1"

# Do Not Disturb Control (0-off, 1-on, 2-off with no user control, 3-on with no user control)
dnd_control: "0" ; Default 0 (Do Not Disturb feature is off)

# Caller ID Blocking (0-disabled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
#callerid_blocking: "0" ; Default 0 (Disable sending all calls as anonymous)

# Anonymous Call Blocking (0-disbaled, 1-enabled, 2-disabled no user control, 3-enabled no user control)
#anonymous_call_block: "0" ; Default 0 (Disable blocking of anonymous calls)

# Call Waiting (0-disabled, 1-enabled, 2-disabled with no user control, 3-enabled with no user control)
#call_waiting: "1" ; Default 1 (Call Waiting enabled)

# DTMF AVT Payload (Dynamic payload range for AVT tones - 96-127)
dtmf_avt_payload: "101" ; Default 100

# XML file that specifies the dialplan desired
#dial_template: "syncinfo"

# Network Media Type (auto, full100, full10, half100, half10)
network_media_type: "auto"

#Autocompletion During Dial (0-off, 1-on [default])
autocomplete: "1"

#Time Format (0-12hr, 1-24hr [default])
time_format_24hr: "1"

# URL for external Phone Services - Netter offener Beispiel XML Service:
services_url: "http://phone-xml.berbee.com/menu.xml" 

# URL for external Directory location
#directory_url: "http://IP Adresse Webserver/xmlservices/PhoneDirectory.php"

# URL for branding logo - hier kann ein Logo in 4 Graustufen 320x196 hinterlegt werden
#logo_url: "http://IP Adresse Webserver/background.bmp"

SIP[MAC].cnf

# SIP Configuration Generic File (start)
# CISCO 7960G Beispiel Konfiguration für FritzBox 7170
# An den Stellen wo "FritzBox IP" steht muss die IP Adresse der FritzBox eingetragen werden
# An den Stellen wo "Webserver IP" steht muss die IP Adresse eines Webserver mit XML Service eingetragen werden
# Wird diese Funktionalität nicht genutzt, bitte auskommentiert lassen
#
# Proxy Server
proxy1_address: "192.168.255.1"
proxy2_address: ""
proxy3_address: ""
proxy4_address: ""
proxy5_address: ""
proxy6_address: ""

# Line 1 Settings
line1_name: "7701"                    ; Line 1 Extension\User ID
line1_displayname: "7701"             ; Line 1 Display Name
line1_shortname: "7701"           ; Line 1 Shortname Diplsy Lable
line1_authname: "7701"                   ; Line 1 Registration Authentication
line1_password: "7701"                 ; Line 1 Registration Password

# Line 2 Settings
#line2_name: "Büro"                          ; Line 2 Extension\User ID
#line2_displayname: "Büro"                   ; Line 2 Display Name
#line2_authname: "620"                       ; Line 2 Registration Authentication
#line2_password: "cisco"                     ; Line 2 Registration Password

# Emergency Proxy info
#proxy_emergency: ""
#proxy_emergency_port: "5060"

# Backup Proxy info
#proxy_backup: ""
#proxy_backup_port: "5060"

# Outbound Proxy info
outbound_proxy: "192.168.255.1"
outbound_proxy_port: "5060"

# Test
# Proxy Registration (0-disable (default), 1-enable)
proxy_register: "1"

# NAT/Firewall Traversal
nat_enable: "1"
#nat_address: "FritzBox IP"
#voip_control_port: "5060"
#start_media_port: "16384"
#end_media_port:  "32766"
#nat_received_processing: "1"

# Phone Label (Text desired to be displayed in upper right corner)
phone_label: "test"            ; Has no effect on SIP messaging

# Time Zone phone will reside in
time_zone: EET 

# Telnet Level (enable or disable the ability to telnet into this phone
telnet_level: "2"      ; 0-Disabled (default), 1-Enabled, 2-Privileged

# Phone prompt/password for telnet/console session
#phone_prompt: ""                              ; Telnet/Console Prompt
#phone_password: ""                          ; Telnet/Console Password

# Enable_VAD (1-enabled, 0-disabled)
enable_vad: "0"

# Network Media Type (auto, full100, full10, half100, half10)
network_media_type: "auto"
user_info: phone

# URL for external Directory location
#logo_url: "http://Webserver IP/background.bmp"                    ; URL for anding logo to be used on phone display

# SIP Configuration Generic File (stop)

Schritt 2: Asterisk einrichten

sip.conf

[general]
context=default                 ; Default context for incoming calls
				; If your Asterisk is connected to the Internet
				; and you have allowguest=yes
				; you want to check which services you offer everyone
				; out there, by enabling them in the default context (see below).
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0             ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=no                    ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0             ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
				; Default value is 70
				; Default: 60
				; Default: 100
				; Default: 1
			        ; "user" portion of the URI in the From: header with this
			        ; value if no fromuser is set
			        ; Default: empty

[authentication]

[basic-options](!)                ; a template
        dtmfmode=rfc2833
        context=from-office
        type=friend

[natted-phone](!,basic-options)   ; another template inheriting basic-options
        nat=yes
        directmedia=no
        host=dynamic

[public-phone](!,basic-options)   ; another template inheriting basic-options
        nat=no
        directmedia=yes

[my-codecs](!)                    ; a template for my preferred codecs
        disallow=all
        allow=ilbc
        allow=g729
        allow=gsm
        allow=g723
        allow=ulaw

[ulaw-phone](!)                   ; and another one for ulaw-only
        disallow=all
        allow=ulaw

[7701]
type=friend
secret=7701
host=dynamic

[7702]
type=friend
secret=7702
host=dynamic

extensions.conf

[general]
static=yes
autofallthrough=no
[default]
exten => 500,1,Ringing
exten => 500,n,Wait(1)
exten => 500,n,Answer
exten => 500,n,Wait(1)
exten => 500,n,Playback("/home/asterisk/ansage2")
exten => 500,n,Record("/tmp/fc/fullcircle%d:wav")
exten => 500,n,Hangup

Tips & Tricks

*CLI> core set verbose 3
Verbosity was 0 and is now 3
*CLI> core set debug  3
Core debug was 0 and is now 3