Hi, Jan!
I am glad you are interested in developing a small feature in OpenSIPS,
but you should have opened this discussion on the devel list[1].
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
other places.
If you need any more help, please send a mail on the devel list.
[1] de...@lists.opensips.org
Regards,
--
Ra(zvan Crainea
OpenSIPS Developer
http://www.opensips-solutions.com
On 02/09/2012 12:26 AM, Jan Blom wrote:
Hello,
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:
rtpproxy_offer("wz$avp(s:mode)");
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.
Thanks!
Best regards,
Jan Blom
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users