Hi,
how should I check if the value is set?
if ($avp(s:test) == "") {
or is there any null keyword ? If so, does it work for $avp, $sht, $var and $shv ?
Thanks,
Mino
if(defined $var(x))
Or, if checking for empty value:
if(strempty($var(x))
Mino Haluz mino.haluz@gmail.com wrote:
Hi,
how should I check if the value is set?
if ($avp(s:test) == "") {
or is there any null keyword ? If so, does it work for $avp, $sht, $var and $shv ?
Thanks,
Mino
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
and how to check null value taken from database?
$dbr(ra=>[0,0]) == ?
On Mon, Jan 14, 2013 at 1:44 PM, Alex Balashov abalashov@evaristesys.comwrote:
if(defined $var(x))
Or, if checking for empty value:
if(strempty($var(x))
Mino Haluz mino.haluz@gmail.com wrote:
Hi,
how should I check if the value is set?
if ($avp(s:test) == "") {
or is there any null keyword ? If so, does it work for $avp, $sht, $var and $shv ?
Thanks,
Mino
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Sent from my mobile, and thus lacking in the refinement one might expect from a fully-fledged keyboard.
Alex Balashov - Principal Evariste Systems LLC 235 E Ponce de Leon Ave Suite 106 Decatur, GA 30030 United States Tel: +1-678-954-0670 Web: http://www.evaristesys.com/, http://www.alexbalashov.com/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 01/14/2013 09:16 AM, Mino Haluz wrote:
and how to check null value taken from database?
$dbr(ra=>[0,0]) == ?
That depends on what you truly mean by "null" value. :-)
If you want to check for no rows returned, you can check the value of $dbr(ra=>rows) to get a count, e.g.
if($dbr(ra=>rows) < 1)
if(! $dbr(ra=>rows))
If you are looking to test for a truly NULL value as opposed to an empty string, I suspect that varies with database API. I use db_postgres, and if I remember correctly, 'defined' works for that:
if(! defined $dbr(ra=>[0,0]))
That's IIRC. I am not 100.0% sure.
However, other DB interface implementations may return an empty string even in case of a null value, in which case strempty() may be the better test.
-- Alex
I believe what you are looking for is $null
if($avp(s:test) == $null){
}
On Mon, Jan 14, 2013 at 3:59 AM, Mino Haluz mino.haluz@gmail.com wrote:
Hi,
how should I check if the value is set?
if ($avp(s:test) == "") {
or is there any null keyword ? If so, does it work for $avp, $sht, $var and $shv ?
Thanks,
Mino
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users