Skip to content

Commit

Permalink
call_center: cc_handle_call() accept strings
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed May 14, 2014
1 parent bdfee9d commit b252b47
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions modules/call_center/call_center.c
Expand Up @@ -66,8 +66,6 @@ static struct mi_root* mi_cc_list_agents(struct mi_root *cmd_tree, void *param);
static struct mi_root* mi_cc_list_calls(struct mi_root *cmd_tree, void *param);
static struct mi_root* mi_reset_stats(struct mi_root *cmd_tree, void *param);

static int fixup_id(void** param, int param_no);

static int w_handle_call(struct sip_msg *req, char *id);
static int w_agent_login(struct sip_msg *req, char *agent, char *state);

Expand All @@ -91,7 +89,7 @@ unsigned int wrapup_time = 30;

static cmd_export_t cmds[]={
{"cc_handle_call", (cmd_function)w_handle_call, 1,
fixup_id, 0, REQUEST_ROUTE},
fixup_sgp_null, 0, REQUEST_ROUTE},
{"cc_agent_login", (cmd_function)w_agent_login, 2,
fixup_sgp_sgp, 0, REQUEST_ROUTE},
{0,0,0,0,0,0}
Expand Down Expand Up @@ -224,14 +222,6 @@ unsigned long cc_flow_free_agents( void *flow)
}


static int fixup_id(void** param, int param_no)
{
if (param_no)
return fixup_pvar(param);
return -1;
}


static int mod_init(void)
{
LM_INFO("Call Center module - initializing\n");
Expand Down Expand Up @@ -722,26 +712,22 @@ static inline str* build_displayname(str *prefix, struct to_body *fh)

static int w_handle_call(struct sip_msg *msg, char *flow_var)
{
pv_value_t val;
struct cc_flow *flow;
struct cc_call *call;
str leg = {NULL,0};
str *dn;
str val;
int dec;
int ret = -1;

call = NULL;
dec = 0;

/* get the flow name */
if (pv_get_spec_value(msg, (pv_spec_p)flow_var, &val)!=0 ) {
if (fixup_get_svalue(msg, (gparam_p)flow_var, &val)!=0) {
LM_ERR("failed to avaluate the flow name variable\n");
return -1;
}
if ( (val.flags&PV_VAL_STR)==0 || (val.flags&PV_VAL_NULL)!=0) {
LM_ERR("non-str val for flow name variable\n");
return -1;
}

/* parse FROM URI */
if (parse_from_uri(msg)==NULL) {
Expand All @@ -752,9 +738,9 @@ static int w_handle_call(struct sip_msg *msg, char *flow_var)
lock_get( data->lock );

/* get the flow ID */
flow = get_flow_by_name(data, &val.rs);
flow = get_flow_by_name(data, &val);
if (flow==NULL) {
LM_ERR("flow <%.*s> does not exists\n", val.rs.len, val.rs.s);
LM_ERR("flow <%.*s> does not exists\n", val.len, val.s);
ret = -3;
goto error;
}
Expand Down

0 comments on commit b252b47

Please sign in to comment.