Code: Select all
dst_num0 = req.URI.User.to_s
if dst_num0 =~ /^\*\*8(.+)/ # **8, command to bridge two calls
dst_num0 = $1.gsub(/\*\*/, "|")
dst_num0 =~ /^([^|]+)([|]([^|]*))?([|]([^|]*))?/
dst_num0 = $1
($3 && ($3 != ""))? (dst_num1 = $3) : (dst_num1 = dst_num0; dst_num0 = default_callback_number)
delay = $5.to_i
sys.Callback(dst_num0+"@provider", dst_num1+"@provider", delay)
end
Code: Select all
**8First_number**Second_number**Delay
"**8First_number" triggers sys.Callback(default_callback_number, First_number, 0)
"**8First_number****12" triggers sys.Callback(default_callback_number, First_number, 12)
"**8First_number**Second_number" triggers sys.Callback(First_number, Second_number, 0)
Similarly, you can use **1, **2 or any prefix to initiate a command you want to execute. If Aaron were to implement personal storage or non-volatile varibles for personal use, you will be able to change your dial plan on the fly. i.e. you can use your softphone, or use PSTN dial in or callback to connect to an IVR, to dial a command string that will trigger a callback to arbitrary numbers or change anything in your dial plan such as default local outbound provider, default international outbound provider, default callback number, etc. That will be really cool, instead of finding some place to log on the sipswitch web site to change your dial plan.
In the mean time, instead of hearing dead air when you dial a command, if you want to get some audible feedback to confirm that your command is going to be or have been executed, you can insert the following code or the similar in your command processing:
Code: Select all
sys.Dial(",,*4621777xxxxxxx@sipbroker.com,<sip:0000000@sipbroker.com>", 2) # give some audible feedback
Hope the above can add a grain of salt for advanced users.