Serial forking

Catalog of dial plans
Post Reply
buskila
Posts: 2
Joined: Tue Feb 10, 2015 4:30 pm

Serial forking

Post by buskila » Wed Feb 11, 2015 8:14 am

Is it possible to fork the INVITE message serially instead of in parallel when calling a user who is bound to two locations? Right now if you do

Code: Select all

sys.Dial("${dst}@mydomain")
INVITE messages are sent in parallel.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Serial forking

Post by Aaron » Wed Feb 11, 2015 8:55 am

Yes.

In the example below the '|' character means the call leg will only be initiated when the legs in the previous attempt have all failed. If the call is successfully answered at any point the following call legs are ignored.

Code: Select all

sys.Dial("1234@dest|4567@dest2|7689@dest3")

buskila
Posts: 2
Joined: Tue Feb 10, 2015 4:30 pm

Re: Serial forking

Post by buskila » Wed Feb 11, 2015 9:37 am

Oh, i didn't explain myself.

Suppose user1@mydomain is registered from two locations and user2@mydomain calls user1. If you simply Dial(${dst}@mydomain) the server will automatically fork to both locations in parallel.

Is there any way to refer to each registration location so i could put them inside the Dial() string like you suggested?

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Serial forking

Post by Aaron » Thu Feb 12, 2015 10:18 am

You can do that sort of forking if you are calling your own sipsorcery account. To do it you get a list of the individual bindings and then call them directly rather than the SIP account address.

For another provider the answer is almost certainly no. No provider I know of lets you request a list of individual bindings. To do so would be a potential security compromise as you'd be quickly the get the IP addresses of another user's SIP devices (you can potentially any way once the call is answered and RTP is flowing but at least the user has chosen to accept your call at that point).

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

Re: Serial forking

Post by Flip » Thu May 26, 2016 7:49 am

Can you add a time-out at the end of serial forking? and after an 'or' ('|')?
"123 & 234 & 345 | 789" ,25
  1. Dial 123,
  2. AND Dial 234,
  3. AND Dial 345,
  4. AND Dial 456,
  5. OR if all fail, dial 789
  6. CONTINUE next dial plan rule/match after 25sec exceeded
or
"123 & 234[dt=8] & 345[dt=15] & 456[dt=15] | 789" ,25
  1. Dial 123
  2. Dial 234 after 8sec
  3. Dial 345 after 15sec
  4. AND dial 456 after 15 sec
  5. OR if all fail, dial 789 (if [dt=xx], does it start counting from 1sec or ...?)
  6. CONTINUE next dial plan rule/match after 25sec exceeded
Correct? or can you not mix "dt=" with ",xx"? (e.g. ",25")
or can you not use ",xx" if combining with '|' ?
ISP: Southern Phone ADSL2+ $55 Bundle. 22.4/1.2Mbps, GB Bundle [Telstra].
VSP: SIPTalk¹, Symbio² & MyNetFone³ via SIPSorcery Cloud PBX. [Warning! Avoid DIDLogic!!! Beware!!]
H/W: Asus RT-AC86U; Cisco SPA232D, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Serial forking

Post by Aaron » Thu May 26, 2016 11:25 am

Yes you can combine the dt option with the ring timeout parameter.

The thing to be aware of is the ring timeout parameter is independent of any OR options in your dial string. Once the ring timeout parameter is reached the sys.Dial command will be terminated and if there were some OR legs that were not reached then they are ignored.

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

Re: Serial Forking & Multiple Conditional When/Then's

Post by Flip » Thu May 26, 2016 2:01 pm

Brilliant :idea:
I had problems, but realised I was testing with ",true,15". Plus thought that it was important to add an "|" in case it failed outright, instead of continuing. Although that adds another query, how do you return the error with the serial forking? (so it can be logged? or stand out in the log) :?: :!:

A) Any combination of 'true,15' or "15,true" for debug log does not work. What confuses me is all these old 2008/2009 topics for MySipSwtich / MSS... :( Things I have tried, simply do not work, plus they mention an alternate "#Ruby" or other type of dial plan coding... ho humm!

How do you manually trigger a log instead of a log being sent every time?
e.g. fork & fork & fork | fork & logging enabled

B) Queries:
1. conditional rule (when xxxx then debug=1 and sys.dial) - how do you add two or more conditional "then"s??
2. conditional rule (when xxxx and/or zzzz then sys.dial and debug=1) - how do you add two or more conditional "when"s??

I guess this related to both two or more conditional "when" or "then"'s.
Thank you! :)

EDIT: B1 - and/or to and.
Aaron wrote:Yes you can combine the dt option with the ring time-out parameter.

The thing to be aware of is the ring timeout parameter is independent of any OR options in your dial string. Once the ring timeout parameter is reached the sys.Dial command will be terminated and if there were some OR legs that were not reached then they are ignored.
ISP: Southern Phone ADSL2+ $55 Bundle. 22.4/1.2Mbps, GB Bundle [Telstra].
VSP: SIPTalk¹, Symbio² & MyNetFone³ via SIPSorcery Cloud PBX. [Warning! Avoid DIDLogic!!! Beware!!]
H/W: Asus RT-AC86U; Cisco SPA232D, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Aaron
Site Admin
Posts: 4652
Joined: Thu Jul 12, 2007 12:13 am

Re: Serial forking

Post by Aaron » Fri May 27, 2016 8:57 am

This forum is now getting close to 10 years old so perhaps it's not that surprising that some of the example from 7 or 8 years ago no longer work verbatim...

You should be able to find all the fundamental use cases on the reference page in the main site at http://www.sipsorcery.com/mainsite/Help/DialPlans.

The other questions sound like they are asking about Ruby syntax, the scripting language that sipsorcery dialplans use. There are lots of Ruby reference sites such as http://www.tutorialspoint.com/ruby/ruby_quick_guide.htm.

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

Re: Serial forking: Dial, When, Then...

Post by Flip » Mon May 30, 2016 5:36 pm

A) of last question was RE: "true, 15" and "15, true" and so on. I was talking in general re: how some things do not work, and it just so happens that this didn't worked either.

So... how do you manually trigger a log instead of a log being sent every time?

B) Regarding the multiple WHEN's and THEN's...
1. conditional rule (when xxxx then debug=1 and sys.dial) - how do you add two or more conditional "then"s??
2. conditional rule (when xxxx and/or zzzz then sys.dial and debug=1) - how do you add two or more conditional "when"s??

This was all I could find:
case target-expr
when comparison [, comparison]... [then]
body
when comparison [, comparison]... [then]
body
...
[else
body]
end
So...
case req.uri.user -or- req.Header.To
when /^123/, /^234/, /^345/ then sys.dial("${exten}@ABC")


Q: Would be good to be able to use "req.Header.To". I.e. instead of user, get the inbound number dialed... How can we get just the ____ from the <sip:_____@blah>;blah=blaaaah ?


Doesn't appear to be a way on that Ruby resource page, to perform multiple actions on match, after "then"...
Ohhh...
When /^123/, /^234/, /^345/ then
___ something...
___ something else...
___ something else again...
When aaaaa, bbbbb, cccc then
___ something...
___ anything...
else ...
;)
ISP: Southern Phone ADSL2+ $55 Bundle. 22.4/1.2Mbps, GB Bundle [Telstra].
VSP: SIPTalk¹, Symbio² & MyNetFone³ via SIPSorcery Cloud PBX. [Warning! Avoid DIDLogic!!! Beware!!]
H/W: Asus RT-AC86U; Cisco SPA232D, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Post Reply