Saturday, April 9, 2011

GrandStream ATA with Lync 2010


I was cleaning my home office this morning and found old GrandStream HT503 ATA device. Ah, memories J - he first device I connected to OCS Mediation server. My immediate thought was – Lync Analog Device Support! Wouldn’t be nice if I can use it?

I must say right away – while the device is packed with features – SIP over TCP and TLS support etc., whoever wrote the GIU must had the sole goal to pull a joke – it is so confusing and scattered.

This will be a very basic walk-through of HT503 configuration in order to be used with Lync 2010.

First we must configure Gateway in Topology builder. For detail instruction, refer to this post: http://www.lynclog.com/2011/04/analog-phone-support-with-lync-2010.html

In this example, I used 10.20.50.70 as IP address for my Gateway, 5066 as listening port for SIP traffic, and assigned the Gateway to my co-located Mediation server as I did with MP-114.

Next, I provisioned new Analog Phone application contact in Lync.

New-CsAnalogDevice -LineUri tel:+14785552021 -DisplayName "Grandstream HT503" -RegistrarPool fe.drago.local -AnalogFax $False -Gateway 10.20.50.70 -OU "ou=Telecommunications,dc=drago,dc=local"

Published the Topology of course, and moved to HT503, where the nightmare began.

The device has two ports – LAN and WAN. I will use LAN port to manage the device and will connect WAN port to the subnet where my Lync server resides. The default IP address of HT503 is 192.168.2.1 and so, I setup a secondary IP on my NIC – 192.168.2.2 and MASK – 255.255.255.0. How, I was able to get to the device’s web site.


…and logged with the default password “admin”



Went to “Basic Settings” and was like “Damn!”...

First I configured the IP address of the WAN port with IP 10.20.50.70 (remember, this is the IP I used in Topology Builder).

Leave the rest untouched. As usual, this is Proof Of Concept and we want to see if it will work to begin with.
Skip “Advanced Setting”. Fancy features we will not touch now. Move to “FXS PORT” tab. FXS (Foreign eXchange Subscriber interface) is the RJ11 port we connect an Analog Phone and we must setup just a few basic parameters.


Set the following parameters as follow:
Primary SIP Server to the IP address and port of your Mediation Server and the rest as shown. Compare your settings for each parameter to one on the screenshots.





Click Update and then reboot on the next screen. The device will reboot and will be accessible in about 30 seconds.


Login back and navigate to FXO PORT. Enter your Mediation server IP address and port in |Outbound Proxy line. Again, compare your device’s parameters line by line and make sure all are set as shown.






Again – click Update and then reboot the device.

Now we can test the configuration. My Lync Test User 2 has phone number +14785554040, which I will dial from the Analog Phone connected to the FXS port of HT503.


It works. I was able to establish two way audio communications. I am yet to find out why the call arrives as “Anonymous Caller”, but our POC was successful.

37 comments:

scream said...

Hello. Have you achieved any more results with GS HandyTone ATA's? We're planning to buy about 100 of HT-502 and use them while migrating from POTS to Lync. I would be very grateful for any comments from such a "veteran" in Lync interoperability.

Drago said...

One hundred devices? Very interesting, indeed… Will you please elaborate how and why you decided to use ATA instead of gateway. If you prefer to take this discussion private, email me – dtotev at live dot com

scream said...

There are 2 reasons:
1st is $. Grandstream HandyTone 502 costs 54$ here in Ukraine, so it's 27$ per fxs port. Audiocodes, Mediatrix, Patton or Dialogic are proposing much more expensive solutions for such a temporary usage we are planning.
2nd is cabling. Our structured cabling system is full of Y-adapters and hydra-patchcords because of recent rapid number of users increase. So it would be exelent to throw away all that telephony-integration patch panels and free up some pairs.
But we already have some sad expirience using cheap devices instead of certified solutions in other spheres of IT. And we don't want to increase this baggage of sadness. ))
It would be stupid to buy 100 useless devices and then explain something about growing budget to our CIO.

Drago said...

I feel this is just the beginning of a long discussion… Let’s try to break down this project to the core components.

