[asterisk-users] Dial an extension to modify dialplan
Stefan Becker
becker at yukonho.de
Tue May 9 07:21:06 CDT 2017
Greetings,
I think this is a better solution:
I've created a simular solution for our main incoming line. Extentions
can add/remove themselfs from
the distrubuting extention.
I used the DATABASE functions of Asterisk to accomplish this following.
my example:
first create a few Database/Keys in the Asterisk CLI to express which
phones may use this feature
and how the extention will actually be dialed. Like I have two phones on
differant hardware that
BOTH act as "169" and both get called by "169" but need special
intrustions to be dialed.
In Asterisk CLI
> DATABASE put zentrale 111 0: SIP/111a&SIP/111b
> DATABASE put zentrale 115 0:SIP/114&SIP/115
> DATABASE put zentrale 118 0:SIP/118
> DATABASE put zentrale 298 1:DAHDI/r1/298
> DATABASE put zentrale 168 1:SIP/168&DAHDI/r1/169
add these lines to
extentions.conf
[macro-SetZentrale]
exten => s,1,Set(OPER=${DB_KEYS(zentrale)})
exten => s,n,Set(DailOut=)
exten => s,n,While($["${SET(XXX=${SHIFT(OPER)})}"!=""])
exten => s,n,GotoIf($["${DB(zentrale/${XXX}):0:2}"!="1:"]?skp)
exten => s,n,Set(DailOut=${DailOut}&${DB(zentrale/${XXX}):2})
exten => s,n(skp),EndWhile
exten => s,n,Set(DailOut=${DailOut:1})
exten => s,n,Set(DB(zentrale/ist)=${DailOut})
[SIP-Phones]
;incoming call for "0" --> Operator
exten = 0,1,GotoIfTime(07:45-17:05,mon-fri,*,*?inhours)
same = n,Dial(${DB(zentrale/ist)},10,txk)
same = n,GoTo(SIP-Phones,300,1)
same = n(inhours),Dial(${DB(zentrale/ist)},10,txk)
same = n,SIPAddHeader(Alert-Info:\;info=abwurf)
same = n,Dial(SIP/297&${DB(zentrale/ist)},30,txk)
same = n,GoTo(SIP-Phones,300,1)
same = n,HangUp()
exten = 300,1,Answer()
same = n,Wait(1)
same = n,VoiceMail(300)
same = n,HangUp()
exten = 301,1,Set(OPER=${DB_KEYS(zentrale)})
same = n,Answer()
same = n,PlayBack(/etc/asterisk/wav/301-zentrale)
same = n,PlayBack(/etc/asterisk/wav/500-nbstl)
same = n,While($["${SET(XX=${SHIFT(OPER)})}"!=""])
same = n,GotoIf($["${DB(zentrale/${XX}):0:2}"!="1:"]?skp)
;same = n,SayNumber(${XX})
same = n,SayPhonetic(${XX})
same = n,Wait(1)
same = n(skp),EndWhile
same = n,Wait(1)
same = n,PlayBack(vm-goodbye)
same = n,HangUp()
exten = 302,1,Answer()
same = n,Set(CDR(accountcode)=${CALLERID(number):-3})
same =
n,GotoIf($["${DB_EXISTS(zentrale/${CALLERID(number)})}"="0"]?301,1)
same =
n,GotoIf($["${DB(zentrale/${CALLERID(number)}):0:2}"="1:"]?off)
same =
n,Set(DB(zentrale/${CALLERID(number)})=1${DB(zentrale/${CALLERID(number)}):1})
same = n,macro(SetZentrale)
same = n,PlayBack(beep)
same = n,PlayBack(beep)
same = n,PlayBack(/etc/asterisk/wav/500-nbstl)
;same = n,SayNumber(${CALLERID(number)})
same = n,SayPhonetic(${CALLERID(number)})
same = n,PlayBack(/etc/asterisk/wav/302-hinzu)
same = n,Goto(bye)
same =
n(off),Set(DB(zentrale/${CALLERID(number)})=0${DB(zentrale/${CALLERID(number)}):1})
same = n,macro(SetZentrale)
same = n,PlayBack(beep)
same = n,PlayBack(/etc/asterisk/wav/500-nbstl)
;same = n,SayNumber(${CALLERID(number)})
same = n,SayPhonetic(${CALLERID(number)})
same = n,PlayBack(/etc/asterisk/wav/302-hinab)
same = n(bye),Wait(1)
same = n,PlayBack(vm-goodbye)
same = n,HangUp()
;END
Incoming calls to "0" --> Dial all phones listed via "302"
---> Dial(${DB(zentrale/ist)})
"300" - VoiceMail-Box
"301" - "reads off" the list of phones registered via "302"
"302" - if extention not registered, adds calling extention (database
entry must exist) to Dial-List
DATABASE entry "zentrale/ist" is created or modified by this
methode
"302" - if extention registered, removes calling extention from Dial-List
${DB(zentrale/ist)
I hope this may interest and help you along ....
my best regards,
Stefan Becker
On Mon, May 8, 2017 at 4:35 PM, Frank Vanoni <mailinglist at linuxista.com>
wrote:
>Hello
>I have the following scenario:
>
>[mynicecontext]
>exten => 2000,1,Dial(SIP/deviceA&SIP/deviceB&SIP/deviceC)
>As expected, by dialing 2000, all three devices will ring. And that's
>fine.
>However, there are situations where I only want "deviceA" and "deviceB"
>to ring. I would like to have an extension to dial in order to modify
>the dialplan.
>.........
More information about the asterisk-users
mailing list