[Asterisk-Users] Small office with all employee's offsite

Colin Anderson ColinA at landmarkmasterbuilder.com
Tue Nov 29 12:31:36 MST 2005


I am using this dialplan with DID's to great effect, I have 130 guys doing
exactly what was discussed here. After 12 seconds ringing their SIP or IAX
client, the dialplan calls the cell automatically, during working hours. If
they don't pick up after 18 seconds, voicemail.  After hours, both phones
are dialed concurrently. Also, fax detection is automatic so DID is desk
phone, cell phone, and fax. 

Using it this way completely obviates the need for call forwarding; I find
CF more of a hassle than it's worth because people are dumb and forget that
calls are CF'd then complain that their phone isn't working. 

Note voicemail box is the same as last 4 digits of DID. This simplifies
enduser training. 

Permission given to steal this dialplan logic outright if you can put up
with my sloppy code.


[from-pstn]


;8259 is a single DID for example purposes. All this does is set variables,
then dumps the caller to a dialing context
;TODO: Make variable setting dynamically loaded from a database


exten => 8259,1,SetVar(FAXEMAIL=karenk at landmarkmasterbuilder.com); email
address to send faxes to
exten => 8259,2,SetVar(PRIMARYDIALSTRING=IAX2/landmark:1111 at whitemudridge)
;desk phone
exten => 8259,3,SetVar(SECONDARYDIALSTRING=ZAP/g0/9024985) ;cell phone
number
exten => 8259,4,SetVar(TERTIARYDIALSTRING=) ;3rd number line a home number
exten => 8259,5,SetVar(CALLRECIPIENT=Karen Kelly) ;who the person is
exten => 8259,6,SetVar(WORKSCHEDULE=SHOWHOMEHOURS) ;what their working
schedule is
exten => 8259,7,SetVar(BUILDING=BUILDING1) ;building that they report to
exten => 8259,8,SetVar(IVRVM=vm) ;after dialplan is exhausted, send them to
voicemail or to another context?
exten => 8259,9,SetVar(MAILBOX=8259) ;Mailbox number
exten => 8259,10,Goto(dial-internal,s,1)


[dial-internal]
exten => _s,1,Answer()
exten => _s,2,Wait(2);Wait 2 seconds for a fax CNG tone
exten => _s,3,Gotoif($["${WORKSCHEDULE}" = "BUSINESSHOURS" ]?bushours,1) 
exten => _s,4,Gotoif($["${WORKSCHEDULE}" = "SHOWHOMEHOURS"
]?showhomehours,1)
exten => _s,5,Gotoif($["${WORKSCHEDULE}" = "SHOWHOMEHOURSSHORT"
]?showhomehoursshort,1)
exten => _s,6,Goto(bushours,1);If there is no schedule set, assume Business
Hours


exten => bushours,1,Gotoiftime(*|sat|*?dialsecondary,1)
exten => bushours,2,Gotoiftime(*|sun|*?dialsecondary,1)
exten => bushours,3,Gotoiftime(8:00-17:00|mon-fri|*|*?dialprimary,1)
exten => bushours,4,Goto(dialprimary,1) ;If there's a time in this range
that doesn't fit the above, dial the Primary number anyway


exten => showhomehours,1,Gotoiftime(*|fri|*?dialsecondary,1)
exten => showhomehours,2,Gotoiftime(15:00-20:00|*|*?dialprimary,1)
exten => showhomehours,3,Gotoiftime(12:00-18:00|sat-sun|*?dialprimary,1)
exten => showhomehours,4,Goto(dialsecondary,1) ;If there's a time in this
range that doesn't fit the above, dial the Primary number anyway


exten => showhomehoursshort,1,Gotoiftime(*|fri|*?dialsecondary,1)
exten => showhomehoursshort,2,Gotoiftime(14:00-20:00|*|*?dialprimary,1)
exten =>
showhomehoursshort,3,Gotoiftime(11:00-18:00|sat-sun|*?dialprimary,1)
exten => showhomehoursshort,4,Goto(dialsecondary,1) ;If there's a time in
this range that doesn't fit the above, dial the Primary number anyway


exten => dialprimary,1,SetCallerID(${CALLERIDNUM})
exten => dialprimary,2,Gotoif($["${PRIMARYDIALSTRING}foo" != "foo" ]?3:5)
;Check for a NULL Primary Dialstring if it is null go to secondary
exten => dialprimary,3,ChanIsAvail(${PRIMARYDIALSTRING}) ; check if the
dialstring's channel is available if not go to secondary number
exten => dialprimary,4,Dial(${PRIMARYDIALSTRING},12,T)
exten => dialprimary,5,Goto(dialsecondary,1) ;If user does not pick up in 12
seconds dial his cell (secondary number) 
exten => dialprimary,104,Goto(dialsecondary,1)


