[OpenSIPS-Users] Allow scripting variables in call to rtpproxy_offer/answer?
razvancrainea at opensips.org
Thu Feb 9 10:07:25 CET 2012
I am glad you are interested in developing a small feature in OpenSIPS,
but you should have opened this discussion on the devel list.
Your assumption is right, the rtpproxy_offer/answer functions don't
accept variables as arguments.
In order to change that, you will have to modify the
rtpproxy_offer/answer functions interface. Each module has to declare a
"static cmd_export_t" structure, that contains information about the
functions the module exports. For nathelper, this structure is declared
in "modules/nathelper/nathelper.c", line ~430. Each function contains
the name used in the script, the equivalent C function that handles the
processing, the number of parameters it can take, a fixup function, plus
some other information. This fixup function is the one that parses the
string ("wz$avp(s:mode)" in your case), and builds a structure that can
be evaluated when the function is called.
If you need an example of how this is done, you can take a look at the
registrar module. You can find the export structure in
"modules/registrar/reg_mod.c", line ~138. "save" and "lookup" are two
functions that accept variables in the second argument (take a look at
the "registrar_fixup" C function, that parses the 3 parameters). This
approach is also used in textops module for the "add_body" function, or
"append_hf", "insert_hf", in the exec module for all the functions and
If you need any more help, please send a mail on the devel list.
 devel at lists.opensips.org
On 02/09/2012 12:26 AM, Jan Blom wrote:
> I am using OpenSIPS 1.6.4-2 and rtpproxy 1.2.1. I was trying to use an
> avp as part of the argument to Nathelper's rtpproxy_offer() and
> rtpproxy_answer() functions. Like:
> This doesn't work and results in the following log line:
> ERROR:nathelper:force_rtp_proxy_body: unknown option `$'
> I guess these functions are not prepared to handle variables as
> arguments. I would like to fix this in the source, but would
> appreciate some pointers on what to actually change. I guess there are
> number of similar places that does this right.
> Best regards,
> Jan Blom
> Users mailing list
> Users at lists.opensips.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users