How to Use MySipSwitch

Support zone

Postby emoci » Sun Aug 17, 2008 12:47 am

Available Ruby Modules

(for more see http://www.mysipswitch.com/forum/viewtopic.php?t=399 )

CallBack Module

sys.Callback(string dest1, string dest2) - Initiates a call to dest1 and if successful then calls dest2 and bridges the calls together. The dest1 and dest2 parameters are SIP Provider constructs.
Code: Select all
# Ruby dialplan example for sys.Callback
sys.Log("call received uri=#{req.URI.User}")
sys.Callback("012345@blueface", "023456@voipstunt")



sys.Callback(string dest1, string dest2, int delay) - After specified delay, it initiates a call to dest1 and if successful then calls dest2 and bridges the calls together. The dest1 and dest2 parameters are SIP Provider constructs.
Code: Select all
# Ruby dialplan example for sys.Callback
sys.Log("call received uri=#{req.URI.User}")
sys.Callback("012345@blueface", "023456@voipstunt" , 10)


Dial Module

A note about the sys.Dial () function.

It can be used in a few forms:

-sys.Dial("ProviderName")

When used in this form, the number called via the specified provider by default is the value stored in the variable req.URI.User

When you are placing a call, req.URI.user is the number you're calling.
When an incoming call is coming in, req.URI.user is your account or subaccount username.

-sys.Dial("1${dst}@ProviderName")

This form is more useful when used for outgoing call routing, allowing one to modify how the number you've dialed is actually dialed via the specified provider. In this case ${dst} is the actual number as you dialed it.


sys.Dial(string provider) - The provider parameter must match a SIP Provider name.

The Dial command will forward the number as dialed to the SIP Provider.
Code: Select all
# Ruby dialplan example for sys.Dial
sys.Log("call received uri=#{req.URI.User}")
sys.Dial("ProviderName")


The Dial command will forward the number with modifications (eg. add 1 to front) to the SIP Provider.
Code: Select all
# Ruby dialplan example for sys.Dial
sys.Log("call received uri=#{req.URI.User}")
sys.Dial("1${dst}@ProviderName")


sys.Dial(string provider, int timeout)- Dial number, and if there is no answer after specified length of time (in seconds) then move to the next command
Code: Select all
# Ruby dialplan example for sys.Dial
sys.Log("call received uri=#{req.URI.User}")
sys.Dial("Provider1", 10)
sys.Dial("Provider2", 10)
sys.Dial("Provider3", 10)

Number modification can also be applied (to adjust number entered based on requirements of each provider):
eg.
Code: Select all
sys.Dial("1${dst}@Provider1", 10)
sys.Dial("00${dst}@Provider2", 10)
sys.Dial("${dst:3}@Provider3", 10)


sys.Dial(string number@provider&string number2@provider)- Simultaneous calls to two or more destinations
Code: Select all
# Ruby dialplan example for sys.Dial
sys.Log("call received uri=#{req.URI.User}")
sys.Dial("Number@Provider1&Number2@Provider1&Number3@Provider2)


sys.Dial(provider1|provider2|provider3)- Number called is passed to the first provider, should it fail, the call is attempted over the second provider, then the third and so on (for those familiar with Asterisk terms, this is the equivalent of FallBack Trunks).
Code: Select all
# Ruby dialplan example for sys.Dial
sys.Log("call received uri=#{req.URI.User}")
sys.Dial("Provider1|Provider2|Provider3)

Number modification can also be applied (to adjust number entered based on requirements of each provider):
eg.
Code: Select all
sys.Dial("1${dst}@Provider1|00${dst}@Provider2|${dst:3}Provider3")


sys.RegexMatch (variable, "value-to-match") - A matching statement to check the value of the specific variable. Should the match be 'True' then other actions can be allowed to occur when this is part of an if statement.
Code: Select all
if sys.RegexMatch(req.URI.User, "skype.mocierion")   then
sys.log("Other modules can be added here, like sys.Dial or sys.Callback")


During and Incoming Call

req.URI.User = The Username of the MSS acct. receiving the call (this the username of your acct., or sub-account, or 'anything.mssuser', if it is a call for anything.mssuser@sip.mysipswitch.com)
req.URI.Host = The host portion of the URI for which the call is coming in (eg. sip.mysipswitch.com or the corresponding IP)

req.Header.From.FromName = Name of Caller
req.Header.From.FromURI.User = Number of Caller (or their username if the call is coming from another MSS or VoIP user )
req.Header.From.FromURI.Host = The Host of the caller (this is usually an IP adress that indentifies the provider your caller is using to call you)

During an Outgoing call

req.URI.User = Number you are calling

req.Header.From.FromURI.User = Your account username (account doing the calling)
req.Header.from.FromURI.Host = Your provider with which you're registering (this is usually the IP for sip.mysipswitch.com )
req.Header.From.FromName = Your Name

Adjusting Outgoing Caller ID:
(this is one way to adjust the outgoing CID, you can also make modifications to the 'From Header' field when setting up a provider)

During an outgoing or Forwarded Call, you can adjust the three fields above to set your customize your Caller ID.

eg.
Code: Select all
req.Header.From.FromURI.User = "01234567"
req.Header.from.FromURI.Host = "mydomain.com"
req.Header.From.FromName = "Joe Bloggs"


The above script would result in a From header of:

From: "Joe Bloggs" <sip:01234567@mydomain.com>

But PLEASE NOTE that the field that is generally used for authentication is req.Header.From.FromURI.User so be aware your calls could fail if it is modified.
emoci
 
Posts: 125
Joined: Mon Aug 20, 2007 11:27 pm

Postby gbonnet » Mon Feb 02, 2009 2:36 pm

You can use a wizard to create your 1st ruby dial plan, see : http://www.mysipswitch.com/rubyzard.aspx
Blueface Phone Service
gbonnet
Site Admin
 
Posts: 681
Joined: Wed Jul 11, 2007 2:58 pm
Location: Bologna

Postby vad987 » Mon Feb 02, 2009 7:50 pm

gbonnet wrote:You can use a wizard to create your 1st ruby dial plan, see : http://www.mysipswitch.com/rubyzard.aspx

Excellent! :D good and necessary work
vad987
 
Posts: 26
Joined: Tue Jan 22, 2008 7:45 am

Postby gbonnet » Mon Feb 02, 2009 8:16 pm

vad987 wrote:Excellent! :D good and necessary work

Spread the word ;)
Blueface Phone Service
gbonnet
Site Admin
 
Posts: 681
Joined: Wed Jul 11, 2007 2:58 pm
Location: Bologna

Postby breezex » Sat May 16, 2009 7:10 am

What is the best VoIP service to phone between UK and Australia? I am in the UK, my mum is in Australia. I want to call her over the internet. Skype is really poor quality. She is already on a VoIP service called MyNetPhone. I would like to chat to her for free or cheap. Any ideas?
Last edited by breezex on Tue May 19, 2009 9:31 am, edited 1 time in total.
breezex
 
Posts: 2
Joined: Fri May 15, 2009 5:27 am

Postby TheFug » Sat May 16, 2009 7:50 pm

Hi, breezex, i checked on sipbroker, for MyNetPhone, but at the moment they do not peer good with other networks, which would be otherwise an option, to make free phone calls, since both "parties" have Voip on each end.
Another option is to call by sip-uri, you must know the username/number, plus de registar domain.
Or you and the callee, should have an account at the same (free) voip provider, and to make it more flexible, both parties should have the use of a Mysipswitch account,
You should tell some more about the hardware you are using, DECT-IP or an IP phone are devices easy to configure, and have less problems, because they are not ATA's ...

btw. Voxalot has also an australian .au server, this could be an advantage for your connection with Australia, and you could take an .eu account at Voxalot.
Thanks, The Fug.

gear: Sitecom modem DC223/DC227†,301 D -gigaset DECT IP basestation. some switches, and a snom820 IP phone
User avatar
TheFug
 
Posts: 907
Joined: Sat Oct 06, 2007 8:23 am
Location: The Netherlands, North-Holland

PreviousNext

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 0 guests