| 1 |
QOS Module |
| 2 |
|
| 3 |
Ovidiu Sas |
| 4 |
|
| 5 |
SOMA Networks, Inc. |
| 6 |
|
| 7 |
Edited by |
| 8 |
|
| 9 |
Ovidiu Sas |
| 10 |
|
| 11 |
Copyright © 2008 SOMA Networks, Inc. |
| 12 |
__________________________________________________________________ |
| 13 |
|
| 14 |
Table of Contents |
| 15 |
|
| 16 |
1. Admin Guide |
| 17 |
|
| 18 |
1. Overview |
| 19 |
2. How it works |
| 20 |
3. Dependencies |
| 21 |
|
| 22 |
3.1. Kamailio Modules |
| 23 |
3.2. External Libraries or Applications |
| 24 |
|
| 25 |
4. Parameters |
| 26 |
|
| 27 |
4.1. qos_flag (integer) |
| 28 |
|
| 29 |
5. Functions |
| 30 |
6. Statistics |
| 31 |
7. Exported pseudo-variables |
| 32 |
8. Installation and Running |
| 33 |
|
| 34 |
2. Developer Guide |
| 35 |
|
| 36 |
1. Available Functions |
| 37 |
|
| 38 |
1.1. register_qoscb (qos, type, cb, param) |
| 39 |
|
| 40 |
List of Examples |
| 41 |
|
| 42 |
1.1. Set qos_flag parameter |
| 43 |
|
| 44 |
Chapter 1. Admin Guide |
| 45 |
|
| 46 |
Table of Contents |
| 47 |
|
| 48 |
1. Overview |
| 49 |
2. How it works |
| 50 |
3. Dependencies |
| 51 |
|
| 52 |
3.1. Kamailio Modules |
| 53 |
3.2. External Libraries or Applications |
| 54 |
|
| 55 |
4. Parameters |
| 56 |
|
| 57 |
4.1. qos_flag (integer) |
| 58 |
|
| 59 |
5. Functions |
| 60 |
6. Statistics |
| 61 |
7. Exported pseudo-variables |
| 62 |
8. Installation and Running |
| 63 |
|
| 64 |
1. Overview |
| 65 |
|
| 66 |
The qos module provides a way to keep track of per dialog SDP |
| 67 |
session(s). |
| 68 |
|
| 69 |
2. How it works |
| 70 |
|
| 71 |
The qos module uses the dialog module to be notified of any new or |
| 72 |
updated dialogs. It will then look for and extract the SDP session (if |
| 73 |
present) from SIP requests and replies and keep track of it for the |
| 74 |
entire life of a dialog. |
| 75 |
|
| 76 |
All of this happens with a properly configured dialog and qos module. |
| 77 |
You need to call the dlg_manage() function and set the qos flag at the |
| 78 |
time any INVITE sip message is seen. See the “dialog module” users |
| 79 |
guide for information. |
| 80 |
|
| 81 |
A dialog can have one or more SDP sessions active in one of the |
| 82 |
following states: |
| 83 |
* pending - only one endpoint of the SDP session is known. |
| 84 |
* negotiated - both endpoints of the SDP session are known. |
| 85 |
|
| 86 |
An SDP session can be established in one of the following scenarios: |
| 87 |
* INVITE/200ok - typical "INVITE" and "200 OK" SDP exchange. |
| 88 |
* 200ok/ACK - "200 OK" and "ACK" SDP exchange (for calls starting |
| 89 |
with an empty INVITE). |
| 90 |
* 183/PRACK - early media via "183 Session Progress" and "PRACK" (see |
| 91 |
RFC 3959 for more information) - not implemented yet. |
| 92 |
|
| 93 |
3. Dependencies |
| 94 |
|
| 95 |
3.1. Kamailio Modules |
| 96 |
3.2. External Libraries or Applications |
| 97 |
|
| 98 |
3.1. Kamailio Modules |
| 99 |
|
| 100 |
The following modules must be loaded before this module: |
| 101 |
* dialog - dialog module and its dependencies (tm). |
| 102 |
|
| 103 |
3.2. External Libraries or Applications |
| 104 |
|
| 105 |
The following libraries or applications must be installed before |
| 106 |
running Kamailio with this module loaded: |
| 107 |
* None. |
| 108 |
|
| 109 |
4. Parameters |
| 110 |
|
| 111 |
4.1. qos_flag (integer) |
| 112 |
|
| 113 |
4.1. qos_flag (integer) |
| 114 |
|
| 115 |
The module will not do anything to any message unless instructed to do |
| 116 |
so via the config script. You must set the qos_flag value in the |
| 117 |
setflag() call of the INVITE you want the qos module to process. But |
| 118 |
before you can do that, you need to tell the qos module which flag |
| 119 |
value you are assigning to qos. |
| 120 |
|
| 121 |
In most cases when ever you call dlg_manage() function you will want to |
| 122 |
set the qos flag. If the dialog is not tracked and the qos flag is set, |
| 123 |
it will not have any effect. |
| 124 |
|
| 125 |
This parameter must be set or the module will not load. |
| 126 |
|
| 127 |
Default value is “Not set!”. |
| 128 |
|
| 129 |
Example 1.1. Set qos_flag parameter |
| 130 |
... |
| 131 |
modparam("qos", "qos_flag", 7) |
| 132 |
... |
| 133 |
route { |
| 134 |
... |
| 135 |
if (method=="INVITE") { |
| 136 |
dlg_manage(); # Track the dialog |
| 137 |
setflag(7); # Set the qos flag |
| 138 |
} |
| 139 |
... |
| 140 |
} |
| 141 |
|
| 142 |
5. Functions |
| 143 |
|
| 144 |
There are no exported functions that could be used in scripts. |
| 145 |
|
| 146 |
6. Statistics |
| 147 |
|
| 148 |
There are no exported statistics for the qos module. |
| 149 |
|
| 150 |
7. Exported pseudo-variables |
| 151 |
|
| 152 |
There are no exported pseudo-variables for the qos module. |
| 153 |
|
| 154 |
8. Installation and Running |
| 155 |
|
| 156 |
Just load the module and remember to set the flag. |
| 157 |
|
| 158 |
Chapter 2. Developer Guide |
| 159 |
|
| 160 |
Table of Contents |
| 161 |
|
| 162 |
1. Available Functions |
| 163 |
|
| 164 |
1.1. register_qoscb (qos, type, cb, param) |
| 165 |
|
| 166 |
1. Available Functions |
| 167 |
|
| 168 |
1.1. register_qoscb (qos, type, cb, param) |
| 169 |
|
| 170 |
1.1. register_qoscb (qos, type, cb, param) |
| 171 |
|
| 172 |
Register a new callback to the qos. |
| 173 |
|
| 174 |
Meaning of the parameters is as follows: |
| 175 |
* struct qos_ctx_st* qos - qos to register callback to. It may be |
| 176 |
NULL only for QOSCB_CREATED callback type, which is not a per qos |
| 177 |
type. |
| 178 |
* int type - types of callbacks; more types may be registered for the |
| 179 |
same callback function; only QOSCB_CREATED must be registered |
| 180 |
alone. Possible types: |
| 181 |
+ QOSCB_CREATED - called when a new qos context is created - |
| 182 |
it's a global type (not associated to any qos). |
| 183 |
+ QOSCB_ADD_SDP - called when a new SDP was added to the qos |
| 184 |
context - it's a per qos type. |
| 185 |
+ QOSCB_UPDATE_SDP - called when an existing SDP is updated - |
| 186 |
it's a per qos type. |
| 187 |
+ QOSCB_REMOVE_SDP - called when an existing SDP is removed - |
| 188 |
it's a per qos type. |
| 189 |
+ QOSCB_TERMINATED - called when the qos is terminated. |
| 190 |
* qos_cb cb - callback function to be called. Prototype is: “void |
| 191 |
(qos_cb) (struct qos_ctx_st *qos, int type, struct qos_cb_params |
| 192 |
*params); ” |
| 193 |
* void *param - parameter to be passed to the callback function. |