Inbound Dial Plan for MagicJack Users

Getting started with the SIP Sorcery

Inbound Dial Plan for MagicJack Users

Postby richardtaur » Tue Jul 14, 2009 4:09 am

Seems SS inbound call works well for a lot of you with PAP2T, if you want to try out this inbound dial plan, feel free to try it out.

Code: Select all
#Ruby
sys.Trace = true
sys.Log("*****************************************************\t")
sys.Log("*  MAGICJACK     INBOUND CALL FROM RUBY DIALPLAN     *\t")
sys.Log("*****************************************************\t")
sys.Log(" Received-URI:#{req.URI.User}\t URI-Length:#{req.URI.User.Length}\t")
sys.Log(" URI-Host:#{req.URI.Host}\t")
sys.Log(" From:#{req.Header.From.FromURI.User}\t\t Name:#{req.Header.From.FromName}\t")
sys.Log(" Incoming-Call:#{sys.In().ToString()}\t Outgoing-Call:#{sys.Out().ToString()}\t")
sys.Log(" ATA-Online:#{sys.IsAvailable("your_ss_username", "sipsorcery.com").ToString()}\t")     #Replace your_ss_username to your ss user name.

# Logic for receiving incoming calls.
caller = req.Header.From.FromURI.User.to_s
case caller
  when /^phone1|phone2/                # blocking the call, just replace 10 digit numbers with phone1....if there is more just put | with no spacing.
    sys.Log(" Rejecting call from #{caller}\t")
    sys.Log("*****************************************************\n")
    sys.Respond(488, "Your call is not welcome")
  else
    if sys.IsAvailable("#{req.URI.User}","sipsorcery.com")                  # you can also replace #{req.URI.User} to your ss user name
      sys.Log(" Accepting call from #{caller}\t")
      sys.Log("*****************************************************\n")
      sys.Dial("local")
    else
      sys.Log(" Missed Call from #{caller}\t")
      sys.Log("*****************************************************\n")
      sys.Dial("xxxxxxxxxx@MagicJack")                                            # your MJ number, so it will go to the voice system.
    end
end
richardtaur
 
Posts: 109
Joined: Wed Apr 09, 2008 4:13 pm

Postby sirmikey1 » Tue Jul 14, 2009 7:00 pm

Richard,

Is the \t\t intentional on line 8?

Thank you for sorting this out.

Mike
Last edited by sirmikey1 on Tue Jul 14, 2009 9:22 pm, edited 1 time in total.
sirmikey1
 
Posts: 157
Joined: Mon May 25, 2009 11:19 pm

Postby richardtaur » Tue Jul 14, 2009 7:23 pm

That is just help the format looks good. \t means a tab, I believe.
richardtaur
 
Posts: 109
Joined: Wed Apr 09, 2008 4:13 pm


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 2 guests

cron