[sr-dev] [kamailio/kamailio] sca: sca_handle_subscribe() honor the "$ru" value (#778)

Daniel-Constantin Mierla notifications at github.com
Wed Sep 14 14:24:50 CEST 2016


It can be merged, but the retrieval of current r-uri has to be changed. I don't think it is wise to use config variables names in the C code. I refer to the snippet:

```
 +	str src_uri = str_init("$ru");
...
 +	if (pv_eval_str(msg, &ruri, &src_uri) < 0) {
 +		LM_ERR("Failed to get $ru value fallback to parse msg\n");
 +		ruri.s = REQ_LINE(msg).uri.s;
 +		ruri.len = REQ_LINE(msg).uri.len;
 +	}
```

It should be as simple as:

```
if(parse_sip_msg_uri(msg)<0) { /* error handling */ }

if (msg->new_uri.s!=NULL) {
  ruri = msg->new_uri;
} else {
   ruri = REQ_LINE(msg).uri;
}

```

The name of r-uri variable (**$ru**) is set by pv module, I don't think sca (or other module) have to rely on that being forever. Also, it requires parsing the name and evaluation. In cases when there is a lot of duplicated code, better export the C function from pv module and make that a dependency, otherwise this approach can hide unpredictible behaviour in long term, without getting any errors at compilation or linking.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/778#issuecomment-246996301
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160914/77352375/attachment.html>


More information about the sr-dev mailing list