Skip to content

Commit

Permalink
rtpproxy: allow unexisting set
Browse files Browse the repository at this point in the history
Do not exit if a set is not found during startup, since it may be later on
loaded from database.
  • Loading branch information
razvancrainea committed Mar 10, 2014
1 parent b5fd777 commit 6b3c22c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
46 changes: 27 additions & 19 deletions modules/rtpproxy/rtpproxy.c
Expand Up @@ -720,11 +720,14 @@ static int fixup_set_id(void ** param, int param_no)
pkg_free(*param);
rtpp_list = select_rtpp_set(int_val);
if(rtpp_list ==0){
LM_ERR("rtpp_proxy set %i not configured\n", int_val);
return E_CFG;
/* simply mark it as undefined and we search it one more time
* at runtime, after the database has been updated */
pset->t = NH_VAL_SET_UNDEF;
pset->v.int_set = int_val;
} else {
pset->t = NH_VAL_SET_FIXED ;
pset->v.fixed_set = rtpp_list;
}
pset->t = NH_VAL_SET_FIXED ;
pset->v.fixed_set = rtpp_list;
*param = (void *) pset;
return 0;
} else {
Expand Down Expand Up @@ -2319,25 +2322,30 @@ set_rtp_proxy_set_f(struct sip_msg * msg, char * str1, char * str2)
return 1;
}

if ( pv_get_spec_value(msg,&pset->v.var_set,&value)!=0 ||
value.flags & PV_VAL_NULL || value.flags&PV_VAL_EMPTY ) {
LM_ERR("no PV or NULL value specified for proxy set "
"(error in scripts)\n");
return -1;
}
if (pset->t == NH_VAL_SET_SPEC) {

if ( pv_get_spec_value(msg,&pset->v.var_set,&value)!=0 ||
value.flags & PV_VAL_NULL || value.flags&PV_VAL_EMPTY ) {
LM_ERR("no PV or NULL value specified for proxy set "
"(error in scripts)\n");
return -1;
}

if ( value.flags & PV_VAL_STR ) {
int_val = str2s(value.rs.s, value.rs.len, &err);
if (err != 0) {
LM_ERR("Invalid value %s specified in PV as RTP proxy set.\n",
value.rs.s );
if ( value.flags & PV_VAL_STR ) {
int_val = str2s(value.rs.s, value.rs.len, &err);
if (err != 0) {
LM_ERR("Invalid value %s specified in PV as RTP proxy set.\n",
value.rs.s );
return -1;
}
} else if ( value.flags & PV_VAL_INT ) {
int_val = value.ri;
} else {
LM_ERR("Unsupported PV value type for RTP ptoxy set.i\n");
return -1;
}
} else if ( value.flags & PV_VAL_INT ) {
int_val = value.ri;
} else {
LM_ERR("Unsupported PV value type for RTP ptoxy set.i\n");
return -1;
int_val = pset->v.int_set;
}

LM_DBG("Variable proxy set %d specified.\n", int_val);
Expand Down
4 changes: 3 additions & 1 deletion modules/rtpproxy/rtpproxy.h
Expand Up @@ -95,14 +95,16 @@ struct rtpp_notify_head {

/* parameter type for set_rtp_proxy_set() */

#define NH_VAL_SET_FIXED 0
#define NH_VAL_SET_FIXED 0
#define NH_VAL_SET_SPEC 1
#define NH_VAL_SET_UNDEF 2

typedef struct rtpp_set_param{
int t;
union {
struct rtpp_set * fixed_set;
pv_spec_t var_set;
int int_set;
} v;
} nh_set_param_t;

Expand Down

0 comments on commit 6b3c22c

Please sign in to comment.