[sr-dev] [kamailio/kamailio] pv: add the $env() PV class to read env vars (#978)

Victor Seva notifications at github.com
Tue Feb 7 18:16:19 CET 2017


linuxmaniac commented on this pull request.



> +	sp->pvp.pvn.u.dname = (void*)csname;
+	sp->pvp.pvn.type = PV_NAME_OTHER;
+	return 0;
+}
+
+int pv_get_env(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
+{
+	char *val;
+	char *csname = (char *) param->pvn.u.dname;
+
+	if (csname) {
+		val = getenv(csname);
+
+		if (val) {
+			return pv_get_strzval(msg, param, res, val);
+		} else {

what about

```
if (csname) {
  val = getenv(csname);
  if(val) return pv_get_strzval(msg, param, res, val);
}
return pv_get_null(msg, param, res);
```

-- 
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/978#pullrequestreview-20564972
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20170207/b0b018ed/attachment.html>


More information about the sr-dev mailing list