Monitoring asterisk analog trunks with Linksys SPA942

Hello experts,
I have Asterisk 1.4 with Digium TDM800 and 4FXO ports.
SIP extensions are using Linksys SPA942 which has 4 lines.

I need a way to link each one of the four line keys in SPA942 to one analog FXO port. That means when one trunk is busy it's led should become red until it's hung up.

Possible ??
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes it can be done. In asterisk you can define hints like :-
exten => l1,hint,ZAP/1
exten => l2,hint,ZAP/2
exten => l3,hint,ZAP/3
exten => l4,hint,ZAP/4

Then on the phone you define the button as being a busy lamp with extensions l1 through l4.
MuhajreenAuthor Commented:
Thanks for your comment.

In asterisk, shall I insert the above hint settings in the same user context?

And how to define the buttons in phone?

You can define the hints in the same context as your extensions.

Sorry I havent used the linksys phones but normally you just go to the IP address of the phone in the browser and you can define the buttons. Normally you can then define the type of action for the button which is normally called something like busy lamp or BLF.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Ron MalmsteadInformation Services ManagerCommented:
Start with Sip.conf...

Add a sip entry in sip.conf, for each phone number of each analog port.

After you have the four entries...reload sip.

Now logon to the web interface of the 942 phone.  On each extension, add the settings you just put in sip.conf.  This will make each line key mapped to a specific analog port, for outgoing calls.

To make incoming calls ring on the appropriate line, then you might have to adjust your extensions.conf, on your inbound context.

exten => _5551111234,1,Answer(.5)
exten => _5551111234,n,Dial(SIP/${EXTEN},20)
exten => _5551111234,n,Voicemail(${EXTEN}@default)
exten => _5551111234,n,Hangup()
Ron MalmsteadInformation Services ManagerCommented:
Sorry.... slight misnomer in my words.
To make the phone use a specific port outbound, you can do something like the following....

exten => _NXXNXXXXXX,1,Set(myexten=${CDR(src)}) ;set myexten so we know which line you used to dial.
exten => _NXXNXXXXXX,n,Set(dialednumber=${EXTEN}) ; set dialednumber so we know the number to dial.

exten => _NXXNXXXXXX,n,GotoIf($["${myexten}"="5551111234"]?1) ; goto 1 if myexten is....""..
exten => _NXXNXXXXXX,n,GotoIf($["${myexten}"="5551111233"]?2)
exten => _NXXNXXXXXX,n,GotoIf($["${myexten}"="5551111232"]?3)
exten => _NXXNXXXXXX,n,GotoIf($["${myexten}"="5551111231"]?4)
exten => _NXXNXXXXXX,n,Hangup()       ;If it makes it here, then that means the call didn't originate from your
;     phone, so we hangup I guess.

exten => 1,1,Dial(Zap/1-${EXTEN}/${dialednumber}) ; Dial zap on span 1 - channel 1 / the number
exten => 1,n,Hangup()

exten => 2,1,Dial(Zap/1-${EXTEN}/${dialednumber})
exten => 2,n,Hangup()

exten => 3,1,Dial(Zap/1-${EXTEN}/${dialednumber})
exten => 3,n,Hangup()

exten => 4,1,Dial(Zap/1-${EXTEN}/${dialednumber})
exten => 4,n,Hangup()
xuserx2000, I am curious to know - have you tried any of the above or is this a theoretical solution? It's an interesting idea for a solution, but I am not convinced the inbound call handling you propose would work.

To route inbound calls to specific line keys on the SPA942 can I would do it like this:
exten => s,1,Dial(SIP/555111123${CHANNEL:-1},25)
exten => s,n,Voicemail(555111123${CHANNEL:-1}@default)
exten => s,n,Hangup()

That would map Zap channel 1 to SIP extension 5551111231, and Zap channel 2 to SIP extension 5551111232 etc. The other big weakness of this solution is that is only works for a single IP phone - you might be able to use Shared Line Appearances for multiple IP phones, but the SPA942 would be quite difficult (or impossible) to set up with SLA.
Ron MalmsteadInformation Services ManagerCommented:
Yea, I can't think of any way to change the LED's status, when the trunk is in use on the 942.

