Hi, Thanks Phil, I will implement this and get back to you. Best Regards, Madushan On Thu, Mar 3, 2016 at 4:12 PM, Phil Reynolds < phil-asterisk at tinsleyviaduct.com> wrote:> On Thu, 3 Mar 2016 08:21:14 +0530 > Madushan Geethanga <mgliyanage.rc at gmail.com> wrote: > > > Hi > > I have to setup call forwarding. How do we setup Call forwarding in > > asterisk?. Eg. user dials a number and insert some mobile number for > > forwarding and dial another number to cancel the forwarding. thanks a > > lot. > > I implemented this like so in my default context: > > exten => _*21.,1,Answer() > same => n,GotoIf($["${CALLERID(num)}"="<redacted>"]?divert:void) > same => n(divert),Set(DB(divert/${CALLERID(num):-4})=${EXTEN:3}) > same => n,Gosub(divertactive,1) > same => n,Hangup() > same => n(void),Gosub(divertvoid,1) > exten => _#21,1,Answer() > same => n,GotoIf($["${CALLERID(num)}"="<redacted>"]?divert:void) > same => n(divert),Verbose(0,${DB_DELETE(divert/${CALLERID(num):-4})}) > same => n,Gosub(divertoff,1) > same => n,Hangup() > same => n(void),Gosub(divertvoid,1) > > (note: use whatever you need in the GotoIf to validate that the phone > the call is from is permitted to set up call forwarding - unless you're > allowing it for all that can reach the context) > > The divert{off,active,void} subroutines are where I handle the > announcements - but you could probably easily implement your own. > > At the top of my [voicemail] context, I do this: > > > exten=>s,1,GotoIf(${DB_EXISTS(divert/${ARG3})}?outbound-standard,${DB_RESULT},1) > > (ARG3 contains the last four digits of the number the call came to in > my case, and a success passes the call via the "outbound-standard" > context which is in my dialplan. Your exact requirements may vary but > this may help.) > > -- > Phil Reynolds > mail: phil-asterisk at tinsleyviaduct.com > Web: http://phil.tinsleyviaduct.com/ > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160303/560047b8/attachment.html>
Hi What is redacted means? same => n,GotoIf($["${CALLERID(num)}"="*<redacted>*"]?divert:void) Thanks Best Regards, Madushan On Thu, Mar 3, 2016 at 10:58 PM, Madushan Geethanga <mgliyanage.rc at gmail.com> wrote:> > Hi, > > Thanks Phil, I will implement this and get back to you. > > Best Regards, > Madushan > > On Thu, Mar 3, 2016 at 4:12 PM, Phil Reynolds < > phil-asterisk at tinsleyviaduct.com> wrote: > >> On Thu, 3 Mar 2016 08:21:14 +0530 >> Madushan Geethanga <mgliyanage.rc at gmail.com> wrote: >> >> > Hi >> > I have to setup call forwarding. How do we setup Call forwarding in >> > asterisk?. Eg. user dials a number and insert some mobile number for >> > forwarding and dial another number to cancel the forwarding. thanks a >> > lot. >> >> I implemented this like so in my default context: >> >> exten => _*21.,1,Answer() >> same => n,GotoIf($["${CALLERID(num)}"="<redacted>"]?divert:void) >> same => n(divert),Set(DB(divert/${CALLERID(num):-4})=${EXTEN:3}) >> same => n,Gosub(divertactive,1) >> same => n,Hangup() >> same => n(void),Gosub(divertvoid,1) >> exten => _#21,1,Answer() >> same => n,GotoIf($["${CALLERID(num)}"="<redacted>"]?divert:void) >> same => n(divert),Verbose(0,${DB_DELETE(divert/${CALLERID(num):-4})}) >> same => n,Gosub(divertoff,1) >> same => n,Hangup() >> same => n(void),Gosub(divertvoid,1) >> >> (note: use whatever you need in the GotoIf to validate that the phone >> the call is from is permitted to set up call forwarding - unless you're >> allowing it for all that can reach the context) >> >> The divert{off,active,void} subroutines are where I handle the >> announcements - but you could probably easily implement your own. >> >> At the top of my [voicemail] context, I do this: >> >> >> exten=>s,1,GotoIf(${DB_EXISTS(divert/${ARG3})}?outbound-standard,${DB_RESULT},1) >> >> (ARG3 contains the last four digits of the number the call came to in >> my case, and a success passes the call via the "outbound-standard" >> context which is in my dialplan. Your exact requirements may vary but >> this may help.) >> >> -- >> Phil Reynolds >> mail: phil-asterisk at tinsleyviaduct.com >> Web: http://phil.tinsleyviaduct.com/ >> >> -- >> _____________________________________________________________________ >> -- Bandwidth and Colocation Provided by http://www.api-digital.com -- >> New to Asterisk? Join us for a live introductory webinar every Thurs: >> http://www.asterisk.org/hello >> >> asterisk-users mailing list >> To UNSUBSCRIBE or update options visit: >> http://lists.digium.com/mailman/listinfo/asterisk-users >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160304/dcc201a0/attachment.html>
On Fri, 4 Mar 2016, Madushan Geethanga wrote:> What is redacted means? > > same => n,GotoIf($["${CALLERID(num)}"="<redacted>"]?divert:void)Censored. Ususally for political reasons. In this case, the OP didn't want to put a real phone number in a public list. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST