before event_route[websocket:closed] is run, i can assign id of the closed ws connection to rcv.proto_reserved1 field of the faked message:
static void wsconn_run_route(ws_connection_t *wsc) { ... fmsg = faked_msg_next(); wsc->rcv.proto_reserved1 = wsc->id; fmsg->rcv = wsc->rcv; ... }
the problem is that
int pv_get_tcpconn_id(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
calls tcpconn_get:
if ((con = tcpconn_get(msg->rcv.proto_reserved1, 0, 0, 0, 0)) == NULL) return pv_get_null(msg, param, res);
and since the ws connection whose id is stored in msg->rcv.proto_reserved1 does not anymore exist, the statement returns null pv value.
is there some way to figure out that $conid was accessed from event_route[websocket:closed] in which case the connection id stored in msg->rcv.proto_reserved1 should be returned without checking if that connection still exists?
if not, i guess i need to introduce yet another pv for the purpose.
-- juha