Hi Stary,
Sorry for the delay in getting back to you …it’s been a busy week at work. Anyway, here is my sip.conf entry for the SPA:
[pstnline] ; account name for the SPA gateway
type=peer
username=pstnline ; same as the pstn account entry in the SPA
context=internal ; context for internal users that are allowed to dial out over the SPA.
secret=your_password
fromuser=pstnline ; default callerID, if callerID value does not come through
host=192.168.1.3 ; SPA's IP address on local nwk. [Change this to the IP addr of your SPA]
insecure=very
port=5066 ; avoid conflict with my IP phone(s) on ports 5060-5063
qualify=no
host=dynamic ; this device needs to register
nat=yes ; not required if SPA and * are on same LAN, but seems to work better
canreinvite=no ; disallow RTP media stream to bypass *
dtmfmode=info ; other modes do not seem to work for me!
disallow=all ; only the sensible codecs
allow=ulaw ; my default codec ...gives excellent quality for even SIP -to- cell phone calls thru SPA
allow=g729 ; low bandwidth codec, just in case.
allow=alaw ; fallback codec ...not sure why I even bothered to include it here
;allow=gsm ; SPA-3102 does not have a gsm codec!
In the above, make sure that you replace the word “internal” in the line “context=internal” with whatever context you have you extensions 3000 and 3001 in.
My extensions.conf has the following entries, Before you start reading, an explanation is in order … I have set the SPA to route all incoming phone calls to a *99 extension, Ringing, the *99 extension really rings my two extensions (just like you want it).
I have also set up the SPA so that when a call comes in with no cid name (and cid number may or may not be passed through), the call is processed to see if we have blacklisted number, or if it is a telemarketer. If it is a telemarketer, I play the ‘disconnect tone’ and a pre-recorded message telling them to disconnect and take my number off their list. Usually they hang up at this point. Now, if the caller remains on the line, it is usually a friend whose caller id hasn’t come through; so I try to get their cid name from the internal * database, then, I connect them to my internal IP phones. Note that you don’t have to set up the blacklist or populate the cid database at this point. This code should work just fine without doing any of that. But if you are interested in blacklisting callers or setting up a cid name database for your friends whose cid name don’t show up along with their cid numbers, there are easy commands to do this on the * CLI. [just google for the info.]
<put this code in the context that your extensions 3000 and 3001 are in>
exten => *99,1,SETCIDNUM(${CALLERIDNUM}) ; SPA-3102 forwards incoming PSTN calls here
exten => *99,2,LookupBlacklist(j) ; If blacklisted caller, then jump to 103 (2+101)
exten => *99,3,Zapateller(nocallerid) ; zap telemarketers with phone on-hook -- 'line disconnected' signal
exten => *99,4,Set(foo=${CALLERID(name)}) ; copy cidname into variable 'foo'
exten => *99,5,Set(foo=${CUT(foo, ,1)}) ; strip trailing space from 'foo'
exten => *99,6,GotoIf($["${foo}" = "UNKNOWN"]?20:7)
exten => *99,7,GotoIf($["${foo}" = "PRIVATE"]?20:8)
exten => *99,8,GotoIf($["${foo}" = "OUT"]?20:9) ; OUT OF AREA
exten => *99,9,GotoIf($["${foo}" = "UNAVAILABLE"]?20:10)
exten => *99,10,GotoIf($["${foo}" = "WIRELESS"]?25:11) ; look up cid name from database for wireless callers
exten => *99,11,GotoIf($["${foo}" = "PSTN"]?20:26) ; look up cid name from database for all other 'no cidname' numbers
exten => *99,20,SetCallerID(,) ; Clear CID Name to NULL value
exten => *99,21,Answer ; Let Asterisk pick up the line now (caller is unknown)
exten => *99,22,Zapateller(nocallerid) ; Zap the caller off-hook. Autodialers will disconnect, hopefully
exten => *99,23,Zapateller(nocallerid)
exten => *99,24,Playback(/mnt/kd/asterisk/my_sounds/telemarketer_getlost)
exten => *99,25,LookupCIDName ; Look up cidname corresp. to cidnumber, in internal database
exten => *99,26,Dial(SIP/ABC&SIP/XYZ,30,trj) ; Ring SIP phone 1 and SIP phone 2
exten => *99,27,VoiceMail,u3000@default ; goto VM if unavailable
exten => *99,28,Playback(vm-goodbye)
exten => *99,29,Hangup()
exten => *99,103,Goto(blacklisted,s,1) ; send blacklisted caller to 'blacklisted' context
exten => *99,127,VoiceMail,b3000@default ; goto vm if dialing (on step 26) finds phone busy
exten => *99,128,Playback(vm-goodbye)
exten => *99,129,Hangup()
<here is the 'blacklisted' context ..place it in extensions.conf>
[blacklisted] ; we transfer blacklisted numbers to this context
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Zapateller
exten => s,4,Zapateller
exten => s,5,Playback(ss-noservice)
exten => s,6,Hangup
In the above code, substitute ABC and XYZ on line 26 with your SIP account names for your IP phones that have the extensions 3000 and 3001 respectively. Also substitue your voicemail box number in place of 3000 on lines 27 & 127
On line 24, you will need a telemarketer_getlost.wav file that tells telemarketers to hang up. Make sure that you provide the complete path to that file as shown. [Replace my path with yours]. You can record your own message and use it. If you don’t know how, never mind for now, the code will still work …it will just not execute line 24.
To configure your SPA-3102 …
Unless you really need the built-in router, you are better off disabling it. Note that I am assuming that you have a main router other than the SPA that you can use for DHCP. If so, then proceed as follows…
Under “Router —> WAN Setup” (advanced screen, admin mode):
- Set “Internet Connection Setting” to ‘Static IP’.
- Under “Remote Management”, set ‘Enable WAN Web Server’ to ‘Yes’. THIS IS IMPORTANT
- Under “Static IP Settings”, set your IP address for te SPA to value that is not in conflict with the address range of your DHCP server. Set the gateway addres to that of your main home router.
Under “Router —>Lan Setup” (advanced screen, admin mode):
- Set “networking Service” to ‘Bridge’
- Set “enable DHCP Server” to ‘No’.
Leave other settings unchanged
Under “Voice —> System” (advanced screen, admin mode):
- Set “Enable Web Admin” to ‘Yes’
- Set your admin and user passwords.
Under “Voice --> Regional” (advanced screen, admin mode):
[This is only for North American Users]
- Set “CallerID Method” to ‘Bellcore (N. America, China)’.
- Set “Caller ID FSK Standard” to ‘Bell 202’.
Under “Voice --> Line 1” (advanced screen, admin mode):
[NOTE: Line 1 refers to the SIP account associated with the FXS port of the SPA]
- Set “Line Enable” to ‘Yes’ (if you wish to use the FXS port to connect an analog phone)
- Under “SIP Settings”, set “SIP Port” to 5064
- Under “Proxy and Registration”, set “Proxy” to , set “Use Outbound Proxy” to ‘No’, “Register” to ‘yes’, “Register Expires” to ‘3600’ (or whatever you feel like).
- Under “Subscriber Information”, Set “Display Name” to '‘your_name’, and set the user name and password for the SIp account for the phone attached to the FXS port
- Under “Audio Configuration”, “DTMF Tx Method” = “Info” seems to work for me.
- Under “VoIP Fallback To PSTN”, Set “Auto PSTN Fallback” to ‘Yes’.
- Under “Dial PLan”, set dial plan to:
L:6,S:3,(*xx|[3469]11|0|00|[2-9]xxxxxx|1xxx[2-9]xxxxxxS0|xxxxxxxxxxxx.)
For "Voice —> PSTN Line Settings, the page is too long and I don’t know how to attach the screenshots here…
But I can email you the screenshots
– Sarv
[quote=“stary”]Well, I’m interested in SPA3102 configuration working with Asterisk, too.
Can you tell me how to set up sip.conf and extensions.conf in Asterisk and what is the configuration of SPA3102 to work both together?
I’d like my SIP phones (ext. 3000 and 3001) can dial an outgoing call via SPA3102 FXO for numbers starting with “0” and all incoming calls from PSTN (FXO) will be forwarded to extensions 3001 and 3002.
Thank’s.[/quote]