ARI and AGI
A powerful combination
Jöran Vinzens
@vinzens81
linkedin.com/in/jvinzens/
What?
What?
It is not a manual how to use Asterisk!
What?
Story of how we think we could be ready for the future.
What are AMI, AGI and ARI
What are AMI, AGI and ARI
Interfaces to control the Asterisk
What are AMI, AGI and ARI
AMI - Asterisk Manager Interface
● Event based
● Modify or create Channels
● No access to Dialplan Functions or Apps
● Asynchronous does not block
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239
What are AMI, AGI and ARI
AGI - Asterisk Gateway Interface
● Execute a script or call a socket
● Only on dialplan operation
● Can execute dialplan applications and functions
● Easy to use
● Synchronous and blocks channel
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=32375589
AGI != FastAGI
What are AMI, AGI and ARI
ARI - Asterisk REST Interface
● Event based
● HTTP socket and REST interface
● Control of low level resources in Asterisk
● Asynchronous, might block
ARI = Dialplan app Stasis
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
What are AMI, AGI and ARI
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
What are AMI, AGI and ARI
When to use what?
AMI - Channel manipulation during a call
AGI - Extended dialplan Handling
ARI - Write your own dialplan application
https://wiki.asterisk.org/wiki/display/AST/AMI+v2+Specification#AMIv2Specification-ProtocolOverview
Goal
Goal
Everyone should be able to write PBX features
Goal
SIP, Asterisk Dialplan, AGI, AMI, ARI, etc. are complex
Goal
Create an abstraction
What are we doing with the Asterisk
What are we doing with the Asterisk?
Call routing
In call features
Accounting/billing
Announcements
IVR, Conference etc….
Customer API
How are we using the Asterisk
How are we using the Asterisk?
Lot of Dialplan
Several FastAGI executions
Some AGI Scripts
AMI call manipulation
How are we using the Asterisk?
Lot of Dialplan
Several FastAGI executions
Some AGI Scripts
AMI call manipulation
Every feature is distributed allover the place
Problems with the current setup
Problems with the current Setup
Everything saved in Channel Vars
Several local Dial()
Multiple Calls of FastAGI and AGI and manager Interconnection
Problems with the current Setup
Loss of state and variables
Features interfere with each other
Problems with the current Setup
Loss of state and variables
Features interfere with each other
Setup has been grown beyond repair
Possible solution
Possible solution
Respect system boundaries
Stick to standards
Use components for what they are designed for
Possible solution
AGI
● Use as testable dialplan generic to any features
ARI
● Control of resources during the call specific to each feature
Possible solution
AGI
● Call Setup and Teardown
ARI
● The only instance controlling a feature during the entire call
Possible solution
AGI
● Check the feature and call correct Stasis App
● Determine outgoing carrier, write CDR, ...
ARI
● All feature relevant handlings
How would it look like
How would it look like?
How would it look like?
How would it look like?
App
dispatcher
ARI App
Out
dispatcher
App
dispatcher
ARI App
SIP SIPlocal
How would it look like?
App Dial -> App Stasis
How would it look like?
App Dial -> App Stasis
Small-sized Stasis apps
How would it look like?
Use ARI Proxy
Move routing logic away from Asterisk
How would it look like?
Use ARI Proxy
Move routing logic away from Asterisk
Kafka -> https://github.com/retel-io/ari-proxy
NATS / Rabbit MQ -> https://github.com/CyCoreSystems/ari-proxy
How would it look like?
How would it look like?
Low level API, ARI High level API
How would it look like?
Asterisk
ARI WS
ARI REST
Kafka
Low level
Call
control
High level
Feature
control
Low level API, ARI High level API
ARI Proxy
Benefits
Benefits
● Less untested dialplan
● Easy to replace features
● No developer interactions with Asterisk Dialplan
● Generic Asterisk dialplan
● Low level ARI API enables any feature
● Decouple telephony feature from Asterisk
Benefits
AGI -> control generic Features
ARI -> enables features and isolates from each other
Earlier
Earlier
Astricon 2018: How ARI-Proxy works
youtube.com/watch?v=vMCyuItMYxE
CommCon 2019: Migrate old to new
youtube.com/watch?v=Y9R0mg9eC9c
Questions?
Thanks for listening!
Jöran Vinzens
@vinzens81
linkedin.com/in/jvinzens/

