Difference between revisions of "Calling Cards External Script"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''This option is available starting from [[MOR_9_documentation | MOR 9]]''
<br>
 
<big><b>This topic is ADVANCED and shows how to MOD MOR. Please do not use this functionality if you are not sure what you are doing! </b></big>
<big><b>This topic is ADVANCED and shows how to MOD MOR. Please do not use this functionality if you are not sure what you are doing! </b></big>


<br>
<br>
<big><b>Asterisk AGI and C programming knowledge is necessary to use this feature. </b></big>
<br><br>
= What is it for? =
= What is it for? =


Line 12: Line 14:
But very often it is necessary to extend or change such behavior.
But very often it is necessary to extend or change such behavior.


This functionality is made as external script in which clients (with enough programming skills) can define the way how MOR reacts to some situations.
This functionality is made as external script in which users (with enough programming skills) can define the way how MOR reacts to some situations.


With External Script it is possible:
With External Script it is possible:
Line 20: Line 22:
* Adjust real call duration of the Card User  
* Adjust real call duration of the Card User  


<br>
With this script it is possible to achieve various functionality, as example some of them:
* Taxation per call
* Connection Fee per call
* Disconnection Fee per call
* Multiple in-progress fees
* Post-call surcharges
* Adjust call duration surcharges
* Random surcharges
* Maintenance/Service charges /Recurring configuration that are applied by system at fix interval configured in days
* Toll Free Surcharge in case of call is from the TOLL FREE number (pass alone to reseller in this case owner of TF and a calling card owner a.k.a person who dial TF).
* Custom rounding increments


<br><br>
<br><br>
= How to turn it on? =
= How to turn it on? =


Line 27: Line 43:


<br>
<br>
[[File:Card_group_edit_ext_script_no.png]]
[[image:Card_group_edit_ext_script_no.png]]


[[File:dot.jpg]]<br>
Turn it ON:
Turn it ON:


<br>
<br>
[[File:Card_group_edit_ext_script_yes.png]]
[[image:Card_group_edit_ext_script_yes.png]]


[[File:dot.jpg]]<br>
<big><b>NOTE: When External Script is ON, Ghost Minutes and Ghost Balance functionality is NOT used from the GUI. It is defined in External Script.</b></big>
<big><b>NOTE: When External Script is ON, Ghost Minutes and Ghost Balance functionality is NOT used from the GUI. It is defined in External Script.</b></big>


Line 56: Line 70:


<br>
<br>
[[File:cc_external1.png]]
[[image:cc_external1.png]]


[[File:dot.jpg]]<br>
This shows the output BEFORE telling the balance to the Card User.
This shows the output BEFORE telling the balance to the Card User.


Line 64: Line 77:


<br>
<br>
[[File:cc_external2.png]]
[[image:cc_external2.png]]


[[File:dot.jpg]]<br>
This shows the output BEFORE telling the time to the Card User.
This shows the output BEFORE telling the time to the Card User.



Latest revision as of 14:14, 4 December 2012


This topic is ADVANCED and shows how to MOD MOR. Please do not use this functionality if you are not sure what you are doing!


Asterisk AGI and C programming knowledge is necessary to use this feature.



What is it for?

This functionality is designed to allow clients to modify the way how MOR Core behaves with Calling Cards.

MOR itself has some logic which allows to change this from the GUI.

But very often it is necessary to extend or change such behavior.

This functionality is made as external script in which users (with enough programming skills) can define the way how MOR reacts to some situations.

With External Script it is possible:

  • Adjust Time which is told to the Card User
  • Adjust Balance which is told to the Card User
  • Adjust real call duration of the Card User


With this script it is possible to achieve various functionality, as example some of them:

  • Taxation per call
  • Connection Fee per call
  • Disconnection Fee per call
  • Multiple in-progress fees
  • Post-call surcharges
  • Adjust call duration surcharges
  • Random surcharges
  • Maintenance/Service charges /Recurring configuration that are applied by system at fix interval configured in days
  • Toll Free Surcharge in case of call is from the TOLL FREE number (pass alone to reseller in this case owner of TF and a calling card owner a.k.a person who dial TF).
  • Custom rounding increments



How to turn it on?

By default it is OFF:


Card group edit ext script no.png

Turn it ON:


Card group edit ext script yes.png

NOTE: When External Script is ON, Ghost Minutes and Ghost Balance functionality is NOT used from the GUI. It is defined in External Script.



How to use it?

File which does all the logic is in /usr/src/mor/agi/mor_cc_external.c

It is written in C with a lot of commentaries which explains all the logic INSIDE THE FILE.

Same script can be rewritten in any other programming language by experienced programmer which knows how to interact with Asterisk over AGI.

Make changes to this file, execute ./install.sh in same folder to compile and move it to correct place.



How to know it is working?

Make a call using Calling Cards with enabled Tell Time/Balance and watch Asterisk CLI:


Cc external1.png

This shows the output BEFORE telling the balance to the Card User.

NOTE: default External Script DOES NOT change any values, it is just for demo.


Cc external2.png

This shows the output BEFORE telling the time to the Card User.

NOTE: default External Script DOES NOT change any values, it is just for demo.


IMPORTANT: To make sure script works OK, you SHOULD see line:

MOR CC External Script stopped.



See also