2 * Copyright (C) 2001-2003 FhG Fokus
4 * This file is part of Kamailio, a free SIP server.
6 * Kamailio is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version
11 * Kamailio is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * \brief Implementation for Select Pseudo-variables
26 #include "../../core/select.h"
27 #include "pv_select.h"
29 int pv_parse_select_name(pv_spec_p sp, str *in)
34 if (in == NULL || in->s == NULL || sp == NULL)
37 STR_VTOZ(in->s[in->len], c);
39 if(parse_select(&p, &sel)<0)
41 LM_ERR("invalid select name [%.*s]\n",
43 STR_ZTOV(in->s[in->len], c);
46 STR_ZTOV(in->s[in->len], c);
47 sp->pvp.pvn.u.dname = (void*)sel;
48 sp->pvp.pvn.type = PV_NAME_OTHER;
53 int pv_get_select(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
58 sel = (select_t*)param->pvn.u.dname;
60 if(sel==0 || run_select(&s, sel, msg)<0 || s.s==0)
61 return pv_get_null(msg, param, res);
62 return pv_get_strval(msg, param, res, &s);