exten => dialsecondary,1,SetCallerID(${CALLERIDNUM})
exten => dialsecondary,2,Gotoif($["${SECONDARYDIALSTRING}foo" != "foo"
]?3:5) ;Check for a NULL Secondary Dialstring if it is null go to tertiary
exten => dialsecondary,3,ChanIsAvail(${SECONDARYDIALSTRING}); check if the
dialstring's channel is available if not go to tertiary number
exten =>
dialsecondary,4,Dial(${SECONDARYDIALSTRING}&${PRIMARYDIALSTRING},18,T)
exten => dialsecondary,5,Goto(dialtertiary,1) ;If user does not pick up in
18 seconds dial his tertiary number, or voicemail
exten => dialsecondary,104,Goto(dialtertiary,1)


;Tertiary dialing not done yet, instead user is just sent to voicemail
exten => dialtertiary,1,Goto(ivr-vm,1)
exten => dialtertiary,102,Goto(ivr-vm,1)


;We can also modify the IVRVM variable to send the caller to an IVR if IVRVM
is not set to the string "vm"
exten => ivr-vm,1,Gotoif($["${IVRVM}" = "vm" ]?2:3)
exten => ivr-vm,2,Voicemail(u${MAILBOX}@default)
exten => ivr-vm,3,Goto(${IVRVM},s,1)


;Inbound faxes are indicated to the user by momentarily dialing their
extension with Caller ID like this: "Fax: 4035551212"
;In actual use, the Primary dialstring which is typically SIP or IAX works
perfect every time
;but Secondary numbers like cell phones, the dialstring timeout is way, way
too short. Oh well. 


exten => fax,1,SetVar(TEMPHOLDER=${CALLERIDNUM})
exten => fax,2,SetCallerID(Fax: ${CALLERIDNUM})
exten => fax,3,Dial(${SECONDARYDIALSTRING}&${PRIMARYDIALSTRING},1,T)
exten => fax,4,SetCallerID(${TEMPHOLDER})
exten => fax,5,Goto(fax-exception,exception,1)


[fax-exception]


;Fax exception to send fax machines "incompatible" with SpanDSP to a REAL
fax, this list is trimmed for readability
;In our rollout, there are actually 160 numbers out of several thousand that
can potentially send to us. Pretty good, yay Steve U! 
;TODO DeadAGI script that automatically maintains this list

exten => exception,1,Wait(1)
exten => exception,2,GotoIf($["${CALLERIDNUM}" = "7804365798" ]?realfax,1:3)
exten => exception,3,Gotoif($["${CALLERIDNUM}" = "7809292186" ]?realfax,1:4)
exten => exception,4,Gotoif($["${CALLERIDNUM}" = "7804369640"
]?realfax,1:5);etc,etc add numbers as you encounter them
exten => exception,5 ,Goto(virtualfax,1)


exten => virtualfax,1,Macro(faxreceive)
exten => virtualfax,2,System(/etc/asterisk/emailfax ${FAXFILE} ${FAXEMAIL}
${CALLERIDNUM})


;we have 3 buildings that a "real" fax can go to, this extension determines
the building, sends it to the right building, sends an email
;to the recipient informing them that their expected fax was received on
hardcopy,
;and informs the receptionist via email that a hardcopy fax came in and
please to distribute it to the recipient


exten => realfax,1,GotoIf($["${BUILDING}" = "BUILDING1" ]?2:8)
exten => realfax,2,SetVar(REPEMAIL=receptionist at landmarkmasterbuilder.com)
exten => realfax,3,Gotoif($["${FAXEMAIL}foo" = "foo" ]?6:4)
exten => realfax,4,Gotoif($["${CALLRECIPIENT}" != "Landmark Office"
]?5:6);Check for fax DID. If fax DID, inform ONLY the receptionist of the
fax
exten => realfax,5,System(/etc/asterisk/emailfaxlogbuilding1 ${FAXEMAIL}
${CALLERIDNUM})
exten => realfax,6,System(/etc/asterisk/emailfaxlogreception ${REPEMAIL}
${CALLERIDNUM} "${CALLRECIPIENT}")
exten => realfax,7,Dial(ZAP/g0/7023011);Fax number of REAL fax for Building
1
exten => realfax,8,GotoIf($["${BUILDING}" = "BUILDING2" ]?9:15)
exten => realfax,9,SetVar(REPEMAIL=deborahm at summerhillhomes.ca)
exten => realfax,10,Gotoif($["${FAXEMAIL}foo" = "foo" ]?11:13)
exten => realfax,11,Gotoif($["${CALLRECIPIENT}" != "Summerhill Office"
]?12:13)
exten => realfax,12,System(/etc/asterisk/emailfaxlogbuilding2 ${FAXEMAIL}
${CALLERIDNUM})
exten => realfax,13,System(/etc/asterisk/emailfaxlogreception ${REPEMAIL}
${CALLERIDNUM} "${CALLRECIPIENT}")
exten => realfax,14,Dial(ZAP/g0/7028268) ;Fax number of REAL fax for
Building 2
exten => realfax,15,GotoIf($["${BUILDING}" = "BUILDING3" ]?15:16)
exten => realfax,16,Dial(ZAP/g0/7023011) ;Fax number of REAL fax for
Building 3 - NOT IMPLEMENTED YET
exten => realfax,17,NoOp(Temporary placeholder)
exten => realfax,18,NoOp(Temporary placeholder)


