Module: sip-router
Branch: carstenbock/ims DELETED
Commit: a80729125de45d2e147a970315c08df378626f64
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a807291…
Author: Carsten Bock <carsten(a)bock.info>
Committer: Carsten Bock <carsten(a)bock.info>
Date: Mon May 9 13:55:16 2011 +0200
- extended the API of Record-Route in order to retrieve the routeset and the remote URI (needed for later validation/enforcement of route-sets in requests)
---
modules_k/rr/api.c | 3 +
modules_k/rr/api.h | 10 ++++
modules_k/rr/loose.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++-
modules_k/rr/loose.h | 19 ++++++++
4 files changed, 151 insertions(+), 1 deletions(-)
diff --git a/modules_k/rr/api.c b/modules_k/rr/api.c
index 55af538..0835b72 100644
--- a/modules_k/rr/api.c
+++ b/modules_k/rr/api.c
@@ -64,6 +64,9 @@ int load_rr( struct rr_binds *rrb )
rrb->get_route_param = get_route_param;
rrb->register_rrcb = register_rrcb;
rrb->append_fromtag = append_fromtag;
+ rrb->get_remoteuri = get_remoteuri;
+ rrb->get_routeset = get_routeset;
+ rrb->rr_type = rr_type;
return 1;
}
diff --git a/modules_k/rr/api.h b/modules_k/rr/api.h
index 09c9a4e..91da2ea 100644
--- a/modules_k/rr/api.h
+++ b/modules_k/rr/api.h
@@ -46,12 +46,19 @@
#include "loose.h"
#include "rr_cb.h"
+#define RR_TYPE_STRICT_LOOSE (1<<1)
+#define RR_TYPE_STRICT_STRICT (1<<2)
+#define RR_TYPE_LOOSE_LOOSE (1<<3)
+#define RR_TYPE_LOOSE_STRICT (1<<4)
+
typedef int (*add_rr_param_t)(struct sip_msg*, str*);
typedef int (*check_route_param_t)(struct sip_msg*, regex_t*);
typedef int (*is_direction_t)(struct sip_msg*, int);
typedef int (*get_route_param_t)(struct sip_msg*, str*, str*);
typedef int (*record_route_f)(struct sip_msg*, str*);
typedef int (*loose_route_f)(struct sip_msg*);
+typedef str* (*get_remoteuri_t)(struct sip_msg*);
+typedef str* (*get_routeset_t)(struct sip_msg*, int *nr_routes);
/*! record-route API export binding */
typedef struct rr_binds {
@@ -63,6 +70,9 @@ typedef struct rr_binds {
get_route_param_t get_route_param;
register_rrcb_t register_rrcb;
int append_fromtag;
+ get_remoteuri_t get_remoteuri;
+ get_routeset_t get_routeset;
+ int rr_type;
} rr_api_t;
typedef int (*load_rr_f)( struct rr_binds* );
diff --git a/modules_k/rr/loose.c b/modules_k/rr/loose.c
index 9cf1ef9..5d0fccf 100644
--- a/modules_k/rr/loose.c
+++ b/modules_k/rr/loose.c
@@ -43,6 +43,7 @@
#include "loose.h"
#include "rr_cb.h"
#include "rr_mod.h"
+#include "api.h"
#define RR_ERROR -1 /*!< An error occured while processing route set */
@@ -639,6 +640,8 @@ static inline int after_strict(struct sip_msg* _m)
if (is_strict(&puri.params)) {
LM_DBG("Next hop: '%.*s' is strict router\n", uri.len, ZSW(uri.s));
+ rr_type = RR_TYPE_STRICT_STRICT;
+
/* Previous hop was a strict router and the next hop is strict
* router too. There is no need to save R-URI again because it
* is saved already. In fact, in this case we will behave exactly
@@ -671,6 +674,7 @@ static inline int after_strict(struct sip_msg* _m)
} else {
LM_DBG("Next hop: '%.*s' is loose router\n",
uri.len, ZSW(uri.s));
+ rr_type = RR_TYPE_STRICT_LOOSE;
if(get_maddr_uri(&uri, &puri)!=0) {
LM_ERR("failed to check maddr\n");
@@ -800,6 +804,9 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
if (res > 0) { /* No next route found */
LM_DBG("No next URI found\n");
status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
+
+ rr_type = RR_TYPE_LOOSE_LOOSE;
+
goto done;
}
rt = (rr_t*)hdr->parsed;
@@ -835,6 +842,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
if (res > 0) { /* No next route found */
LM_DBG("no next URI found\n");
status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
+ rr_type = RR_TYPE_LOOSE_LOOSE;
goto done;
}
rt = (rr_t*)hdr->parsed;
@@ -858,6 +866,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
LM_DBG("URI to be processed: '%.*s'\n", uri.len, ZSW(uri.s));
if (is_strict(&puri.params)) {
LM_DBG("Next URI is a strict router\n");
+ rr_type = RR_TYPE_LOOSE_STRICT;
if (handle_sr(_m, hdr, rt) < 0) {
LM_ERR("failed to handle strict router\n");
return RR_ERROR;
@@ -865,7 +874,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
} else {
/* Next hop is loose router */
LM_DBG("Next URI is a loose router\n");
-
+ rr_type = RR_TYPE_LOOSE_LOOSE;
if(get_maddr_uri(&uri, &puri)!=0) {
LM_ERR("checking maddr failed\n");
return RR_ERROR;
@@ -905,6 +914,7 @@ done:
int loose_route(struct sip_msg* _m)
{
int ret;
+ rr_type = 0;
if (find_first_route(_m) != 0) {
LM_DBG("There is no Route HF\n");
@@ -1133,3 +1143,111 @@ upstream:
last_dir = RR_FLOW_UPSTREAM;
return (dir==RR_FLOW_UPSTREAM)?0:-1;
}
+
+/*!
+ * \brief Gets the URI of the remote destination, based on the route-set.
+ *
+ * \param msg - request that will have the Route header parameter searched
+ * \return A str with the URI of the remote target.
+ */
+str* get_remoteuri(struct sip_msg *msg) {
+ int res;
+ struct hdr_field *hdr;
+ rr_t *rt,*prev;
+ str *uri;
+
+ if (msg == NULL) {
+ LM_ERR("No SIP-Message, internal error?!?!\n");
+ return NULL;
+ }
+ /* If we are a loose-router,
+ we find the Remote URI in the Request URI. */
+ if ((rr_type == RR_TYPE_LOOSE_LOOSE)
+ || (rr_type == RR_TYPE_LOOSE_STRICT)) {
+ return &msg->first_line.u.request.uri;
+ } else if (rr_type == RR_TYPE_STRICT_LOOSE) {
+ /* We are a strict router, so the loose_route() sets the
+ new URI from the previous strict routing. */
+ return &msg->new_uri;
+ } else if (rr_type == RR_TYPE_STRICT_STRICT) {
+ res = find_rem_target(msg, &hdr, &rt, &prev);
+ if (res < 0) {
+ /* Failed to find the last route-target */
+ LM_ERR("Failed to find the last route-target\n");
+ return NULL;
+ } else if (res > 0) {
+ /* No remote target found */
+ LM_ERR("No remote target found!\n");
+ return NULL;
+ }
+ uri = &rt->nameaddr.uri;
+ if(get_maddr_uri(uri, 0)!=0) {
+ LM_ERR("failed to check maddr\n");
+ return 0;
+ }
+ return uri;
+ } else {
+ LM_ERR("Unknown / invalid routing type %d\n", rr_type);
+ return 0;
+ }
+}
+
+/*!
+ * \brief Returns a list of the URI's from the route-headers
+ *
+ * \param msg - request that will have the Route header parameter searched
+ * \return An array of str with the URI of the next hops.
+ */
+#define MAX_HDRS 32
+str* get_routeset(struct sip_msg *msg,int *nr_routes) {
+ /* The destination, where the URI's are stored */
+ static str uris[MAX_HDRS];
+ /* Iterator for all record-route headers */
+ struct hdr_field *hdr;
+ /* The parsed route-header structure */
+ rr_t * rr;
+
+ if (msg == NULL || msg->route == NULL) {
+ LM_ERR("No SIP-Message or no route-headers!\n");
+ return NULL;
+ }
+
+ if (!nr_routes) {
+ LM_ERR("nr_routes parameter is invalid!\n");
+ return NULL;
+ }
+ *nr_routes = 0;
+
+ if ((rr_type == RR_TYPE_STRICT_STRICT)
+ || (rr_type == RR_TYPE_LOOSE_STRICT)) {
+ /* must manually insert RURI, as it was part
+ * of the route deleted to make up for strict routing */
+ uris[(*nr_routes)++] = msg->new_uri;
+ }
+
+ hdr = msg->route;
+ while (hdr != NULL) {
+ if (parse_rr(hdr) < 0) {
+ LM_ERR("Invalid Route-Header, failed to parse\n");
+ return NULL;
+ }
+ /* Get the parsed content of the route-header */
+ rr = (rr_t*)hdr->parsed;
+ while (rr) {
+ uris[(*nr_routes)++] = rr->nameaddr.uri;
+ if(*nr_routes==MAX_HDRS) {
+ LM_ERR("Too many route-headers!!!\n");
+ return 0;
+ }
+ rr = rr->next;
+ }
+ hdr = hdr->next;
+ }
+
+
+ /* if SS - remove last route */
+ if (rr_type == RR_TYPE_STRICT_STRICT)
+ (*nr_routes)--;
+
+ return uris;
+}
diff --git a/modules_k/rr/loose.h b/modules_k/rr/loose.h
index 6b1bdc9..31157d1 100644
--- a/modules_k/rr/loose.h
+++ b/modules_k/rr/loose.h
@@ -38,6 +38,10 @@
#define RR_FLOW_DOWNSTREAM (1<<0)
#define RR_FLOW_UPSTREAM (1<<1)
+/*!
+ * \brief Next-Hop is a strict or loose-router?
+ */
+int rr_type;
/*!
* \brief Do loose routing as per RFC3261
@@ -92,5 +96,20 @@ int is_direction(struct sip_msg *msg, int dir);
*/
int get_route_param( struct sip_msg *msg, str *name, str *val);
+/*!
+ * \brief Gets the URI of the remote destination, based on the route-set.
+ *
+ * \param msg - request that will have the Route header parameter searched
+ * \return A str with the URI of the remote target.
+ */
+str* get_remoteuri(struct sip_msg *msg);
+
+/*!
+ * \brief Returns a list of the URI's from the route-headers
+ *
+ * \param msg - request that will have the Route header parameter searched
+ * \return An array of str with the URI of the next hops.
+ */
+str* get_routeset(struct sip_msg *msg, int *nr_routes);
#endif /* LOOSE_H */
Module: sip-router
Branch: carstenbock/utils_post DELETED
Commit: d84cced413b6dbb495eb56a99b955b10c3785211
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d84cced…
Author: Carsten Bock <carsten(a)ng-voice.com>
Committer: Carsten Bock <carsten(a)ng-voice.com>
Date: Thu Aug 22 16:36:48 2013 +0200
Define missing fixup_functions.
---
modules/utils/utils.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/utils/utils.c b/modules/utils/utils.c
index 735ea0d..13b7f07 100644
--- a/modules/utils/utils.c
+++ b/modules/utils/utils.c
@@ -89,8 +89,10 @@ static int child_init(int);
static void destroy(void);
/* Fixup functions to be defined later */
-static int fixup_http_query(void** param, int param_no);
-static int fixup_free_http_query(void** param, int param_no);
+static int fixup_http_query_get(void** param, int param_no);
+static int fixup_free_http_query_get(void** param, int param_no);
+static int fixup_http_query_post(void** param, int param_no);
+static int fixup_free_http_query_post(void** param, int param_no);
/* Wrappers for http_query to be defined later */
static int w_http_query(struct sip_msg* _m, char* _url, char* _result);
Hello,
although not something critical, it would be good to clean up unused
(already merged) branches from tmp or personal paths in git.
Not big deal, but will save some reference and space when cloning all
the repo, keeping things a bit more cleaner as well.
Deleting the remote branch can be done with:
git push origin :path/branch
For example, I removed my xavp branch from personal path (daniel) with:
git push origin :daniel/xavp
You can see the list of branches at:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=heads
Cheers,
Daniel
--
Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Nov 25-28; Miami, Nov 18-20, 2013
- more details about Kamailio trainings at http://www.asipto.com -
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#354 - UAC restore_mode "auto" fails to restore From if UA changes From header
User who did this - Daniel Grotti (dgrotti)
----------
Thanks Daniel, you can close the issue.
Daniel G.
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=354#comment1123
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.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#354 - UAC restore_mode "auto" fails to restore From if UA changes From header
User who did this - Daniel-Constantin Mierla (miconda)
----------
The vsf value is computed from incoming From, new value for From and a key. If incoming From is changed, then the new value is not going to be the same for requests within dialog. In other works, if one of the UA is changing the From header URI, then the values will be different. You should use dialog based storage in this case, or, as the UA doesn't use From for rfc2543 matching, don't do the restore, as you actually did.
----------
More information can be found at the following URL:
https://sip-router.org/tracker/index.php?do=details&task_id=354#comment1122
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.
according to sl readme, send_reply() can be called from branch route.
however, when i tried with recent master i got:
Oct 14 08:47:34 rautu /usr/sbin/sip-proxy[11203]: : tm [tm.c:1342]: w_t_reply(): BUG: w_t_reply entered in unsupported mode
Oct 14 08:47:34 rautu /usr/sbin/sip-proxy[11203]: ERROR: sl [sl.c:277]: send_reply(): failed to reply stateful (tm)
is this a bug in code or readme?
-- juha
Hi
Apologies for the late commits - Daniel approved them as minor and/or
isolated.
FYI the tm changes allow t_suspend and t_continue to be used with SIP
responses and the ims_qos changes allow media authorisation over Diameter
Rx (between P-CSCF and PCRF).
We've tested the ims_qos module with our own PCRF, as other PCRFs are
tested we can incorporate the changes.
Any problems let me know.
Regards
Richard.
This email is subject to the disclaimer of Smile Communications at http://www.smilecoms.com/disclaimer
Module: sip-router
Branch: master
Commit: d5c482ca06ff4b8529ea00d421484addd0203c37
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d5c482c…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Thu Oct 17 16:44:46 2013 +0200
modules/tm: Edited documentation to show that t_suspend/continue can now be used on SIP responses
---
modules/tm/doc/api.xml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules/tm/doc/api.xml b/modules/tm/doc/api.xml
index 2a627ab..0a3c751 100644
--- a/modules/tm/doc/api.xml
+++ b/modules/tm/doc/api.xml
@@ -157,7 +157,7 @@ end of body
This function together with t_continue() can be used to
implement asynchronous actions: t_suspend() saves the transaction,
returns its identifiers, and t_continue() continues the
- SIP request processing. (The request processing does not continue
+ SIP request/response processing. (The request/response processing does not continue
from the same point in the script, a separate route block defined
by the parameter of t_continue() is executed instead. The reply lock
is held during the route block execution.)