|
@@ -91,7 +91,7 @@ static int mod_init(void);
|
|
|
static int mod_child_init(int);
|
|
|
static void mod_destroy(void);
|
|
|
|
|
|
-static int w_ro_ccr(struct sip_msg *msg, str* route_name, str* direction, str* charge_type, str* unit_type, int reservation_units, str* trunk_id);
|
|
|
+static int w_ro_ccr(struct sip_msg *msg, char* route_name, char* direction, char* charge_type, char* unit_type, int reservation_units, char* trunk_id);
|
|
|
//void ro_session_ontimeout(struct ro_tl *tl);
|
|
|
|
|
|
static int ro_fixup(void **param, int param_no);
|
|
@@ -346,7 +346,7 @@ static void mod_destroy(void) {
|
|
|
|
|
|
}
|
|
|
|
|
|
-static int w_ro_ccr(struct sip_msg *msg, str* route_name, str* direction, str* charge_type, str* unit_type, int reservation_units, str* trunk_id) {
|
|
|
+static int w_ro_ccr(struct sip_msg *msg, char* c_route_name, char* c_direction, char* c_charge_type, char* c_unit_type, int reservation_units, char* c_trunk_id) {
|
|
|
/* PSEUDOCODE/NOTES
|
|
|
* 1. What mode are we in - terminating or originating
|
|
|
* 2. check request type - IEC - Immediate Event Charging
|
|
@@ -377,12 +377,37 @@ static int w_ro_ccr(struct sip_msg *msg, str* route_name, str* direction, str* c
|
|
|
struct ro_session *ro_session = 0;
|
|
|
int free_contact = 0;
|
|
|
|
|
|
- LM_DBG("Ro CCR initiated: direction:%.*s, charge_type:%.*s, unit_type:%.*s, reservation_units:%i, route_name:%.*s",
|
|
|
- direction->len, direction->s,
|
|
|
- charge_type->len, charge_type->s,
|
|
|
- unit_type->len, unit_type->s,
|
|
|
+ str s_route_name, s_direction, s_charge_type, s_unit_type, s_trunk_id;
|
|
|
+
|
|
|
+ if (get_str_fparam(&s_route_name, msg, (fparam_t*) c_route_name) < 0) {
|
|
|
+ LM_ERR("failed to get s_route_name\n");
|
|
|
+ return RO_RETURN_ERROR;
|
|
|
+ }
|
|
|
+ if (get_str_fparam(&s_direction, msg, (fparam_t*) c_direction) < 0) {
|
|
|
+ LM_ERR("failed to get s_direction\n");
|
|
|
+ return RO_RETURN_ERROR;
|
|
|
+ }
|
|
|
+ if (get_str_fparam(&s_charge_type, msg, (fparam_t*) c_charge_type) < 0) {
|
|
|
+ LM_ERR("failed to get s_charge_type\n");
|
|
|
+ return RO_RETURN_ERROR;
|
|
|
+ }
|
|
|
+ if (get_str_fparam(&s_unit_type, msg, (fparam_t*) c_unit_type) < 0) {
|
|
|
+ LM_ERR("failed to get s_unit_type\n");
|
|
|
+ return RO_RETURN_ERROR;
|
|
|
+ }
|
|
|
+ if (get_str_fparam(&s_trunk_id, msg, (fparam_t*) c_trunk_id) < 0) {
|
|
|
+ LM_ERR("failed to get s_trunk_id\n");
|
|
|
+ return RO_RETURN_ERROR;
|
|
|
+ }
|
|
|
+
|
|
|
+ LM_DBG("Ro CCR initiated: direction:%.*s, charge_type:%.*s, unit_type:%.*s, reservation_units:%i, route_name:%.*s, trunk_id:%.*s\n",
|
|
|
+ s_direction.len, s_direction.s,
|
|
|
+ s_charge_type.len, s_charge_type.s,
|
|
|
+ s_unit_type.len, s_unit_type.s,
|
|
|
reservation_units,
|
|
|
- route_name->len, route_name->s);
|
|
|
+ s_route_name.len, s_route_name.s,
|
|
|
+ s_trunk_id.len, s_trunk_id.s);
|
|
|
+
|
|
|
|
|
|
if (msg->first_line.type != SIP_REQUEST) {
|
|
|
LM_ERR("Ro_CCR() called from SIP reply.");
|
|
@@ -397,7 +422,7 @@ static int w_ro_ccr(struct sip_msg *msg, str* route_name, str* direction, str* c
|
|
|
return RO_RETURN_ERROR;
|
|
|
}
|
|
|
|
|
|
- dir = get_direction_as_int(direction);
|
|
|
+ dir = get_direction_as_int(&s_direction);
|
|
|
|
|
|
if (dir == RO_ORIG_DIRECTION) {
|
|
|
//get caller IMPU from asserted identity
|
|
@@ -482,18 +507,18 @@ send_ccr:
|
|
|
goto done;
|
|
|
}
|
|
|
|
|
|
- LM_DBG("Looking for route block [%.*s]\n", route_name->len, route_name->s);
|
|
|
+ LM_DBG("Looking for route block [%.*s]\n", s_route_name.len, s_route_name.s);
|
|
|
|
|
|
- int ri = route_get(&main_rt, route_name->s);
|
|
|
+ int ri = route_get(&main_rt, s_route_name.s);
|
|
|
if (ri < 0) {
|
|
|
- LM_ERR("unable to find route block [%.*s]\n", route_name->len, route_name->s);
|
|
|
+ LM_ERR("unable to find route block [%.*s]\n", s_route_name.len, s_route_name.s);
|
|
|
ret = RO_RETURN_ERROR;
|
|
|
goto done;
|
|
|
}
|
|
|
|
|
|
cfg_action = main_rt.rlist[ri];
|
|
|
if (!cfg_action) {
|
|
|
- LM_ERR("empty action lists in route block [%.*s]\n", route_name->len, route_name->s);
|
|
|
+ LM_ERR("empty action lists in route block [%.*s]\n", s_route_name.len, s_route_name.s);
|
|
|
ret = RO_RETURN_ERROR;
|
|
|
goto done;
|
|
|
}
|
|
@@ -521,7 +546,7 @@ send_ccr:
|
|
|
goto done;
|
|
|
}
|
|
|
|
|
|
- ret = Ro_Send_CCR(msg, dlg, dir, charge_type, unit_type, reservation_units, trunk_id, cfg_action, tindex, tlabel);
|
|
|
+ ret = Ro_Send_CCR(msg, dlg, dir, &s_charge_type, &s_unit_type, reservation_units, &s_trunk_id, cfg_action, tindex, tlabel);
|
|
|
|
|
|
if(ret < 0){
|
|
|
LM_ERR("Failed to send CCR\n");
|