> sorry, i thought you use registrar/usrloc modules
Well, I do use them - so if you could explain in which table does Kamailio write the user's proto and which flags I can use - I'll make a test to see which scheme is preferable :)
So, about script:
1.) Write to redis
It route[AUTH] you shall add write to redis command:
if (is_method("REGISTER") || from_uri==myself)
{
# authenticate requests
redis_cmd("protobase", "SET $fU $proto bar", "r"); # Here is the redis
if (!auth_check("$fd", "subscriber", "1")) {
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
2. Rtpengine algorithm
In your NATMANAGE route change rtpproxy_manage(); or rtpengine_manage(); string to this:
if(ds_is_from_list())
{
xlog("L_NOTICE","====== selecting $tU proto\n");
redis_cmd("protobase", "GET $tU", "uproto");
xlog("L_NOTICE","===== $tU has proto $redis(uproto=>value)\n");
if ($redis(uproto=>value)=="ws")
{
xlog("L_NOTICE","===== $tU is a websocket user\n");
rtpengine_manage("direction=internal direction=external force trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF");
}
else
{
xlog("L_NOTICE","===== $tU is classy user\n");
rtpengine_manage("direction=internal direction=external force trust-address replace-origin replace-session-connection");
}
} else {
xlog("L_NOTICE","====== $fU proto is $proto ");
if ($proto=="ws")
{
xlog("L_NOTICE","===== $fU is websocket user\n");
rtpengine_manage("direction=external direction=internal force trust-address replace-origin replace-session-connection ICE=force RTP/AVP");
}
else
{
xlog("L_NOTICE","===== $fU is a classy user");
rtpengine_manage("direction=external direction=internal replace-origin replace-session-connection force trust-address RTP/AVP");
}
}