Lync trunk doesn’t pass authorization, it has none because it can’t authorize with asterisk with different users. Here is trunk configuration:
[lync]
type=endpoint
transport=transport-tcp
context=from-lync
from_user=mypbx
disallow=all
allow=alaw
aors=lync
send_pai=yes
send_rpid=yes
force_rport=yes
direct_media=no
[lync]
type=aor
qualify_frequency=60
contact=sip:LYNC_IP:5060
[lync]
type=identify
endpoint=lync
match=LYNC_IP
When call comes from lync to Asterisk it sends Invite like this at the moment:
INVITE sip:+102@PBX;user=phone SIP/2.0
FROM: "My name"sip:+101@example.com;user=phone;epid=C178E17545;tag=5ab8f62c55
TO: sip:+102@PBX;user=phone
CSEQ: 88141 INVITE
CALL-ID: 93cfb78a-fae7-4190-b9f8-588f98b233f9
MAX-FORWARDS: 70
VIA: SIP/2.0/TCP LYNC_IP:49394;branch=z9hG4bK5098b1b2
CONTACT: sip:LYNC_SERVER:5060;transport=Tcp;maddr=LYNC_IP;ms-opaque=448182e4ead76c94
CONTENT-LENGTH: 840
SUPPORTED: timer
SUPPORTED: 100rel
USER-AGENT: RTCC/6.0.0.0 MediationServer
CONTENT-TYPE: application/sdp
ALLOW: ACK
Session-Expires: 1800
Min-SE: 90
Allow: CANCEL,BYE,INVITE,PRACK,UPDATE
v=0
o=- 0 0 IN IP4 IP_ADDR
s=session
c=IN IP4 IP_ADDR
b=CT:99980
t=0 0
m=audio 20974 RTP/AVP 117 104 114 9 112 111 0 8 103 116 115 97 13 118 119 101
c=IN IP4 IP_ADDR
a=rtcp:20975
a=label:main-audio
a=rtpmap:117 G722/8000/2
a=rtpmap:104 SILK/16000
a=rtpmap:114 x-msrta/16000
I get username from header(i have endpoint 101 on asterisk):
FROM: "My name"sip:+101@example.com;user=phone;epid=C178E17545;tag=5ab8f62c55
and setup CallerID and other Info but the call itself in asterisk come from lync trunk, so device_state and other information is changed for endpoint lync.
If i setup From header like this:
FROM: "My name"sip:101@example.com;user=phone;epid=C178E17545;tag=5ab8f62c55
and authorization is disabled for endpoint 101 it will be defined in asterisk as endpoint 101 and not lync trunk, so device_state is changed for endpoint 101. The problem is that i actually need authorization for endpoints and they must be protected by passwords so only owner can user his extension with SIP client.
My main goal is to see calls from Lync server(lync trunk) as from endpoints so lync client can use all features in the same way as any SIP client with asterisk and i would be able to see it’s state, real-time calls and other statistics.