First and foremost, to use 100 (one hundred) devices for PSTN connectivity will introduce ultimate nightmare for maintenance and support. While Microsoft’s Unified Communications solution is beautiful because of the highest level of systems integration and simplified management, use of ATA would take away the above benefit.

Since you mention HT-502 (which is 2 x FXS ports), it is apparent that you seek PSTN connectivity integration. In this case, you are still tied to the old POTS concept – one phone number to one user/device. Since we cannot assign one phone number to more than one AD object, it is obvious that some users could have DID like feature (i.e. to be dialed directly) while others – internal extensions only. You must actively look for SIP Trunking, where number of concurrent calls (POTS like) does not have to match numbers of DID (phone numbers). Simply said – it is apparent that you have 200 POTS phone lines but more, let say 300, users. Typical starter ratio is one-to-four or one-to-five i.e. on every four users – one trunk channel. In SIP Trunk scenario, you would have 50 concurrent calls throughput and yet you could have 300 DID’s – one individual number for each user.

If the existing lines MUST be re-used, please, please consider devices of type Audiocodes MP-124. It comes in many flavors and you could take advantage of 50-Pin Telco interface flavor. Plus… look here: http://shop.voipdistri.com/product_info.php?info=p1646_AudioCodes-Telco-to-Telephone-Connection-Box-for-MP-124D.html&XTCsid=ckpfxqih . 143 Euros!!! Besides this cheaper than 12 HT-502, think about the fact you are planning to introduce ONE HUDRED GATEWAYS to your Lync environment. This is insane! Instead, you could start with one gateway (24 concurrent calls), test and then migrate one or more departments and based on the experience and observations, proceed further.

Chris Duva said...

Hello Drago. I am trying to configure a Grandstream HT-286 on Lync Server 2010. The flashing light on the device indicates that it is failing to register, which I presume to mean authenticate. I notice that you did not specify any information for the SIP User ID: or Authenticate ID: How can the ATA connect to Lync? I also noticed that you use different ports for the ATA Local SIP port and the SIP (Mediation) server. Does the server port need to match the SIP server port shown for the properties of the Mediation Server in Control Panel?

Thanks for the head start in implementing this device.

scream said...

2 Chris: As I can see, HT-286 does not support SIP over TCP. So there is no chance to connect it to Lync.

2 Drago: Thank you for advice. Audiocodes MP-124 is a perfect solution. Not even close to 143 euros, actually it costs $1200 here. But this price (about $50 per fxs port) is quite acceptable for our project. Couldn't even imagine that there is certified Lync-compatibale such a low-cost FXS gateway.

Chris Duva said...

Scream: The HT-286 does support SIP over TCP. I have the packet traces to prove it. I have encountered a problem in testing the devices. They will not attempt to set-up a call if the SIP Server address is on my local Class-C network. I set up the device to log its events to a syslog, and the log contains the event saying it sent the packet to my mediation server - but no packet was sent. If I configure the device with a public IP - it sends the invite. Grandstream tech support is not very helpful.

Chris Duva said...

Drago: Did you have to do anything specal to get the HT503 to respond to Mediation Server OPTIONS messages?

More testing with HT286 shows that it will initiate a SIP call as long as the server is not on its local network. It is not responding to Lync OPTIONS requests, so Lync kills the gateway after 5 response failures.

Not ready to give up just yet.

Tommy said...

Hi Chris, did you solve this?? Im having kind of the same problems

Chris Duva said...

2 Tommy: I gave up on the HT-286 ATA and replaced it with a Mediatrix 4102S. Neither I nor my distributor could make first-person contact with Grandstream tesch support. Via my dialog with their tech support forum, Grandstream says that the HT-286 supports the SIP OPTIONS method. But, the device would never respond to Lync. The Mediatrix is working for analog voice. I am trying to get it to handle analog fax. I think that the answer will be to get media bypass configured correctly.

Anonymous said...

Hello, i want use a lynksys spa3102 but when i call outbound have this error "A call to a PSTN number failed due to non availability of gateways"
Can help me to configure it?

thanks

Max

Drago said...

