[asterisk-users] FXS ports on TDM410P card...

A J Stiles asterisk_list at earthshod.co.uk
Thu Oct 13 03:12:57 CDT 2011


On Wednesday 12 October 2011, Michael C. Robinson wrote:

> [stuff deleted]
> Seems to be working now, good eyes.
> I have the O'Reilly book on Asterisk 1.8, though I'm wondering where to
> look in it to learn how to allow incoming calls from the phone company
> to ring SIP box and FXS connected handsets?  This would be a neat
> feature, especially if there was a way from the handset to turn it off.

You already set a default context for incoming calls from the phone company.  
You just need to specify multiple extensions in your Dial() statement, 
delimited by "and" signs.  For instance:

exten => s,1,Dial(DAHDI/3&DAHDI/4&SIP/301,60)

Or you can even create a global variable with the group of phones you want to 
ring.  For instance

[globals]
ANALOGUE=DAHDI/3&DAHDI/4
BATPHONE=SIP/301

and later you can use something like

Dial(${ANALOGUE}&${BATPHONE},60)

 
> Just to make sure I'm clear, imagine you are hooked to a Linksys PAP2
> and not only want to call out via the phone company but you want to
> receive calls there from the phone company as well.  Imagine there is
> an extension to call that toggles this behavior on/off.  So say 2025 is
> the special extension which you call and a voice says relaying phone
> company on.  You hang up then, the phone rings, and you pick up a call
> from somewhere remote via the phone company.  You hang up when you're
> done and decide the behavior should be turned off, so you dial 2025
> again and the voice says relaying phone company off.  Now if a call is
> incoming from the phone company, your phone doesn't ring.  You can call
> all local extensions and even remote numbers, but you can't receive
> remote calls.

You have to set a global variable when your special extension is dialled.  
Then you can use GoToIf() to make decisions based on the value.

[globals]
TELCO_ON=1
ALL_PHONES=DAHDI/3&DAHDI/4&SIP/301
; (assuming 301 is the SIP extension you want to ring)

; .....

[internal]

; .....

exten => 2025,1,GoToIf($[${TELCO_ON}=1]?2:5)
; 2 turns off "telco_on"
exten => 2025,2,Set(GLOBAL(TELCO_ON)=0)
exten => 2025,3,Playback(telco-off)
exten => 2025,4,hangup()
; 5 turns on "telco_on"
exten => 2025,5,Set(GLOBAL(TELCO_ON)=1)
exten => 2025,6,Playback(telco-on)
exten => 2025,7,hangup()

; .....

[from-pstn]

exten => s,1,GoToIf($[${TELCO_ON}=1]?2:3)
; 2 rings all phones
exten => s,2,Dial(${ALL_PHONES},60)
; 3 goes to voicemail  (assuming you've configured VM on ext 301 .....)
exten => s,3,VoiceMail(301,u)
exten => s,4,Hangup()

> [stuff deleted]  Another neat trick would be to list
> what the extensions are when someone enters an invalid extension.  Say
> someone dials 1011, not one of my extensions and not a remote phone
> number prefixed by 8 or 9.

Then you need to look at the "i" extension, which is called when someone dials 
an invalid extension number.  Record yourself a suitable message  (cheating 
way is to leave a voicemail message, which will already be in the format you 
want, and cp the file across)  and put something in your context like

exten => i,1,Playback(extns-list)
exten => i,n,Hangup()


> The last trick I want to pull, I want an extension that will ring
> inclusively 2000 to 2011, say 2012.  How do I set this up by hand?

Again, use the & sign notation for ringing multiple phones:

exten => 
2012,1,Dial(SIP/2000&SIP/2001&SIP/2002&SIP/2003&SIP/2004&SIP/2005&SIP/2006&SIP/2007&SIP/2008&SIP/2009&SIP/2010&SIP/2011,60)
exten => 2012,2,Hangup()

My personal preference is to split departments on the hundreds, and use x00 as 
a "ring all phones in department" number.  For instance if numbers like 2xx 
are sales, 3xx are purchasing, 4xx are accounts, 5xx are IT, 6xx are factory 
floor, then I would make the number to call everybody in accounts 400.

-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list