OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen...

21
OpenSIPS Config & Routing Ali Pey October 21, 2014

Transcript of OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen...

Page 1: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

       

OpenSIPS Config & Routing

Ali Pey

October 21, 2014

Page 2: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Cloud Services for Business

•  eFax® •  eVoice® •  FuseMail® •  Campaigner® •  KeepItSafe® •  Onebox® •  www.j2.com

2

Page 3: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Outline:

•  Reference Diagram •  Proxy Server •  Routes and Direction

•  NAT and Network Configuration •  Media/RTP Proxy •  Load balancing, Dynamic routing •  Redundancy and High Availability

•  Question?

3

Page 4: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Reference Diagram

4

Page 5: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

opensips.cfg

•  Global Parameters •  fork •  listen IPs and mhomed •  Modules

•  route{ }

5

Page 6: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Routing Logic

•  SIP Requests vs Responses •  Direction?

6

Page 7: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Direction

$var(direction)="unknown"; # (Ali) - detect the direction of the request and set a script flag accordingly if ( src_ip == 10.10.11.11 ){ # From opensips server itself (Notify Reboot message) if( is_method("NOTIFY") ){ xlog( "L_Info", "NOTIFY from OpenSIPS: src_ip=$src_ip\n"); xlog( "L_Info", " O-NOTIFY from=$fu\n"); xlog( "L_Info", " O-NOTIFY req uri=$ru\n"); } route(10); } else if ( src_ip == 10.10.11.12 || src_ip == 10.10.11.13 ){ # From media servers $var(direction)="from_mg"; setsflag(1); if ( has_body( "application/sdp" )) { fix_nated_sdp( "11", "204.1.7.4" ); }

7

Page 8: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Direction Continued

} else if ( src_ip == 10.10.11.12 || src_ip == 10.10.11.13 ){ # From media servers $var(direction)="from_mg"; setsflag(1); if ( has_body( "application/sdp" )) { fix_nated_sdp( "11", "204.1.7.4" ); } if( is_method("INVITE") ){ xlog( "L_Info", "INVITE from MG: src_ip=$src_ip\n"); xlog( "L_Info", " A-INVITE from=$fu\n"); xlog( "L_Info", " A-INVITE req uri=$ru\n"); } else { xlog( "L_Info", "$rm from MG: User:$fU\n"); } } else if ( src_ip == 10.10.11.100 ) { # From the IVR Server $var(direction)="from_ivr_voiceserver"; setsflag(1);

8

Page 9: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Routes

1. route 2. branch_route 3. failure_route 4. onreply_route 5. error_route 6. local_route 7. startup_route 8. timer_route 9. event_route

9

Page 10: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

NAT and Network Configuration

•  Using a Firewall •  NAT Detection •  SDP IP re-writes

10

Page 11: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Reference Diagram

11

Page 12: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

RTPProxy

•  Media Proxy (or Direct Media Path)

•  offer, answer and engage •  rtp_proxy_set •  route, branch_route and failure_route

12

Page 13: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Load balancing

•  Load balancer and dispatcher modules •  Groups and resources •  Dialog module •  Load balancer •  Monitoring

13

Page 14: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Reference Diagram

14

Page 15: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Dynamic Routing

•  Carriers and Trunks •  Rules •  Failure detection and re-routing

15

Page 16: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Dial Plan Module

•  Digit manipulation •  Group selection

16

Page 17: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Database, Reporting and Management

•  Datebase (mysql, oracle, odbc, postgres) •  MI •  OpenSIPS-CP

17

Page 18: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Modules (over 120 modules)

•  SIP Clients related modules: –  Registrar Server –  Authentication –  Presence Server –  Instant messaging, Jabber, Json, SMS –  NAT Traversal –  Back to Back User Agent (topology hiding)

18

Page 19: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Redundancy

•  Heartbeat and Virtual IP •  net.ipv4.ip_nonlocal_bind •  Database replication (Mater-Slave vs. Master-Master)

19

Page 20: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

Questions?

20

Page 21: OpenSIPS Config & Routing · 10/21/2014  · opensips.cfg • Global Parameters • fork • listen IPs and mhomed • Modules • route{ } 5

       

21