This error will be generated when the gateway (SPA3102 in this case) is marked as “down” . This happens when mediation server fails to receive response on five consecutive OPTIONS requests.

Verify your port and protocol assignment on both Lync and SPA side. Also, use Wireshark or Netmon to verify is the two can communicate.

Anonymous said...

ok thanks but if i try to connect with telnet on lync server port 5067 its closed its normal?

Max

Chris Duva said...

As Drago has said, you have to chack that you have correctly matched the protocol and port definitions of the Mediation server to your LinkSys device. You mentioned port 5067. Does the LinkSys support SIP over TLS? It may not, and you need to add a TCP gateway to Lync. Does the LinkSys support the SIP OPTIONS method? Even if it does, it may have to be enabled on the device. On the Mediatrix it is off by default.

Tommy said...

Drago thats correct and i pinpointed my problems down to the GW being marked as down, but since its not answering on the OPTIONS request as implemented in CU2 it will be forever marked as down.

So i did decide to not involve lync and just tunnel it out from the dialogic but i cant get fax to work, analog calls works fine but no faxes. so i will change it to a Audicodes MP118

Anonymous said...

Hi Drago,

I am using an HT503 with Lync Server 2010 and I'm able to place a Lync -> PSTN call, however, while I can hear the person on the other end of the PSTN line, they cannot hear me.

Do you have any idea what the problem might be?

I've tried different DTMF settings, boosting the TX gain etc. but there is simply no sound coming out from the VoIP side.

Drago said...

I would start with using Wireshark from within the Mediation server. Check if RTP traffic flows on both directions.

Anonymous said...

I did and that it turns out the the SDP response from the gateway is specifying the WAN address of the HT503 (192.168.2.120). The LAN IP of the HT503 is 192.168.1.240

I see this in the netmon capture:

Frame: Number = 328, Captured Frame Length = 870, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[00-15-5D-01-67-02],SourceAddress:[00-0B-82-2F-25-82]
+ Ipv4: Src = 192.168.1.240, Dest = 192.168.1.4, Next Protocol = TCP, Packet ID = 55129, Total IP Length = 856
+ Tcp: Flags=...AP..., SrcPort=5070, DstPort=52540, PayloadLen=816, Seq=2583726922 - 2583727738, Ack=423950953, Win=7440 (scale factor 0x0) = 7440
- SIP: Response: SIP/2.0 200 OK
- SipParser: Response: SIP/2.0 200 OK
+ StatusLine: SIP/2.0 200 OK
+ ResponseHeaders:
ResponseBody:
- Sdp: Response: SIP/2.0 200 OK; SDP:SessionName=SIP Call, Version=0, MediaDescription=audio 5012 RTP/AVP 101 0 8
ProtocolVersion: 0
+ Origin: - 8002 8000 IN IP4 192.168.2.160
SessionName: SIP Call
+ ConnectionInfo: IN IP4 192.168.2.160
+ ActiveTime: 0 0
- MediaDescription: audio 5012 RTP/AVP 101 0 8
MediaType: audio
MediaPort: 5012
MediaProtocol: RTP/AVP
- MediaFormat: 101 0 8
MediaFormat: dynamic
MediaFormat: PCMU Audio, 8000Hz [1 Channel]
MediaFormat: PCMA Audio, 8000Hz [1 Channel]
+ SessionAttribute: sendrecv
+ SessionAttribute: rtpmap:101 telephone-event/8000
+ SessionAttribute: fmtp:101 0-16,32-36,54
+ SessionAttribute: ptime:20
+ SessionAttribute: rtpmap:0 PCMU/8000
+ SessionAttribute: rtpmap:8 PCMA/8000

