[sr-dev] [tracker] Task opened: siputils module. Adding the function: get_uri_param (Attachment added)
sip-router
bugtracker at sip-router.org
Mon Jun 25 15:23:58 CEST 2012
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Luis Martin (lmartin)
Attached to Project - sip-router
Summary - siputils module. Adding the function: get_uri_param
Task Type - Improvement
Category - tools/scripts
Status - Unconfirmed
Assigned To -
Operating System - All
Severity - Low
Priority - Normal
Reported Version - 3.3
Due in Version - Undecided
Due Date - Undecided
Details - This patch affects the 'siputils' module.
http://kamailio.org/docs/modules/stable/modules_k/siputils.html
This patch affects to the files:
kamailio/modules_k/siputils/siputils.c
kamailio/modules_k/siputils/checks.c
kamailio/modules_k/siputils/checks.h
Among the functions that 'siputils' provides, we have:
4.5. uri_param(param)
http://kamailio.org/docs/modules/stable/modules_k/siputils.html#id2531859
4.6. uri_param(param,value)
http://kamailio.org/docs/modules/stable/modules_k/siputils.html#id2539159
4.7. add_uri_param(param)
http://kamailio.org/docs/modules/stable/modules_k/siputils.html#id2534537
What if I want the value back from a given "param" within the URI? This is what this patch does. It adds a function called 'get_uri_param':
get_uri_param(struct sip_msg* _msg, char* _param, char* _value)
Returns > 0 if _param if found and _value will have its associated value.
Returns < 0 if _param is not found.
Example (kamailio.cfg):
loadmodule "siputils.so"
(...)
$var(value) = "";
if(get_uri_param("grp","$var(value)")) {
xlog("L_INFO", "-----------------------------\n");
xlog("L_INFO", "This gives you the value of grp!\n");
xlog("L_INFO", "grp detected: \"$var(value)\"\n");
xlog("L_INFO", "-----------------------------\n");
} else {
xlog("L_INFO", "no grp detected\n" );
}
If the URI is like:
sip:1234 at 192.168.20.10;option=test2;grp=test
The code below will output:
'This gives you the value of grp!'
'grp detected: "test"'
Hope it helps,
Luis Martin Gil
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=238
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
More information about the sr-dev
mailing list