GTT: add generic 'apply' action
This GTT Action can be used to call a user-supplied callback funciton in case
a GT Match was detected.
diff --git a/include/gtt.hrl b/include/gtt.hrl
index 5edeba7..7d48ae7 100644
--- a/include/gtt.hrl
+++ b/include/gtt.hrl
@@ -18,3 +18,9 @@
-record(gtt_act_repl_num_plan, {
numbering_plan
}).
+
+% GTT action for a generic apply/3 call
+-record(gtt_act_apply, {
+ funct,
+ args
+ }).
diff --git a/src/osmo_ss7_gtt.erl b/src/osmo_ss7_gtt.erl
index fb117d4..8f7e243 100644
--- a/src/osmo_ss7_gtt.erl
+++ b/src/osmo_ss7_gtt.erl
@@ -126,9 +126,13 @@
Gt#global_title{phone_number = Header ++ NewDigits ++ Trailer};
% Execute a single action: Replac the numbering plan in the GT
-gtt_action(Gt,Action) when is_record(Gt, global_title), is_record(Action, gtt_act_repl_num_plan) ->
- NewNumPlan = Action#gtt_act_repl_num_plan.numbering_plan,
- Gt#global_title{numbering_plan = NewNumPlan}.
+gtt_action(Gt, #gtt_act_repl_num_plan{numbering_plan = NewNumPlan}) when is_record(Gt, global_title) ->
+ Gt#global_title{numbering_plan = NewNumPlan};
+
+% Execute a single 'generic purpose' action that will call apply/2
+gtt_action(Gt, #gtt_act_apply{funct = Funct, args = Args}) when is_record(Gt, global_title) ->
+ apply(Funct, Args).
+
% appliy a list of GTT actions to a Global Title
apply_gtt_actions(Gt, []) when is_record(Gt, global_title) ->