;We put the FAX extension in this context in case somehow a fax call winds
up in this context but is not detected properly


exten => fax,1,Goto(exception,1)
exten => fax,2,Goto(realfax,1)



hth

-----Original Message-----
From: James Armstrong [mailto:james at thearmstrongs.org]
Sent: Tuesday, November 29, 2005 11:34 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [Asterisk-Users] Small office with all employee's offsite


Jason Marshall wrote:
>> OK, then this is easy. Instal Asterisk in the central location, along
>> with a Sipura SPA-3000. Configure that unit to answer the incoming
>> POTS line and act as a VOIP gateway for Asterisk. Then configure two
>> additional SPA-3000 units, one at each employee's location. Then,
>> configure Asterisk (I recommend Asterisk at Home for your setup, BTW) to
>> route the incoming call to the right extension based on time of day,
>> auto-attendant, whatever. The SPA-3000 units at each remote site will
>> also be able to accept the employee's incoming POTS line and pass that
>> call through to the phone they normally use without resorting to
>> sending it to the Asterisk server and back. (It's all in the SPA-3000
>> setup.
>
>
> Very cool indeed.  Thanks Tom!  Now to throw a monkey-wrench into the
> works...  One of the employees spends a lot of time outside of his home
> office, and is then reachable only by cell phone.  But we (for obvious
> reasons) don't want to hand out his cell number to everyone who wants to
> reach him.  So, he will often forward his home phone to his cell, and
> forward the main office number to his home number (so when people call
> the office, they get his cell without realizing it).
>
We do this all the time. We just moved and have three people working
from their homes. The boss's extension rings here locally on a spare
phone and rings his IAX2 phone at home. He also forwards his extension
to his cellphone when he is out using *72 on the Asterisk box. One
employee is working from out of state and his extension calls his
cellphone. When someone dials his DID number it dials back out to his
cell phone and no one knows any different. When we dial his three digit
extension here it goes to his cell phone. The last person has an IAX
client running on his laptop and takes calls from there. When someone
calls in and presses '2' for support it rings a guy out in production
and the other person working from home.

I have my extension set to ring my Grandstream phone and my cell phone
at the same time and I can take the calls from anywhere. I can even
transfer a call back to another extension from my cellphone if they need
someone else. Asterisk does all the call forwarding and phone routing.

- James

> Is there any way to use the SPA-3000 at his house to re-route calls
> (VOIP calls, in this case) to his cell?  Or would that have to be done
> at the office where the server is physically.  I'm not clear on whether
> the Asterisk server can control a remote SPA-3000 in this way.
>
As long as Asterisk has a way to re-dial out a phone line or voip
provider, it can route an extension anywhere and the caller will not
know it.

> I guess this could be done directly from the Asterisk server, couldn't
> it? It wouldn't be something that could happen automatically; it would
> have to be manually turned on and off.  But it would also require
> another POTS line at the main office for the outbound call -- so I'd
> rather leverage the phone line at his home office to make the outgoing
> call to his cell phone if at all possible...
>
> One more monkey-wrench -- what if I want both of the employees to be on
> the phone at the same time?  Two incoming POTS lines, and two SPA-3000's
> at the office?  Or does it make more sense at that time to get a TDMxx
> card?
>
>> This will not change, you're still looking at three lines in the
>> scenario I outlined above. (Unless you switch to incoming VOIP, but I
>> do *NOT* recommend that.)
>
>
> Nope, I don't believe in VOIP replacing POTS completely yet.  Maybe in 5
> years...
>
>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-
>
> | Jason Marshall, marshalj at spots.ab.ca. Spots InterConnect, Inc.
> Calgary, AB |
>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list