Link to home
Start Free TrialLog in
Avatar of Muhajreen
Muhajreen

asked on

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 ??
Avatar of grblades
grblades
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Muhajreen
Muhajreen

ASKER

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.
Avatar of Ron Malmstead
Start with Sip.conf...

Add a sip entry in sip.conf, for each phone number of each analog port.
Example.
[5551111234]
type=friend
host=dynamic
secret=mysecret
context=default
nat=never
callerid=5551111234
dtmfmode=auto

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.

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

[outbound]
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:
[incoming]
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.
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.
[incoming]
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.
"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 ?

[5551111234]
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...

signalling=fxo_ks
group=4
language=en
context=5551111234
usecallerid=yes
cidsignalling=bell
cidstart=ring
channel => 4
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.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_1968385
Member_2_1968385
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial