[Users] Exec module: Use output of an external command within SER?

Joachim Fabini Joachim.Fabini at tuwien.ac.at
Thu Oct 6 11:29:42 CEST 2005


Hi,

A newbie question:
Is there a way for OpenSER to use SIP headers (other than the URI 
set) that have been modified/processed by an external command 
(exec_dst, exec_msg)?
Reading the documentation and mailing list archives revealed some
questions similar to mine but no answer.

The problem is: Delegate the change of one or more SIP message 
headers (or the whole SIP message) to an external application via 
exec module. 

Two straight-forward solutions:
1. exec_rmsg() - for "replace message". A merge of the functionality 
   of exec_dst() and exec_msg(), i.e. OpenSER uses the output of 
   exec_rmsg(command) to replace the current SIP message. This is 
   imho an extremly flexible solution but slightly difficult to 
   implement as it requires at least parsing the command's output 
   - similar to a message received by OpenSER.
   
2. The command executed by exec_msg() can modify the environment
   variables SIP_HF_<hf_name> and OpenSER reuses these values after
   the exec() returned control to SER.
   Setvars could be used to switch between the current, read-only
   meaning of env-variables (e.g., modparam("exec", "setvars", 1)) 
   and a read-write behavior (e.g. modparam("exec", "setvars", 2).

   This solution does not require any special handling except that
   OpenSER must read back the content of all environment variables
   which were passed to the command. Probably quite easy to implement 
   but has the drawback that no new header fields can be added. 
   Imho no major limitation as users can add their (dummy) header
   fields prior to invoking the command via exec()
   
Or is there any other existing/planned procedure for SER to use the 
output of external commands for rewriting an existing SIP message.

tia
best regards
--Joachim





More information about the sr-users mailing list