Thursday, June 23, 2011

Using 2talk SIP Provider with Lync

yesterday I posted about using Asterisk with Lync. Today I will share my configuration files for getting 2Talk up and running with the latest version of Asterisk 1.6:
Effectively there are two configuration files you need to worry about. The sip and the extensions files.
The sip.conf file specifies the different sip trunks and authentication mechanisms. The extensions.conf is your dialplan, which can be the trickiest to get working. Below are my versions (passwords removed)

sip.conf:

[general]
registerattempts=0
registertimeout=20
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)
bindport=5060
bindaddr=0.0.0.0
tcpenable=yes ; 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
notifyhold = yes

;register 2Talk number to receive incoming calls (replace placeholders with values, remove brackets)
register => :@2talk.co.nz/

[1001] ; A locally attached SIP extension (in my case an X-Lite client)
type=friend
callerid=1001
canreinvite=no
dtmfmode=rfc2833
mailbox=1001
disallow=all
allow=ulaw
transport=udp
secret=password
host=dynamic
context=default



[2talk]
type=friend
username=
fromuser=
secret=
host=2talk.co.nz
context=from-2talk ; going to use this in extensions.conf
dtmfmode=rfc2833
disallow=all
allow=ilbc
allow=gsm
allow=alaw
allow=ulaw
;allow=g729 ; only if you have licenses to use it
nat=yes
canreinvite=no
insecure=invite,port ; use insecure=very in earlier versions of Asterisk such as v1.2


[Lync_Trunk] ; Our Lync trunk
type=friend
port=5068 ; This is the default Lync Server TCP listening port
host= ; This should be the IP address of your Lync Mediation Server
dtmfmode=rfc2833
context=from-lync
qualify=yes
transport=tcp,udp

extensions.conf

[general]

static=yes
writeprotect=no

[globals]

[default]
;calls to a 4 digit extension starting with one are routed directly via SIP to local phones
exten => _1XXX,1,Dial(SIP/${EXTEN},20)
exten => _1XXX,2,hangup()

; outbound calls (outside of your own PBX) (only used for internal phones, not calls originating from Lync)
exten => _0.,1,Dial(SIP/${EXTEN:1}@2talk)
exten => _0.,2,hangup()

;calls coming in locally going to a 4 digit number starting with 2 are redirected over the Lync trunk
exten => _2XXX,1,Dial(SIP/Lync_Trunk/${EXTEN},20)
exten => _2XXX,2,hangup()

[from-lync]
;dialling other extensions starting with 1 followed by three digits are sent locally
exten=>_1XXX,1,Dial(SIP/${EXTEN},20)
exten=>_1XXX,n,hangup()

;send other calls to 2talk for Asterisk (no prefix here as Lync will probably have its own dialplan)
exten => _.,1,Dial(SIP/${EXTEN}@2talk)
exten => _.,2,hangup()


[from-2talk]
;send incoming calls on your 2talk number to a Lync Extension
exten => _X.,1,Dial(SIP/Lync_Trunk/2001)


That's it folks! Try using the two configurations with your 2talk SIP provider, add your own number, secret and Lync IP address and start making and receiving calls over Lync.

No comments: