@@ -154,19 +154,21 @@ the script.
154154
155155
156156To trigger the internal publishing (from the dialog module) for a
157- certain call, use the "sca_set_called_line()" function from the
158- script when handling a new call. This function will do all the work
159- (creating dialog, setting the internal publishing, etc) - you just
160- need to use it and eventually specify the name of the line (if other
161- then the one from the SIP INVITE) - see the below documentation.
157+ certain call, use the "sca_engage()" function from the script when
158+ handling the initial INVITE. It creates the dialog and publishes the
159+ state of the caller's line, of the callee's line, or of both. For
160+ outbound calls, "sca_validate_invite_out()" checks that the caller
161+ has seized its line first. Per branch, "sca_set_called_line()" changes
162+ the callee's line and "sca_mute_branch()" stops publishing it - see
163+ the below documentation.
162164
163165
164166LIMITATIONS : in this mode, the module does not really check if the
165167line exists or not (like defined) - it blindly trust the traffic;
166168also there is no check on how many indexes are for each line. Such
167- information (lines and indexes) are not provisioned into the module,
168- but the module will dynamically accept and handle any line and index
169- based on the SIP traffic .
169+ information (lines and indexes) are not provisioned into the module:
170+ a line becomes known with the first " line-seize" SUBSCRIBE for it,
171+ and no "call-info" is published for a line that is not known .
170172
171173
172174### Dependencies
@@ -266,35 +268,177 @@ modparam("presence_callinfo", "line_hash_size", 128)
266268```
267269
268270
271+ #### caller_spec_param (string)
272+
273+
274+ A variable holding the caller's line, as a SIP URI. When the variable
275+ is set, "sca_engage()" and "sca_validate_invite_out()" use it instead of
276+ the From URI of the INVITE.
277+
278+
279+ * Default value is "NULL"* (the From URI is used).
280+
281+
282+ ``` opensips title="Set caller_spec_param parameter"
283+ ...
284+ modparam("presence_callinfo", "caller_spec_param", "$var(sca_caller)")
285+ ...
286+
287+ ```
288+
289+
290+ #### callee_spec_param (string)
291+
292+
293+ A variable holding the callee's line, as a SIP URI. When the variable
294+ is set, "sca_engage()" uses it instead of the R-URI of the INVITE.
295+
296+
297+ * Default value is "NULL"* (the R-URI is used).
298+
299+
300+ ``` opensips title="Set callee_spec_param parameter"
301+ ...
302+ modparam("presence_callinfo", "callee_spec_param", "$var(sca_callee)")
303+ ...
304+
305+ ```
306+
307+
308+ #### log_level (int)
309+
310+
311+ The log level of the module's SCA trace messages. It can be changed at
312+ runtime with the * presence_callinfo: set_log_level * MI command.
313+
314+
315+ * Default value is "-3"* (L_ALERT - always printed).
316+
317+
318+ ``` opensips title="Set log_level parameter"
319+ ...
320+ modparam("presence_callinfo", "log_level", 4)
321+ ...
322+
323+ ```
324+
325+
269326### Exported Functions
270327
271328
272- #### sca_set_called_line([ line] )
329+ #### sca_validate_invite_out()
330+
273331
332+ The function (to be used only in internal publishing mode) checks an
333+ outbound call from a shared line: the INVITE must carry a Call-Info
334+ header with an "appearance-index", and the caller's line (the From URI,
335+ or "caller_spec_param") must be seized for that index.
274336
275- The function (to be used only in internal publishing mode) is setting
276- for the current new call (initinal INVITE) the inbound line - the line
277- the call was received on.
278337
338+ It returns 1 if the call is valid, otherwise:
279339
280- If no parameter is provided, the name of the line is taken from the
281- SIP RURI of the INVITE. You can override that by providing
282- the name of the line as a string parameter - be careful as the value must be
283- a SIP URI ! Variables are accepted.
340+
341+ - * -2* - the line is not known to the module;
342+ - * -3* - the line is not seized;
343+ - * -4* - the line is seized for a different index;
344+ - * -5* - missing or bogus Call-Info header;
345+ - * -6* - no index in the Call-Info header.
284346
285347
286348This function can be used from REQUEST_ROUTE.
287349
288350
289- ``` opensips title="sca_set_called_line() usage"
351+ ``` opensips title="sca_validate_invite_out() usage"
352+ ...
353+ if (is_method("INVITE") and !has_totag()) {
354+ if (!sca_validate_invite_out()) {
355+ send_reply(403, "Line Not Seized");
356+ exit;
357+ }
358+ }
359+ ...
360+ ```
361+
362+
363+ #### sca_engage([ parties] )
364+
365+
366+ The function (to be used only in internal publishing mode) enables the
367+ internal publishing for the current new call (initial INVITE). It
368+ creates the dialog, if there is none yet, and publishes the state of
369+ the call on the lines given by * parties* :
370+
371+
372+ - * A* - the caller's line: the From URI, or "caller_spec_param";
373+ - * B* - the callee's line: the R-URI, or "callee_spec_param", or the
374+ line set for the branch by "sca_set_called_line()".
375+
376+
377+ If the parameter is missing, both lines are published. With * A* , the
378+ call is first checked as by "sca_validate_invite_out()", and its error
379+ code is returned if the check fails.
380+
381+
382+ This function can be used from REQUEST_ROUTE.
383+
384+
385+ ``` opensips title="sca_engage() usage"
290386...
291387 if (is_method("INVITE") and !has_totag()) {
292- sca_set_called_line();
388+ # a call to a shared line - publish the callee's line only
389+ sca_engage("B");
293390 }
294391...
295392```
296393
297394
395+ #### sca_set_called_line(line)
396+
397+
398+ The function (to be used only in internal publishing mode) sets the
399+ callee's line for the current branch, overriding the R-URI. The value
400+ must be a SIP URI ! Variables are accepted. An empty string drops a
401+ line set before for the branch.
402+
403+
404+ The dialog must already exist, so call "sca_engage()" first.
405+
406+
407+ This function can be used from REQUEST_ROUTE and BRANCH_ROUTE.
408+
409+
410+ ``` opensips title="sca_set_called_line() usage"
411+ ...
412+ branch_route[sca] {
413+ sca_set_called_line("sip:line@example.com");
414+ }
415+ ...
416+ ```
417+
418+
419+ #### sca_mute_branch(parties)
420+
421+
422+ The function (to be used only in internal publishing mode) stops the
423+ publishing for the callee's line on the current branch. Only * B* has
424+ an effect; * A* is accepted, but the caller's line is still published.
425+
426+
427+ The dialog must already exist, so call "sca_engage()" first.
428+
429+
430+ This function can be used from BRANCH_ROUTE.
431+
432+
433+ ``` opensips title="sca_mute_branch() usage"
434+ ...
435+ branch_route[sca] {
436+ sca_mute_branch("B");
437+ }
438+ ...
439+ ```
440+
441+
298442### Exported MI Functions
299443
300444
0 commit comments