I also see all the subsequent RTP packets that Lync sends being sent to the WAN IP address of the HT503 (which isn't even plugged in let alone on the same network).

Any ideas how to address this?

Thanks.

Anonymous said...

I figured out a solution to the my issue.

On the FXO page of the device configuration there is an option:
Use NAT IP. When I set this to the LAN address of the HT503, then this is the address that it uses in the SDP portion SIP message when initiating the call and this results in the NAT IP address specified being used by the Lync server when sending the RTP packets and allows voice to flow in both directions.

Drago said...

Thank you for sharing!

Anonymous said...

You're welcome. These guys really need to improve their documentation though. It took me four days to this fully configured and working (just for the outbound path).

Rustam said...

Hi Drago!
Is it configuration can do calls to PSTN trough other gateway?
Thank in advance

Drago said...

I am afraid I don's understand the question. Can you provide more details?

Maksim V. Lemeshko said...

Hi Drago!
Tell me please!
My UC-infrastructures is working on Lync Server 2013.
I'm have two questions!

1. I need some help connecting my Grandstream GXW 4008 to a lync server. Do you think you can help me?
I receive status "not Registered"

2. I need some help connecting my Cisco SPA122 to a lync server. Do you think you can help me?

Thank you in advance.

Drago said...

Maksim,

Frankly I am surprised how many people trying to implement non-qualified devices. I just checked ebay - lot of 10 (ten) AudioCodes MediaPack MP-112 VoIP Gateways sells at this moment for... $99.99

Maksim V. Lemeshko said...

Yes, you are right!
But i have no case!
Tell me, How do you want me to do it?

Thx.

Maksim V. Lemeshko said...

Hi Drago!

Tell me please!
It need register "AudioCodes MediaPack MP-112 VoIP Gateways" in Lync Server?

Ernesto Salas said...

First of all thanks Drago!!! I followed your sample configuration to the T and the results were simple and immediate!! We have an HT502 connected to Lync doing exactly what we wanted to do. At this time I wanted to ask you: In your sample configuration you chose not to use SIP authentication for your FXS port. Although this is not absolutely required (Lync finds the contact based sinmply on the HT/PSTN gateway address) I was wondering about configuring the second FXS port on my unit (HT502) with a **different** extension (we have FXS port 1 configured with extension x already). The CSAnalogDevice object does not seem to contain any pointers to gateway's port (FXS 1 or FXS 2) so I'm wondering about to accomplish this. Should I simply configure SIP authentication at the HT502 level? Even then, I'm not sure as to how Lync sends the gateway differential information regarding the analog device that is being contacted. Enlighten us please if you can. Thanks.

Drago said...

Lync server task is to send “a call” to “a gateway” when certain conditions are met (number of regular expression). The destination (gateway) is responsible of processing the call further. Think of what happens when you dial a non-existing number – you get 404 not found.
I do not have HT502 to test, but I think assigning a number (extension) to the second port and configuring another Analog Phone object with this extension will do.

Ernesto Salas said...

Correct Drago -- I called MS Support and they reported the same. For now all I've done is setup the Line URI (tel:+1xxxxxxx;ext=xxx) in the SIP user id will send the call to the right port. I'll update here regarding how it goes

Grandstream said...

Great Information and post! It is very informative and suggestible for the user of solar energy, May I think it can be beneficial in coming days...

Anonymous said...

Followed the above directions but there must be something missing as I cant get a Lync phone to call the HT503, but I can call from the Ht503 to a lync phone. Any Ideas?

Drago said...

Double check your topology for correct port allocation.

Anonymous said...

So it looks like the part that was missing was you have to add a route in the dial plan to the gateway. Once I did that I can call both ways. NoW I have to get it to receive calls externally and to make calls externally as the Grandstream is giving a 408 busy error.

Unknown said...

Hi Drago

Excellent article.
I have managed to get a Grandstream HT701 single FXS port model to receive and make calls via Lync 2013 and SIP trunks.
However, I have 1 minor problem, I can't get call transfer or call forward busy to work, it seems that I need to enable to enable SIP REFERRER support on the ATA, but can't see how to do this (if it is even possible)

Any ideas?

Cheers
Mark

Drago said...

Hi Mark,

Have you tried disabling REFER support on the trunk instead? You need to do so if you want to support Exchange Unified Messaging anyway...

Anonymous said...

Hi Drago,

Do you have any idea if your method works for fax?

Most if not all of the Grandstream ATAs used in my organization are for fax purposes and I wanted to seek your opinion if it will also work for fax.