List Info

Thread: dial plan




dial plan
country flaguser name
United States
2007-04-14 14:00:03
ok I am working on a full featured dial plan and need
functions. If any of you 
have some good dial plan functions you want to contrib send
my way. the idea 
is to get a full working dialp plan into asterisk and the
gui. Please donate 
what you can. 
_______________________________________________
Asterisk-BSD mailing list
Asterisk-BSDlists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-bsd

Re: dial plan
country flaguser name
Canada
2007-04-16 13:07:27
I have one or two that I might contribute.

I use a lot of macros to make my system do what I want. 
Currently, I'm using CDR user fields for a price-per-minute
flag to rate the calls later.

This is a macro I use to handle incoming calls based on DID
number.  It can optionally add a tag to the caller ID to
identify the what line the caller is coming in on (ie. to
separate companies, home vs. business numbers, etc)

[macro-did] ; ARGS - accountcode,rate,Gotocontext,gotoexten
exten => s,1,Set(CDR(accountcode)=$)
exten => s,2,SetAMAFlags(BILLING)
exten => s,3,SetCDRUserField($)
exten => s,4,Set(__INRATE=$)
exten => s,5,GotoIf($[${LEN(${CALLERID(name)})} >
0]?7:6)
exten => s,6,Set(CALLERID(name)=${CALLERID(num)})
exten => s,7,Goto($,$|1)

[macro-did-label] ; ARGS -
accountcode,rate,Gotocontext,Gotoexten,label
exten => s,1,Set(CDR(accountcode)=$)
exten => s,2,SetAMAFlags(BILLING)
exten => s,3,SetCDRUserfield($)
exten => s,4,Set(__INRATE=$)
exten => s,5,GotoIf($[${LEN(${CALLERID(name)})} >
0]?7:6)
exten => s,6,Set(CALLERID(name)=${CALLERID(num)})
exten =>
s,7,Set(CALLERID(name)=$${CALLERID(name)})
exten => s,8,Goto($,$|1)

It then uses Goto() to send the call where it needs to go
(all set by arguments)

This allows for a single line entry into a DID list.