ARI and AGI, a powerful combination

  • 1.
    ARI and AGI Apowerful combination Jöran Vinzens @vinzens81 linkedin.com/in/jvinzens/
  • 2.
  • 3.
    What? It is nota manual how to use Asterisk!
  • 4.
    What? Story of howwe think we could be ready for the future.
  • 5.
    What are AMI,AGI and ARI
  • 6.
    What are AMI,AGI and ARI Interfaces to control the Asterisk
  • 7.
    What are AMI,AGI and ARI AMI - Asterisk Manager Interface ● Event based ● Modify or create Channels ● No access to Dialplan Functions or Apps ● Asynchronous does not block https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239
  • 8.
    What are AMI,AGI and ARI AGI - Asterisk Gateway Interface ● Execute a script or call a socket ● Only on dialplan operation ● Can execute dialplan applications and functions ● Easy to use ● Synchronous and blocks channel https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=32375589
  • 9.
  • 10.
    What are AMI,AGI and ARI ARI - Asterisk REST Interface ● Event based ● HTTP socket and REST interface ● Control of low level resources in Asterisk ● Asynchronous, might block ARI = Dialplan app Stasis https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
  • 11.
    What are AMI,AGI and ARI https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
  • 12.
    What are AMI,AGI and ARI When to use what? AMI - Channel manipulation during a call AGI - Extended dialplan Handling ARI - Write your own dialplan application https://wiki.asterisk.org/wiki/display/AST/AMI+v2+Specification#AMIv2Specification-ProtocolOverview
  • 13.
  • 14.
    Goal Everyone should beable to write PBX features
  • 15.
    Goal SIP, Asterisk Dialplan,AGI, AMI, ARI, etc. are complex
  • 16.
  • 17.
    What are wedoing with the Asterisk
  • 18.
    What are wedoing with the Asterisk? Call routing In call features Accounting/billing Announcements IVR, Conference etc…. Customer API
  • 19.
    How are weusing the Asterisk
  • 20.
    How are weusing the Asterisk? Lot of Dialplan Several FastAGI executions Some AGI Scripts AMI call manipulation
  • 21.
    How are weusing the Asterisk? Lot of Dialplan Several FastAGI executions Some AGI Scripts AMI call manipulation Every feature is distributed allover the place
  • 22.
    Problems with thecurrent setup
  • 23.
    Problems with thecurrent Setup Everything saved in Channel Vars Several local Dial() Multiple Calls of FastAGI and AGI and manager Interconnection
  • 24.
    Problems with thecurrent Setup Loss of state and variables Features interfere with each other
  • 25.
    Problems with thecurrent Setup Loss of state and variables Features interfere with each other Setup has been grown beyond repair
  • 26.
  • 27.
    Possible solution Respect systemboundaries Stick to standards Use components for what they are designed for
  • 28.
    Possible solution AGI ● Useas testable dialplan generic to any features ARI ● Control of resources during the call specific to each feature
  • 29.
    Possible solution AGI ● CallSetup and Teardown ARI ● The only instance controlling a feature during the entire call
  • 30.
    Possible solution AGI ● Checkthe feature and call correct Stasis App ● Determine outgoing carrier, write CDR, ... ARI ● All feature relevant handlings
  • 31.
    How would itlook like
  • 32.
    How would itlook like?
  • 33.
    How would itlook like?
  • 34.
    How would itlook like? App dispatcher ARI App Out dispatcher App dispatcher ARI App SIP SIPlocal
  • 35.
    How would itlook like? App Dial -> App Stasis
  • 36.
    How would itlook like? App Dial -> App Stasis Small-sized Stasis apps
  • 37.
    How would itlook like? Use ARI Proxy Move routing logic away from Asterisk
  • 38.
    How would itlook like? Use ARI Proxy Move routing logic away from Asterisk Kafka -> https://github.com/retel-io/ari-proxy NATS / Rabbit MQ -> https://github.com/CyCoreSystems/ari-proxy
  • 39.
    How would itlook like?
  • 40.
    How would itlook like? Low level API, ARI High level API
  • 41.
    How would itlook like? Asterisk ARI WS ARI REST Kafka Low level Call control High level Feature control Low level API, ARI High level API ARI Proxy
  • 42.
  • 43.
    Benefits ● Less untesteddialplan ● Easy to replace features ● No developer interactions with Asterisk Dialplan ● Generic Asterisk dialplan ● Low level ARI API enables any feature ● Decouple telephony feature from Asterisk
  • 44.
    Benefits AGI -> controlgeneric Features ARI -> enables features and isolates from each other
  • 45.
  • 46.
    Earlier Astricon 2018: HowARI-Proxy works youtube.com/watch?v=vMCyuItMYxE CommCon 2019: Migrate old to new youtube.com/watch?v=Y9R0mg9eC9c
  • 47.
    Questions? Thanks for listening! JöranVinzens @vinzens81 linkedin.com/in/jvinzens/