Module: sip-router
Branch: master
Commit: c4669d846cd3b8f543e86ac5cc6820b7400dd5fa
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c4669d8…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Sun Mar 15 17:31:45 2009 +0100
Kamailio compatiblity: Function get_diversion_param
---
parser/parse_diversion.c | 26 ++++++++++++++++++++++++++
parser/parse_diversion.h | 5 +++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/parser/parse_diversion.c b/parser/parse_diversion.c
index 63b80b0..7c694d4 100644
--- a/parser/parse_diversion.c
+++ b/parser/parse_diversion.c
@@ -76,3 +76,29 @@ int parse_diversion_header(struct sip_msg *msg)
error:
return -1;
}
+
+
+/**
+ * Get the value of a given diversion parameter
+ */
+str *get_diversion_param(struct sip_msg *msg, str* name)
+{
+ struct to_param *params;
+
+ if (parse_diversion_header(msg) < 0) {
+ ERR("could not get diversion parameter\n");
+ return 0;
+ }
+
+ params = ((struct to_body*)(msg->diversion->parsed))->param_lst;
+
+ while (params) {
+ if ((params->name.len == name->len) &&
+ (strncmp(params->name.s, name->s, name->len) == 0)) {
+ return ¶ms->value;
+ }
+ params = params->next;
+ }
+
+ return 0;
+}
diff --git a/parser/parse_diversion.h b/parser/parse_diversion.h
index 774a823..dec9fef 100644
--- a/parser/parse_diversion.h
+++ b/parser/parse_diversion.h
@@ -40,4 +40,9 @@
*/
int parse_diversion_header(struct sip_msg *msg);
+/**
+ * Get the value of a given diversion parameter
+ */
+str *get_diversion_param(struct sip_msg *msg, str* name);
+
#endif /* PARSE_DIVERSION_H */