Alternatives to "req.URI.User" in Inbound Ruby Dial Plans?

Support zone
Post Reply
User avatar
Flip
Posts: 82
Joined: Sun Aug 19, 2012 3:53 am

Alternatives to "req.URI.User" in Inbound Ruby Dial Plans?

Post by Flip » Tue Nov 01, 2016 11:59 am

Hello!
To get the user name that is being called you can use:

Code: Select all

case req.URI.User
    when "xyz" then sys.Dial("XYZ@local")
However, what if you want to check based on the value of another variable? For example, check value against the VSP name under the SIP Providers - what can you use? (i.e. *inbound* call)

Code: Select all

case req.URI.___VSP?___
    when "___VSP?___" then sys.Dial("1234@____VSP?____")
    when "___VSP?___" then sys.Dial("3456@____VSP?____")
    when "___VSP?___" then sys.Dial("6789@____VSP?____")
This appears like the only solution to segregate VSPs between users.
Thanks! :D
ISP: Exetel ADSL2+ $60 Bundle. 22.4/1.2Mbps, 200/∞ GB [AAPT] + PSTN Bundle [Telstra].
VSP: Telecube¹, SIPTalk², MyNetFone³ via SIPSorcery & Ol' Voxalot. [OMG! Ewww Yuck!! Avoid DIDLogic!!!
H/W: Asus RT-AC66U; Cisco SPA232D, 3 x SPA302's, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

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

Re: Alternatives to "req.URI.User" in Inbound Ruby Dial Plans?

Post by Aaron » Wed Nov 02, 2016 8:43 am

There aren't any other alternatives.

The "req" part of the variable refers to the received SIP request and the req.URI and all the other req.* fields refer to the individual parts of the SIP request and headers. If there some information you want in the request that's not there the only way to get it is to have the caller that generated the request add it.

For the case you have mentioned regarding working out which SIP Provider originated a call take a look at http://www.sipsorcery.com/mainsite/Help#Incoming.

User avatar
Flip
Posts: 82
Joined: Sun Aug 19, 2012 3:53 am

Re: Alternatives to "req.URI.User" in Inbound Ruby Dial Plans?

Post by Flip » Sat Nov 12, 2016 7:13 pm

So the SIP Provider (VOIP Account) would need to be created/edited to have these fields, correct? I am unsure whether I need to change the Register Contact or just the Name??
SIP Provider (SIP Account)
Name: ABC.Jane # SIP Account for one User/DID, not 100 DIDs![/i]
Register Contact: route.jane@local (or @sipsorcery.com) # Allow to process Jane's calls.
So incoming/inbound plan could look like:

Code: Select all

# Incoming dial plan example.
sys.Log("New incoming call received to #{req.URI.User} from #{req.Header.From.ToString()}.")
 
case req.URI.User
  #? Why "@Provider1" in your Wiki??? Don't you mean @SipSorcery or @local for "Inbound" ???
  when "ABC.Jane", "XYZ.Jane" then sys.Dial("Jane123@local") # Two SIP A/C FWD through to Jane's SS A/C.
  when "CC.Fred", "MNF.Fred", "TLC.Fred" then sys.Dial("Fred789n@local") # Three SIP A/C FWD thru to Fred's SS A/C (as above).
  else sys.Dial("SIP_Account_User_Name@SIP_Provider_10.com") # Call external VOIP service as a backup. Cannot be configured with SIP Sorcery otherwise will cause loop...?
end
Q: What was the limitation with CID & SS you mentioned before? Where it was up to the VSP to pass it on? What should I be asking each VSP in order to determine this? Something in the header? or ...
ISP: Exetel ADSL2+ $60 Bundle. 22.4/1.2Mbps, 200/∞ GB [AAPT] + PSTN Bundle [Telstra].
VSP: Telecube¹, SIPTalk², MyNetFone³ via SIPSorcery & Ol' Voxalot. [OMG! Ewww Yuck!! Avoid DIDLogic!!!
H/W: Asus RT-AC66U; Cisco SPA232D, 3 x SPA302's, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest