Browse code

sbc:call control doc reference for registrar module

Stefan Sayer authored on 14/02/2014 17:02:58
Showing 1 changed files
... ...
@@ -53,10 +53,10 @@ Several CC modules are implemented
53 53
   o cc_ctl            - control SBC profile options through headers
54 54
   o cc_rest           - query REST/http API and use response for retargeting etc
55 55
   o cc_syslog_cdr     - write CDRs to syslog
56
-  o cc_bl_redis        - check blacklist from REDIS (redis.io)
57
-
58
-See their respective documentation for details.
59
-
56
+  o cc_bl_redis       - check blacklist from REDIS (redis.io)
57
+  o cc_registrar      - local registrar (REGISTER handling, lookup on INVITEs) 
58
+  
59
+See their respective documentation in the doc/sbc/ directory for details.
60 60
 
61 61
 Developer documentation 
62 62
 =======================
... ...
@@ -65,6 +65,7 @@ The functions of CC modules are invoked
65 65
  - at the beginning of a call: "start" function
66 66
  - when the call is connected: "connect" function
67 67
  - when the call is ended: "end" function
68
+ - when an out-of-dialog request should be routed: "route" function
68 69
 
69 70
 In the start function, CC modules can
70 71
  - modify values in the used call profile instance (RURI, From, To etc)
Browse code

doc:sbc:call control: moved cc docs to doc/ dir

Stefan Sayer authored on 14/02/2014 15:59:12
Showing 1 changed files
... ...
@@ -50,6 +50,10 @@ Several CC modules are implemented
50 50
   o cc_call_timer     - call timer (maximum call duration)
51 51
   o cc_prepaid        - prepaid billing with storing balances in memory
52 52
   o cc_prepaid_xmlrpc - prepaid billing querying balances from external server with XMLRPC
53
+  o cc_ctl            - control SBC profile options through headers
54
+  o cc_rest           - query REST/http API and use response for retargeting etc
55
+  o cc_syslog_cdr     - write CDRs to syslog
56
+  o cc_bl_redis        - check blacklist from REDIS (redis.io)
53 57
 
54 58
 See their respective documentation for details.
55 59
 
Browse code

sbc:cc: some documentation on header based cc

Stefan Sayer authored on 04/10/2011 14:00:02
Showing 1 changed files
... ...
@@ -30,6 +30,21 @@ substitution patterns, e.g.:
30 30
 will pass the contents of the Header named "P-UUID" as value "uuid" and the contents of "P-Call-Limit"
31 31
 as "max_calls".
32 32
 
33
+Alternatively, call control can also be set through message parts by using replacement patterns.
34
+Example:
35
+   call_control=cc_pcalls,$H(P-Call-Control)
36
+
37
+The header 'P-Call-Control' is a comma separated list of call control configurations, with key,value pairs
38
+appended, i.e. of the form module_name;param=val;param=val. 
39
+Example: 
40
+  P-Call-Control: cc_prepaid;uuid=joe, cc_pcalls;uuid=joe;max_calls=10
41
+
42
+As usual with multi-value headers, several separate headers may be used, so the above example is
43
+equivalent to:
44
+  P-Call-Control: cc_prepaid;uuid=joe
45
+  P-Call-Control: cc_pcalls;uuid=joe;max_calls=10
46
+
47
+
33 48
 Several CC modules are implemented
34 49
   o cc_pcalls         - parallel calls limiting
35 50
   o cc_call_timer     - call timer (maximum call duration)
... ...
@@ -141,7 +156,7 @@ Synopsis:
141 156
     call_profile->cc_vars.erase("mycc::myvar");
142 157
 
143 158
 If several invocations of the same call control module should be independent from each other,