The next group is used for a two line extension entry.
Depending on the macro you call, it affects whether or not
the cellphone is rung simultaneously, 
or only if the phone is unreachable.  If you make a database
entry 
(CELLNUMBER "extension number" "cellphone
number")
the calls can be forwarded out to a cell phone from voice
mail if the caller presses #
Pressing * during the outgoing messages lets them check
voicemail.

[macro-stdexten] ;ARG1 is operator context ARG2 is ring
timeout
exten =>
s,1,Dial(SIP/$/$|$|w)
exten => s,n,Goto(10)
include => macro-cellfail
exten => a,1,VoicemailMain($)               
      ; If they press *, send the user into VoicemailMain

[macro-stdexten-cell] ;ARG1 is operator context ARG2 is ring
timeout
exten =>
s,1,Dial(SIP/$/$&SIP/${MACRO_E
XTEN}-cell/$-cell|$|w)
exten => s,n,Goto(10)
include => macro-cellfail
exten => a,1,VoicemailMain($)               
      ; If they press *, send the user into VoicemailMain

[macro-stdexten-cell-alt] ;ARG1 is operator context ARG2 is
ring timeout
exten =>
s,1,Dial(SIP/$/$&SIP/${MACRO_E
XTEN}-cell/$-cell&SIP/$-alt/$-alt|$|w)
exten => s,n,Goto(10)
include => macro-cellfail
exten => a,1,VoicemailMain($)               
      ; If they press *, send the user into VoicemailMain

[macro-stdexten-home];sends to cell, alt, and local home
context for alternate phones
exten => s,1,Set(_CID=${CALLERID(name)})
exten => s,2,Set(CALLERID(name)=$:$)
exten =>
s,n,Dial(SIP/$/$&SIP/${MACRO_E
XTEN}-cell/$-cell&SIP/$-alt/$-alt&Local/${MACRO_EX$
exten => s,n,Goto(10)
include => macro-cellfail
exten => a,1,VoicemailMain($)               
      ; If they press *, send the user into VoicemailMain

[macro-stdexten-simulcell] ;ARG1 is operator context ARG2 is
ring timeout
exten => s,1,GotoIf($[${LEN(${CALLERID(num)})} >
9]?4:2)
exten => s,2,Set(__PSTNCALLERID=9999999${CALLERID(num)})
exten => s,3,Goto(s|5)
exten => s,4,Set(__PSTNCALLERID=${CALLERID(num)})
exten =>
s,5,Dial(SIP/$/$&SIP/${MACRO_E
XTEN}-alt/$&Local/${DB(CELLNUMBER/${MAC
RO_EXTEN})}forward/n|$|tw)
exten => s,6,Goto(s-$,1)
exten => s-NOANSWER,1,Voicemail($|su)
exten => s-NOANSWER,2,Hangup
exten => s-CHANUNAVAIL,1,Voicemail($|su)
exten => s-CHANUNAVAIL,2,Hangup
exten => s-BUSY,1,Voicemail($|sb)
exten => s-BUSY,2,Hangup
exten => a,1,VoicemailMain($)
exten => o,1,Goto($|0|1)


[macro-stdexten-sequenced] ;ARG3 is outgoing CID, ARG1 is
operator context ARG2 is ring timeout
exten =>
s,1,Dial(SIP/$/$&SIP/${MACRO_E
XTEN}-alt/$|$)
exten => s,2,GotoIf($[${LEN(${CALLERID(num)})} >
9]?5:3)
exten => s,3,Set(__PSTNCALLERID=$)
exten => s,4,Goto(s|6)
exten => s,5,Set(__PSTNCALLERID=${CALLERID(num)})
exten =>
s,6,Dial(Local/${DB(CELLNUMBER/$)}forward/n||t)
exten => s,7,Goto($|0|1)

[macro-voicemail]
exten => s,1,Goto(10)
include => macro-cellfail

[macro-cellfail]
exten => s,10,Goto(s-$,1)
exten => s-NOANSWER,1,Voicemail($|su)
exten =>
s-NOANSWER,2,Gotoif(DB_EXISTS(CELLNUMBER/$)?3:5
)
exten =>
s-NOANSWER,3,Dial(Local/${DB(CELLNUMBER/$)}forward/n|20|t)
exten => s-NOANSWER,4,Voicemail($|sb)
exten => s-NOANSWER,5,Hangup
exten =>
s-CHANUNAVAIL,1,Gotoif(DB_EXISTS(CELLNUMBER/$)?
2:3)
exten =>
s-CHANUNAVAIL,2,Dial(Local/${DB(CELLNUMBER/$)}<
img src="/img/at.gif" align="middle" border="0"
alt="">forward/n|20|t)
exten => s-CHANUNAVAIL,3,Voicemail($|su)
exten => s-CHANUNAVAIL,4,Hangup
exten => s-BUSY,1,Voicemail($|sb)
exten => s-BUSY,2,Hangup
exten => _s-.,1,Goto(s-NOANSWER,1)                       
      ; Treat anything else as no answer
exten => a,1,VoicemailMain($)               
      ; If they press *, send the user into VoicemailMain
exten => o,1,Goto($|0|1)
exten => t,1,Playback(ss-noservice)
exten => t,2,Congestion

I hope this is useful.

If it's too messy, or if you need clarification, e-mail me
and I'll send direct text attachments to whomever.

-Tim


On Saturday 14 April 2007 15:00, Richard Neese wrote:
> ok I am working on a full featured dial plan and need
functions. If any of
> you have some good dial plan functions you want to
contrib send my way. the
> idea is to get a full working dialp plan into asterisk
and the gui. Please
> donate what you can.
> _______________________________________________
> Asterisk-BSD mailing list
> Asterisk-BSDlists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-bsd

-- 
Tim St. Pierre

IP telephony specialist
sip://5101communicatefreely.net
Toronto: 647 722 6930
Toll-Free 1 888 488 6940
timcommunicatefreely.net

_______________________________________________
Asterisk-BSD mailing list
Asterisk-BSDlists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-bsd

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )