SARK V4.0.0 Apps

From sailpbx
Revision as of 09:48, 6 June 2013 by Adminwiki (talk | contribs) (Creating an app)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

back to SARK v4.0.0 contents

Sark allows you to add your own code blocks and logic to the Asterisk dialplan. We call these objects "custom apps", or just Apps. Asterisk has a rich scripting language which allows you great freedom to customise your PBX to suit your needs. SARK allows you to tap into this to create your own features and add-ons for your PBX.

App control flow

Architecturally, SARK has two routes or call-paths through its logic structure. If you imagine the PBX as a telephone call router with telephone calls arriving from the outside (from big bad world) and also calls arriving from the inside (from our internal extensions) then we can imagine having one call-path to process calls coming from the outside and a second call-path to process calls coming from our inside extensions. When you build an App, you tell SARK which of these two call-paths you want your App logic to be inserted into; either "internal" or "external". You can also choose "both" if you want your app to be included in all paths or "neither" if your app will exist independently. Independent apps can be directly called from other objects such as trunks or IVRs.



V4 app 1.png



Creating an app

Click on the new-object button to create a new app.

V4 app 2.png



Choose a name for your app (it should follow the rules for an regular asterisk context), a span (internal|external|both|neither) and then write your Asterisk code block into the free-form code window. In this example we have created a feature **755 which will do a warm restart of the asterisk server. Because this is potentially sensitive we have protected the feature with a password challenge.
Save your code and run a test to see if it does what you want it to do. The possibilities available to you using apps are virtually limitless. There is lots of information about asterisk dialplan coding available on the Web and several excellent books on the subject.