[sr-dev] git:master:cffe6756: tsilo: removed check of use_domain for uri parameter in ts_store()
Daniel-Constantin Mierla
miconda at gmail.com
Wed Sep 23 09:32:34 CEST 2015
Hi Federico,
yes, that's right.
Because only ts_store() was checking the use_domain and used only
username when use_domain=0, the ts_append() with a uri didn't match any
record, so I pushed the patch to be able to test it on some remote
system and it is matching now.
Cheers,
Daniel
On 23/09/15 08:18, Federico Cabiddu wrote:
> Hi Daniel,
> at this point I think we can totally remove use_domain and dependency
> from usrloc module.
> Do you agree?
>
> Regards,
>
> Federico
>
> On Wed, Sep 23, 2015 at 1:17 AM, Daniel-Constantin Mierla
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
> Module: kamailio
> Branch: master
> Commit: cffe67566f206a6c4e76d76a36e0e1783d056369
> URL:
> https://github.com/kamailio/kamailio/commit/cffe67566f206a6c4e76d76a36e0e1783d056369
>
> Author: Daniel-Constantin Mierla <miconda at gmail.com
> <mailto:miconda at gmail.com>>
> Committer: Daniel-Constantin Mierla <miconda at gmail.com
> <mailto:miconda at gmail.com>>
> Date: 2015-09-23T01:15:46+02:00
>
> tsilo: removed check of use_domain for uri parameter in ts_store()
>
> - ts_append() is using full sip uri and will not match if ts_store()
> with use_domain=0 will store only username
>
> ---
>
> Modified: modules/tsilo/ts_store.c
> Modified: modules/tsilo/tsilo.c
>
> ---
>
> Diff:
> https://github.com/kamailio/kamailio/commit/cffe67566f206a6c4e76d76a36e0e1783d056369.diff
> Patch:
> https://github.com/kamailio/kamailio/commit/cffe67566f206a6c4e76d76a36e0e1783d056369.patch
>
> ---
>
> diff --git a/modules/tsilo/ts_store.c b/modules/tsilo/ts_store.c
> index 2cec2ef..e4f11ba 100644
> --- a/modules/tsilo/ts_store.c
> +++ b/modules/tsilo/ts_store.c
> @@ -60,19 +60,14 @@ int ts_store(struct sip_msg* msg, str *puri) {
> }
> }
>
> - if (use_domain) {
> - aor = suri;
> - }
> - else {
> - if (parse_uri(suri.s, suri.len, &ruri)!=0)
> - {
> - LM_ERR("bad uri [%.*s]\n",
> - suri.len,
> - suri.s);
> - return -1;
> - }
> - aor = ruri.user;
> + if (parse_uri(suri.s, suri.len, &ruri)!=0)
> + {
> + LM_ERR("bad uri [%.*s]\n",
> + suri.len,
> + suri.s);
> + return -1;
> }
> + aor = suri;
>
> t = _tmb.t_gett();
> if (!t || t==T_UNDEFINED) {
> diff --git a/modules/tsilo/tsilo.c b/modules/tsilo/tsilo.c
> index 843804c..411cbc4 100644
> --- a/modules/tsilo/tsilo.c
> +++ b/modules/tsilo/tsilo.c
> @@ -212,10 +212,21 @@ static void destroy(void)
> return;
> }
>
> +static int ts_check_uri(str *uri)
> +{
> + struct sip_uri ruri;
> + if (parse_uri(uri->s, uri->len, &ruri)!=0)
> + {
> + LM_ERR("bad uri [%.*s]\n",
> + uri->len,
> + uri->s);
> + return -1;
> + }
> + return 0;
> +}
> /**
> *
> */
> -
> static int fixup_ts_append_to(void** param, int param_no)
> {
> if (param_no==1 || param_no==2) {
> @@ -263,6 +274,8 @@ static int w_ts_append(struct sip_msg* _msg,
> char *_table, char *_ruri)
> LM_ERR("invalid ruri parameter\n");
> return -1;
> }
> + if(ts_check_uri(&ruri)<0)
> + return -1;
> return ts_append(_msg, &ruri, _table);
> }
> /**
> @@ -309,6 +322,8 @@ static int w_ts_append_to2(struct sip_msg*
> msg, char *idx, char *lbl, char *tabl
> LM_ERR("failed to conert r-uri parameter\n");
> return -1;
> }
> + if(ts_check_uri(&suri)<0)
> + return -1;
>
> return ts_append_to(msg, tindex, tlabel, table, &suri);
> }
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org <mailto:sr-dev at lists.sip-router.org>
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - http://asipto.com/u/kat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150923/2d9e891e/attachment.html>
More information about the sr-dev
mailing list