144
-CC variables may be prefixed by the CC namespace
159
+CC variables should be prefixed by the CC namespace
145 160
 (e.g. args[CC_API_PARAMS_CC_NAMESPACE + "::" + var_name).
146 161
 
147 162
 
Browse code

sbc:cc: passing config namespace to call control module

this allows several independent invocations of the same call control
as it can separate its call variables by the config namespace

Stefan Sayer authored on 03/10/2011 20:02:00
Showing 1 changed files
... ...
@@ -64,7 +64,9 @@ The CC modules must implement a DI API, which must implement at least the functi
64 64
 
65 65
 
66 66
   function: start
67
-  Parameters: string                  ltag             local tag (ID) of the call (A leg)
67
+  Parameters: string                  cc_namespace     name of call control section
68
+                                                       (as configured, e.g. variable namespace to use)
69
+              string                  ltag             local tag (ID) of the call (A leg)
68 70
               SBCCallProfile Object   call_profile     used call profile instance
69 71
               Array of int            timestamps       start/connect/end timestamp
70 72
               ValueStruct             values           configured values
... ...
@@ -90,14 +92,18 @@ The CC modules must implement a DI API, which must implement at least the functi
90 92
                   Parameters: int    timeout
91 93
 
92 94
   function: connect
93
-  Parameters: string                  ltag             local tag (ID) of the call (A leg)
95
+  Parameters: string                  cc_namespace     name of call control section
96
+                                                       (as configured, e.g. variable namespace to use)
97
+              string                  ltag             local tag (ID) of the call (A leg)
94 98
               SBCCallProfile Object   call_profile     used call profile instance
95 99
               Array of int            timestamps       start/connect/end timestamp
96 100
               string                  other ltag       local tag (ID) of B leg
97 101
 
98 102
 
99 103
   function: end
100
-  Parameters: string                  ltag             local tag (ID) of the call (A leg)
104
+  Parameters: string                  cc_namespace     name of call control section
105
+                                                       (as configured, e.g. variable namespace to use)
106
+              string                  ltag             local tag (ID) of the call (A leg)
101 107
               SBCCallProfile Object   call_profile     used call profile instance
102 108
               Array of int            timestamps       start/connect/end timestamp
103 109
 
... ...
@@ -134,7 +140,9 @@ Synopsis:
134 140
   removing a variable:
135 141
     call_profile->cc_vars.erase("mycc::myvar");
136 142
 
137
-CC variables may be prefixed by the CC module name as name space (e.g. cc_name::var_name).
143
+If several invocations of the same call control module should be independent from each other,
144
+CC variables may be prefixed by the CC namespace
145
+(e.g. args[CC_API_PARAMS_CC_NAMESPACE + "::" + var_name).
138 146
 
139 147
 
140 148
 Verifying correct configuration
Browse code

sbc: cc: modified API to have all timestamps in all functions

Stefan Sayer authored on 29/09/2011 12:22:30
Showing 1 changed files
... ...
@@ -62,13 +62,15 @@ If the call profile is to be modified, SBCCallProfile.h should be included.
62 62
 The CC modules must implement a DI API, which must implement at least the functions "start",
63 63
 "connect", "end".
64 64
 
65
+
65 66
   function: start
66 67
   Parameters: string                  ltag             local tag (ID) of the call (A leg)
67 68
               SBCCallProfile Object   call_profile     used call profile instance
68
-              int                     start_ts_sec     start TS (seconds since epoch)
69
-              int                     start_ts_usec    start TS usec
70
-              ValueStruct             values           configured values (struct of key:string value)
71
-              int                     timer_id         ID of first timer if set with timer action
69
+              Array of int            timestamps       start/connect/end timestamp
70
+              ValueStruct             values           configured values
71
+                                                       (struct of key:string value)
72
+              int                     timer_id         ID of first timer if set with timer
73
+                                                       action
72 74
    
73 75
   Return values
74 76
               Array of actions:
... ...
@@ -83,8 +85,32 @@ The CC modules must implement a DI API, which must implement at least the functi
83 85
                   Parameters: int    code
84 86
                               string reason
85 87
 
86
-               SBC_CC_SET_CALL_TIMER_ACTION             set a timer; the id of the first timer will be timer_id
88
+               SBC_CC_SET_CALL_TIMER_ACTION             set a timer; the id of the first
89
+                                                        timer will be timer_id
87 90
                   Parameters: int    timeout
91
+
92
+  function: connect
93
+  Parameters: string                  ltag             local tag (ID) of the call (A leg)
94
+              SBCCallProfile Object   call_profile     used call profile instance
95
+              Array of int            timestamps       start/connect/end timestamp
96
+              string                  other ltag       local tag (ID) of B leg
97
+
98
+
99
+  function: end
100
+  Parameters: string                  ltag             local tag (ID) of the call (A leg)
101
+              SBCCallProfile Object   call_profile     used call profile instance
102
+              Array of int            timestamps       start/connect/end timestamp
103
+
104
+
105
+  timestamps Array of int
106
+  -----------------------
107
+       0           CC_API_TS_START_SEC                start TS sec (seconds since epoch)
108
+       1           CC_API_TS_START_USEC               start TS usec
109
+       2           CC_API_TS_CONNECT_SEC              connect TS sec (seconds since epoch)
110
+       3           CC_API_TS_CONNECT_USEC             connect TS usec
111
+       4           CC_API_TS_END_SEC                  end TS sec (seconds since epoch)
112
+       5           CC_API_TS_END_USEC                 end TS usec
113
+
88 114
  
89 115
 Storing call related information
90 116
 --------------------------------
Browse code

sbc: some documentation about call_control modules

Stefan Sayer authored on 27/09/2011 16:28:15
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,126 @@
1
+SBC call control modules
2
+========================
3
+
4
+General
5
+=======
6
+
7
+Call control (CC) modules for the sbc application implement business logic which controls
8
+how the SBC operates. For example, a CCmodule can implement concurrent call limits, call
9
+limits per user, enforce other policies, or implement routing logic.
10
+
11
+Multiple CC modules may be applied for one call. The data that the CC modules get from the
12
+call may be freely configured.
13
+
14
+User documentation 
15
+==================
16
+
17
+Call control modules may be applied to a call by specifying call_control=... in the SBC profile.
18
+
19
+For each item in call_control, the specific information is then read; for example, if
20
+ call_control=cc_pcalls,cc_timer
21
+is configured, "cc_pcalls" and "cc_timer" sections are read.
22
+
23
+Each CC module section must at least specify the CC interface name (usually the module name), e.g.:
24
+ cc_pcalls_module=cc_pcalls
25
+
26
+Additionally, the data that is passed to the CC module is specified, this can contain the usual
27
+substitution patterns, e.g.:
28
+ cc_pcalls_uuid=$H(P-UUID)
29
+ cc_pcalls_max_calls=$H(P-Call-Limit)
30
+will pass the contents of the Header named "P-UUID" as value "uuid" and the contents of "P-Call-Limit"
31
+as "max_calls".
32
+
33
+Several CC modules are implemented
34
+  o cc_pcalls         - parallel calls limiting
35
+  o cc_call_timer     - call timer (maximum call duration)
36
+  o cc_prepaid        - prepaid billing with storing balances in memory
37
+  o cc_prepaid_xmlrpc - prepaid billing querying balances from external server with XMLRPC
38
+
39
+See their respective documentation for details.
40
+
41
+
42
+Developer documentation 
43
+=======================
44
+
45
+The functions of CC modules are invoked
46
+ - at the beginning of a call: "start" function
47
+ - when the call is connected: "connect" function
48
+ - when the call is ended: "end" function
49
+
50
+In the start function, CC modules can
51
+ - modify values in the used call profile instance (RURI, From, To etc)
52
+ - set timers
53
+ - drop the call
54
+ - refuse the call with a code and reason
55
+
56
+SBC CC API
57
+----------
58
+
59
+ampi/SBCCallControlAPI.h should be included, which defines necessary constants.
60
+If the call profile is to be modified, SBCCallProfile.h should be included.
61
+
62
+The CC modules must implement a DI API, which must implement at least the functions "start",
63
+"connect", "end".
64
+
65
+  function: start
66
+  Parameters: string                  ltag             local tag (ID) of the call (A leg)
67
+              SBCCallProfile Object   call_profile     used call profile instance
68
+              int                     start_ts_sec     start TS (seconds since epoch)
69
+              int                     start_ts_usec    start TS usec
70
+              ValueStruct             values           configured values (struct of key:string value)
71
+              int                     timer_id         ID of first timer if set with timer action
72
+   
73
+  Return values
74
+              Array of actions:
75
+                  int                 action           action to take
76
+                  ...                 parameters       parameters to action
77
+ 
78
+      Actions
79
+               SBC_CC_DROP_ACTION                       drop the call (no reply sent)
80
+                  Parameters: none
81
+
82
+               SBC_CC_REFUSE_ACTION                     refuse the call with code and reason
83
+                  Parameters: int    code
84
+                              string reason
85
+
86
+               SBC_CC_SET_CALL_TIMER_ACTION             set a timer; the id of the first timer will be timer_id
87
+                  Parameters: int    timeout
88
+ 
89
+Storing call related information
90
+--------------------------------
91
+
92
+The SBC call profile object contains named general purpose variables of variant type (AmArg) for
93
+general purpose CC module use.
94
+
95
+Synopsis:
96
+
97
+  setting a variable:
98
+    call_profile->cc_vars["mycc::myvar"] = "myvalue";
99
+
100
+  checking for presence of a variable:
101
+    SBCVarMapIteratorT vars_it = call_profile->cc_vars.find("mycc::myvar");
102
+    if (vars_it == call_profile->cc_vars.end() || !isArgCStr(vars_it->second)) {
103
+      ERROR("internal: could not find mycc:myvar for call '%s'\n", ltag.c_str());
104
+      return;
105
+    }
106
+    string myvar = vars_it->second.asCStr();
107
+
108
+  removing a variable:
109
+    call_profile->cc_vars.erase("mycc::myvar");
110
+
111
+CC variables may be prefixed by the CC module name as name space (e.g. cc_name::var_name).
112
+
113
+
114
+Verifying correct configuration
115
+-------------------------------
116
+A DI function "getMandatoryValues" (CC_INTERFACE_MAND_VALUES_METHOD) can be implemented.
117
+
118
+This function should return a list of strings, which will be checked with the sbc profile. If
119
+there are configuration values missing in the sbc profile, the profile is not loaded.
120
+
121
+Sample CC module
122
+----------------
123
+
124
+A sample CC module "cc_template" can be found in apps/sbc/call_control/template. For implementing
125
+a new call control module, this code should be taken, the class names changed and the code customized
126
+it.