Trying to divert an incoming call with dial plan

Feedback, issues & questions regarding the use of the Telis Wizard and Simple Wizard dial plans.
agsteele
Posts: 4
Joined: Tue Dec 06, 2011 11:15 am

Trying to divert an incoming call with dial plan

Postby agsteele » Tue Feb 05, 2013 4:24 pm

I have a couple of incoming numbers that I need to divert to null, or hangup on without ringing the ATA or even better diverting to on-hold music so that they get charged for the initial connection even if they then hang up.

I've taken a look at the Ruby dialplan that I have that works well for me and certainly don't want to break anything.

The incoming calls bit is currently very simple...

Code: Select all

  # Incoming Calls
  sys.Log("Incoming call to #{req.URI.User}.")

  # Call forwards.
 
end

What I want to do is allow all calls to be handled as at present except for those which have CallerID displayed with a specific format 008000nnnnnnn

Ideally I'd like to generate an Email alert that a call has been handled in this way so that I can monitor what is going on.

Sadly I'm finding the various bits of DialPlan documentation rather dense.

Anyone offer a pointer to the way forward?

Thanks in advance.

Andrew

User avatar
Aaron
Site Admin
Posts: 4546
Joined: Thu Jul 12, 2007 12:13 am

Re: Trying to divert an incoming call with dial plan

Postby Aaron » Tue Feb 05, 2013 10:08 pm

Try this, ensuring to replace "youraccount" with the name of the SIP account you want to forward your incoming calls to and also enter your own email address:

Code: Select all

  # Incoming Calls
  sys.Log("Incoming call to #{req.URI.User}.")

  if req.Header.From.FromURI.User =~ /^008000/
    # Forward undesireables to music on hold.
    sys.SendEmail("your@emailaddress", "Blocked Call", "Call from #{req.Header.From.FromURI.User} was forwarded to MOH.")
    sys.Dial("music@iptel.org")
  else
    # Forward all other calls to your SIP account.
    sys.Dial("youraccount@local")
  end

agsteele
Posts: 4
Joined: Tue Dec 06, 2011 11:15 am

Re: Trying to divert an incoming call with dial plan

Postby agsteele » Wed Feb 06, 2013 9:17 am

Thanks Aaron,

I'll give it a try...

Andrew

netvoice
Posts: 7
Joined: Sat Jan 07, 2012 7:23 pm

Re: Trying to divert an incoming call with dial plan

Postby netvoice » Tue Oct 29, 2013 2:32 am

Hi Aaron,

If I have several numbers need to forward to MOH, what should I write in the rule? I try to put numbers like

Code: Select all

 if req.Header.From.FromURI.User =~ /123456789/564213789/
 sys.Dial("music@iptel.org")


But it doesn't wrok.

Thanks


Return to “Dial Plan Wizards (Telis & Simple)”

Who is online

Users browsing this forum: No registered users and 1 guest