opensips an event driven sip routing engine
play

OpenSIPS - an event-driven SIP routing engine Liviu Chircu - 4th - PowerPoint PPT Presentation

OpenSIPS - an event-driven SIP routing engine Liviu Chircu - 4th Feb 2017 - Outline Architecture timeline Event subscribe-notify Usage scenarios OpenSIPS scripts Conclusions Liviu Chircu - OpenSIPS Project -


  1. OpenSIPS - an event-driven SIP routing engine Liviu Chircu - 4th Feb 2017 -

  2. Outline Architecture timeline ● Event subscribe-notify ● Usage scenarios ● OpenSIPS scripts ● Conclusions ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 2

  3. Architecture timeline

  4. Step 1: “Linear” architecture OpenSIPS 1.X 1 d a e r h T 2 d a e r h T Time SIP packet arrivals CPU bound I/O bound Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 4

  5. Step 2: “Async” architecture OpenSIPS 2.1, 2.2 1 d a e r h T Time SIP packet arrivals CPU bound I/O bound Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 5

  6. Limitation: Processing is still linear! Advanced SIP scenarios: Push Notifications ● FreeSWITCH ESL Events (e.g. DTMF) ● Call Pick-up ● What’s missing: Communication & data exchange between different ● processing contexts Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 6

  7. Step 3: “Event-driven” architecture SIP msg A wait(event X) resume() 1 d a e event X r h SIP msg B T 2 d a e r h T Time SIP packet arrivals Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 7

  8. Step 3: “Event-driven” architecture SIP msg A wait(event X) resume() 4xx SIP reply 1 d a e r h T timeout! Time SIP packet arrival Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 8

  9. Step 3: “Event-driven” architecture SIP msg A trigger(handler, eventX) 1 d a e r h SIP msg B T 2 d a eventX e r h T handler Time SIP packet arrivals Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 9

  10. Event subscribe/notify

  11. Event Definition Triggered by actions / data processing during runtime ● Events hold key/value attributes ● OpenSIPS has a list of predefined events ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 11

  12. Subscribe interested OpenSIPS workers subscribe to events ● event subscriptions may contain filtering attributes ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 12

  13. Notify Notification == event ● Events are generated during runtime ● They are dispatched to all relevant subscribers ● Events are parametrized (e.g. DTMF digit, REG Contact) ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 13

  14. Usage scenarios

  15. Push Notifications INVITE bob REGISTER PN 1xx INVITE bob Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 15

  16. Push Notifications Current way 1. incoming call for “bob” 2. send PN to “bob”’s mobile device 3. async sleep (N) 4. call(“bob”) if registered(“bob”) else goto 3. Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 16

  17. Push Notifications Current way (limitations) 1. performance killer 2. inflexible, cannot handle complex scenarios parallel forking (desk + mobile devices) ● multiple gateways ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 17

  18. Push Notifications In 2.3: 1. incoming call for “bob” 2. subscribe(“REGISTER”, “aor=bob”, “reg_handler”) 3. send PN to “bob”’s mobile device 4. fork calls to existing registrations ... route [reg_handler] { fork_call(“$event(contact)”); } Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 18

  19. DTMF-based fax/voicemail detection In 2.3: 1. incoming call for “bob” 2. subscribe(“DTMF”, “callid=$ci”, “dtmf_handler”) 3. send call to “bob” ... route [dtmf_handler] { hangup() if $event(digit) != 2 } Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 19

  20. OpenSIPS Script

  21. Push Notifications subscribe("REGISTER", "aor=bob", "reg_handler"); route(SEND_APN); if (lookup("location")) t_relay(); halt(); Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 21

  22. Push Notifications route [SEND_APN] { rest_append_hf("Authorization: key=CONSOLE_API_KEY"); rest_append_hf("Content-Type: \"application/json\""); rest_post("https://android.googleapis.com/gcm/send", "{ \"data\" : {\"foo\": \"bar\"}, \"registration_ids\":[\"REGISTRATION_ID\"] }"...); } Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 22

  23. Push Notifications route [reg_handler] { route(CHECK_IF_MOBILE, "$event(contact)"); t_relay(); } Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 23

  24. Conclusions

  25. Conclusions Event-driven approach: powerful & easy to use ● complex scenarios with simple script ● lightning fast! ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 25

  26. OpenSIPS 2.3 - “integration” SIP capturing - Homer/SIPCapture ● billing - CGRateS ● software PBX - FreeSWITCH ● middleware - RabbitMQ ● Liviu Chircu - OpenSIPS Project - FOSDEM ‘17 - 26

  27. Take-Away Message Under development! Liviu Chircu ● OpenSIPS Project: www.opensips.org ○ liviu@opensips.org ○

Recommend


More recommend