Howto use SIP Failover (2.X)

From berofix - professional SIP gateway
Jump to: navigation, search


In the 2.X FW we have added SIP Failover Support in the Config String "more". This feature allows to provide a backup SIP Peer which is used in case the primary SIP Peer will not be reachable or will return a Server Error (503) for invites that we send to it.

So the SIP Failover peer, needs to be defined as seperate SIP Entry. And can be specified in the config string of the primary SIP Peer or even in the dialplan directly.

Step-by-Step tutorial

Initially you have one SIP Server that might fail:


Now you add a backup SIP Server that should be used in case that SIP-Server failed. We name it SIP-Failover-Server: 


Next Step is to edit the main SIP-Server Account Settings and go to "more" and then define the SIP-Failover-Server as  
the "Failover-Account" via the Dropdown. Also specify the Failover-Timeout after which the failed call should be re-
routed to the SIP-Failover-Server.


Implementing ISDN Fallback with SIP Failover

The berofix itself can be specified as SIP Failover Peer. So if you need an ISDN Fallback in case a SIP Peer is unreachable or responds Server Errors you need to do the following steps:

1.) Add a "fallback" SIP Entry with the IP Address of berofix itself


2.) modify the primary SIP Peer and configure the failover_proxy=fallback, also add a failover_prefix=fallback (in "more")


3.) create a SIP-ISDN Dialplan Entry with the Settings:
    FromID = .* (or local IP Address of berofix)
    Destination = fallback(.*)
    NewDestination = \1


The Dialplan Entry should have a higher priority then the primary SIP Peer Entries.

How to use Timeouts for failover

beroFix has a number of Timers that can be started when a SIP Invite is sent out. You can define the Timers:

T0     - has any SIP Response arrived (including a Status 100)
T183   - has a SIP 183 Status arrived 
T180   - has a SIP 180 Status arrived 
T200   - has a SIP 200 Status arrived

The timer is defined in the config string (advanced Settings). The syntax is:

TXXX:${time in seconds};TYYY:${time in seconds}

for example:

response_timer = T0:5;T200:60

When the timers run out and the corresponding SIP Status has not been received an internal ISGW error code is generated. The Error Code map looks like:

T0    - ISGW Error 9000
T183  - ISGW Error 9183
T180  - ISGW Error 9180
T200  - ISGW Error 9200

These Error codes can either be used to drop the call (the ISDN Release cause can be defined in the causes map), or to do a failover to another SIP Account. For the failover case you need to define the ISGW Errors in the failover_causes advanced settings string: