Brekeke Forum Index » Brekeke SIP Server Forum

Post new topic   Reply to topic
Failover in Dialplan
Author Message
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Sat Oct 27, 2018 3:48 pm    Post subject: Failover in Dialplan Reply with quote

1. Brekeke Product Name and Version:

SIP Serer 3.8.6.4

2. Java version:
1.8.0_181

3. OS type and the version:

Windows 7 Pro SP1

4. UA (phone), gateway or other hardware/software involved:

Various, including 3CX

5. Your problem:

In the Wiki, it shows a basic dialplan failover like this:

Deploy Patterns
To = sip:100@192.168.0.100
$session = failover sip:101@192.168.0.101 sip:102@192.168.0.102

Does this mean that after the INVITE Timeout or if an SIP error is received before the INVITE timeout, that the dialplan will try the first IP address in the $session string and then if that one doesn't work, the dialplan will try the second IP address in the $session string?

Somewhere I came up with the idea of using a $session string for each failover IP address, like this:

$session = failover sip:101@192.168.0.101
$session = failover sip:102@192.168.0.102

Is this not correct? Or does it matter (will each do the same thing)?

Also, there's an example of failover for specific error codes or groups of error codes, such as:

Deploy Patterns
To = sip:100@192.168.0.100
$session = failover sip:101@192.168.0.101
&failover.pattern.response = 4..

Is it possible to watch for multiple error codes or groups of error codes, such as 4.. OR 5.., such as the following?

Deploy Patterns
To = sip:100@192.168.0.100
$session = failover sip:101@192.168.0.101
&failover.pattern.response = 4.. OR 5..


John Rayfield, Jr.

_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Sat Oct 27, 2018 3:54 pm    Post subject: Reply with quote

Forgot a couple of other questions...

I've also seen $target used for failover in a dialplan.

What are the advantages and/or disadvantages of using $target instead of $session = failover?

I'm also unclear as to what &failover.timer.provisional affects. I've seen that used with the $session = failover string.

John Rayfield, Jr.

_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Back to top
View user's profile
Tata
Brekeke Master Guru


Joined: 27 Jan 2008
Posts: 223

PostPosted: Sun Oct 28, 2018 4:13 pm    Post subject: Reply with quote

> Does this mean that after the INVITE Timeout or if an SIP error is received before the INVITE timeout, that the dialplan will try the first IP address in the $session string and then if that one doesn't work, the dialplan will try the second IP address in the $session string?

YES

> Is this not correct?

Right, it is not correct

> &failover.pattern.response = 4.. OR 5..

&failover.pattern.response = [45]..
Back to top
View user's profile
JRayfield
Brekeke Guru


Joined: 03 Dec 2012
Posts: 147
Location: Springfield, MO

PostPosted: Sun Oct 28, 2018 5:56 pm    Post subject: Reply with quote

What about the advantages and/or disadvantages of using $target instead of $session = failover?

And what does &failover.timer.provisional affect. I've seen that used with the $session = failover string.

John

_________________
John Rayfield, Jr. CETma
Rayfield Communications
Springfield, MO
www.rayfield.net
Back to top
View user's profile
Harold
Brekeke Master Guru


Joined: 21 Sep 2008
Posts: 286
Location: Japan

PostPosted: Sun Oct 28, 2018 8:22 pm    Post subject: Reply with quote

Note $target doesn't replace From/To headers while Failover plugin does automatically.

$target can be used if you want to keep original From/To headers and
forward SIP packets to another SIP server. (as SBC).


> What about the advantages and/or disadvantages of using $target instead of $session = failover?

Advantages:
$target is implemented inside the proxy engine so it doesn't require any plugin. It means you can use $target with any custom Session Plugin.

(because $session variable can be used only once, you can not use another Session plugin if you use $session=failover together. )



> &failover.timer.provisional

It is the timeout for waiting for a provisional response (1xx)
Back to top
View user's profile
epascual
Brekeke Member


Joined: 03 Sep 2015
Posts: 22
Location: Spain

PostPosted: Tue Dec 11, 2018 7:51 am    Post subject: Reply with quote

I am also using failover, but I want dialplan not to try when some codes are received:
180 or 503.

&failover.pattern.response = 'not 180 or 503'

Is it possible?

I want when 180 or 503 are received dialplan does not continue trying.
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Tue Dec 11, 2018 1:54 pm    Post subject: Reply with quote

It is not easy but possible.
Code:
&failover.pattern.response = ^([46]..)|(5[1-9].)|(50[^3])

FYI: https://en.wikipedia.org/wiki/Regular_expression
A provisional Responses such as 180 is always passed.
Back to top
View user's profile
epascual
Brekeke Member


Joined: 03 Sep 2015
Posts: 22
Location: Spain

PostPosted: Wed Dec 12, 2018 1:06 am    Post subject: Reply with quote

Thank you very much!
Back to top
View user's profile
epascual
Brekeke Member


Joined: 03 Sep 2015
Posts: 22
Location: Spain

PostPosted: Wed Dec 12, 2018 8:54 am    Post subject: Reply with quote

Another question.
I need that the SIP/URIs that are passed as arguments of the failover plugin has URI-parameters.
For example:

failover <sip:218001@192.168.1.26:5060;cd40rs=R2>

But I can see that the INVITE that is sent does not have the parameter in the REQUEST nor in the "To" header.

Is there any way to do it?
Back to top
View user's profile
janP
Brekeke Master Guru


Joined: 25 Nov 2007
Posts: 336

PostPosted: Wed Dec 12, 2018 6:34 pm    Post subject: Reply with quote

Try like this.. It puts a packet back to DialPlan again.

Rule-1:
Matching Patterns
$request = ^INVITE
$localhost = ^true
To = sip:spiral-(.+)@
Deploy Patterns
To = <sip:%1@192.168.1.26:5060;cd40rs=R2>

Rule-2:
Matching Patterns
$request = ^INVITE
Deploy Patterns
To = sip:111@
$session = failover sip:spiral-218001@localhost


First, the rule-2 is executed and sends INVITE to sip:spiral-218001@localhost virtually.

Second, the rule-1 is executed, because the INVITE was sent to localhost and the prefix "spiral-" is found. The rule-2 sends INVITE to 192.168.1.26 as <sip:218001@192.168.1.26:5060;cd40rs=R2>
Back to top
View user's profile
epascual
Brekeke Member


Joined: 03 Sep 2015
Posts: 22
Location: Spain

PostPosted: Thu Dec 13, 2018 2:19 am    Post subject: Reply with quote

It works fine! It is a very ingenious solution!
Thank you very much janP!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Brekeke Forum Index » Brekeke SIP Server Forum All times are GMT - 7 Hours
Page 1 of 1