Setting up a basic Small Office SIP setup

Hey guys, I’m a newb here so treat me gentle!

Okay, I’m looking to get a small office setup going using an external SIP provider. I have inbound and outbound calls working using DID call routes, but I’m having problems setting up the phones that need to be rang etc.

every person has a dedicated desk and phone, so there’s no need for hotdesking or queues I don’t think.

Basically what I’m looking to achieve is:
[]3 different departments (Sales/Support & Development)[/]
[]Incoming Sales calls will call all sales phones for 25 seconds, then will fallback to try all Support phones for 25 seconds, then will go to Sales voicemail[/]
[]Incoming Support calls will do the same, but Support first and then sales, and will then go to Support voicemail[/]
[]All phones should have their own voicemail accounts also (by dialling 171)[/]

I may need other features after that, but these are the basics to get the office up and running with Asterisk.

Here are my config files at the moment:
SIP.CONF:

[code][general]
port = 5060
bindaddr = 0.0.0.0
context = incoming

register => :********@***

[1001]
;Test Sales phone
type=peer
host=dynamic
secret=1001
context=users
mailbox=1001@default

[1002]
;Test Support phone
type=peer
host=dynamic
secret=1002
context=users
mailbox=1002@default

[PBXTest2Out]
type=peer
host=***********
defaultuser=*********
fromuser=*********
secret=*********
canreinvite=no
insecure=invite
context=incoming
[/code]

EXTENSIONS.CONF

[code][macro-phone]
exten => s,1,Dial(SIP/${MACRO_EXTEN},5)
exten => s,n,Goto(${DIALSTATUS},1)
exten => ANSWER,1,Hangup
exten => CANCEL,1,Hangup
exten => NOANSWER,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => BUSY,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CONGESTION,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CHANUNAVAIL,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => a,1,VoicemailMain(${MACRO_EXTEN}@default)

; INBOUND CALL ROUTING
[incoming]
; Sales number will call Sales Phones then Support phones then go to Sales voicemail
exten => IrlSales,1,Dial(Local/Sales@callarounds)
exten => IrlSales,2,Dial(Local/Support@callarounds)
exten => IrlSales,2,VoicemailMain(Sales@default)
; Support number will call Support Phones then Sales phones then go to Support voicemail
exten => IrlSupport,1,Dial(Local/Support@callarounds)
exten => IrlSupport,2,Dial(Local/Sales@callarounds)
exten => IrlSupport,3,VoicemailMain(Support@default)

; CALLAROUND GROUPS
[callarounds]
exten => Sales,1,Dial(Local/1001@desks)
exten => Support,1,Dial(Local/1002@desks)

; PEOPLES ACTUAL DESK PHONES
[desks]
exten => 1001,1,Macro(phone)
exten => 1002,1,Macro(phone)
exten => 171,1,VoicemailMain(${EXTEN}@default)

; OUTBOUND CALLS
[local]
exten => _NXXXXXX,1,Dial(SIP/PBXTest2Out/01${EXTEN})

[fallback]
exten => _X.,1,Dial(SIP/${EXTEN}@PBXTest2Out)
exten => _X.,2,Hangup

[users]
include => desks
include => local
include => fallback
[/code]

VOICEMAIL.CONF:

[code][general]
format=mp3|wav
serveremail=voicemail@company.com
attach=yes
fromstring=Company Voicemail
emailsubject=New Company Voicemail message ${VM_MSGNUM}
emailbody=A ${VM_DUR} long message from ${VM_CALLERID}, on ${VM_DATE}\n
emaildateformat=%A, %d %B %Y at %H:%M:%S

[default]
1001 => 1001,Mailbox 1001,user1@company.com
1002 => 1002,Mailbox 1002,user2@company.com
Sales => Sales,Sales Mailbox,support@company.com
Support => Support,Support Mailbox,support@company.com
[/code]

At the moment my inbound calls aren’t falling back from one “callaround” to the next and incoming voicemail isn’t working either.

Can anyone help?
Kevin Pattison

As a matter of urgency, change your internal passwords (also set allowguest=no).

Macros are deprecated.

The phone macro sends failed calls to voicemail, so the call on the local channel will succeed at that point, and the dialplan will terminate.

The ANSWER line in the macro will never be reached as you don’t have dial options set to continue on answer, and I cannot think why you would want to do so.

Your example doesn’t actually include calling multiple phones.

Thanks david55,

I’m only really testing this in a sandbox environment at the moment, none of the passwords etc, will be used live.

You’re right, I’d removed the multiple numbers from the callaround groups for testing the fallback to the second group. In the live environment the callround context dial extensions would dial multiple desks.

I’ll remove the macro and change the desk context contents then and see if I can get it working.

It’s been a long time and at the moment I don’t have access to the asterisk server to look at our dialplan, but, if memory serves, it’s something close to this:

extensions.conf

[globals]
; -- timeoutvalues
SALESTIMEOUT=25
SUPPORTTIMEOUT=45

; -- ring groups
SALESGROUP=SIP/phone01&SIP/phone02&SIP/phone03&SIP/phone04
SUPPORTGROUP=SIP/phone08&SIP/phone09&SIP/phone10&SIP/phone11

[general]
clearglobalvars=yes

[sales-pstn-inbound]
; -- Assuming DAHDI line to sales dept
exten => s,1,Answer()
  same => n,Dial(${SALESGROUP},${SALESTIMEOUT})
  same => n,Dial(${SUPPORTGROUP},${SUPPORTTIMEOUT})
  same => n,VoiceMail(1@default,su)
  same => n,Hangup()

[support-pstn-inbound]
; -- Assuming DAHDI line to support dept
exten => s,1,Answer()
  same => n,Dial(${SUPPORTGROUP},${SUPPORTTIMEOUT})
  same => n,Dial(${SALESGROUP},${SALESTIMEOUT})
  same => n,VoiceMail(2@default,su)
  same => n,Hangup()

Hope this helps!