I wouldn't say this is a theoretical solution, because it's based on the fact that you can assign each line appearance a different extension.  If you have 4 analog ports.... create extensions that match the phone number they belong to...and simply dial those extensions and the appropriate line key will blink when the phone rings.

I'm not really sure why you think it wouldn't work....because the sip extension assigned to each line key, matches the inbound number already.
exten => _5551111234,1,Answer(.5)
exten => _5551111234,n,Dial(SIP/${EXTEN},20)
exten => _5551111234,n,Voicemail(${EXTEN}@default)
exten => _5551111234,n,Hangup()
......The above was an example of a single entry for one incoming number..., and I yield to the fact that yours would encompass all the numbers by triming the chan variable to get the last digit.  ${CHANNEL:-1} and appending it.  Your modification assumes however, that the incoming DID's are in the same range..... 555111123 and 1, or 2, or 3, or 4

As far as SLA, I put a lot of effort in, once upon a time, into making it work for 942, and was unable to do so.
The item I was doubtful about was the inbound dialled number being known to Asterisk on an FXO port. Where does it get that information? In my experience, inbound calls to FXO ports have to use extension type "s" in the dial plan context where they are handled. ...or does it use the callerid field from zapata.conf? That field is supposed to indicate the caller ID on outbound calls, but I vaguely remember now that Asterisk may also set the dialled number to the same value on inbound calls on analogue ports. It would make sense. (I loaned my FXO card to someone so can't check it at the moment).

By the way, I also tried for ages to make SLA work on a 942 with no success. Are some of the keys re-programmable as BLF keys? The only keys with lamps on are the line keys.
Ron MalmsteadInformation Services ManagerCommented:
"The item I was doubtful about was the inbound dialled number being known to Asterisk on an FXO port. Where does it get that information? In my experience, inbound calls to FXO ports have to use extension type "s" in the dial plan context where they are handled. ...or does it use the callerid field from zapata.conf?"
- I was confused to what you meant, but you are 100 percent correct in that.... it is an error on my part.

Should be extension S..... or "."
The context can be defined within each of the fxs port definitions...

What do you think of this ?

exten => s,1,Answer(.5)
exten => s,n,Dial(SIP/${CONTEXT},20)
exten => s,n,Voicemail(${CONTEXT}@default)
exten => s,n,Hangup()

and in zapata...

channel => 4
MuhajreenAuthor Commented:
Thank you all for your care.

I am really confused about the feature. I was unable to reply to the comments or accept any solution.

In conclusion, is it possible to work with SPA942 or not? what about Snom phones? Do they support it?  What is the simplest way?
I havent used linksys or snom phones. The Aastra and Grandstream (except the budgettone models I believe) do definetly support it though.
If you have just one extension phone, then the SPA942 could be used as discussed above. However, I think it unlikely that you would want to have an Asterisk PBX with 4 FXO lines and just one extension phone. Therefore, you should consider using Aastra, Snom or Grandstream phones instead (they would be much more suitable), but the answer is still not very straightforward because Asterisk itself could be the limiting factor here.

The feature you described is called Shared Line Appearances. It is where the extension phone has a button for each trunk line - when the trunk line is in use, the lamp next to (or under) the button comes on. When an inbound call rings on one of the trunk lines, the lamp flashes.

Asterisk can do shared line appearances, but the last time I investigated it there were quite a lot of limitations and also it was not easy to set up. Possibly things have got better in the last 14 months (that is how long ago I looked into it). Try googling on "Asterisk SLA" or "Asterisk shared line appearances" and see what is being said about it now. Possibly you would be better using a different product - there was something called Talkswitch which the distributor told me could do it. Also I think Broadsoft, PBXnSIP and Sylantro products may be able to support it (quite possibly with the SPA phones).

I wrote a white paper explaining everything I could find out about Asterisk 1.4 and SLA (as I said it is now slightly old information and may be out of date). It is very technical, but the sections about the pro's and con's might be helpful and the general explanation of what SLA is:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IP Telephony

From novice to tech pro — start learning today.