Let me try this script ,Thanks On Mon, Jun 15, 2015 at 1:27 PM, Alexandru Covalschi <568...@gmail.com> wrote:
> > 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 > Please read http://kamailio.org/docs/modules/4.3.x/modules/ndb_redis.html > this guide to understand how to connect redis to Kamailio > 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(); > } > > You can find information about pseudo-variables on this > http://www.kamailio.org/wiki/cookbooks/4.0.x/pseudovariables page > > 2. Rtpengine algorithm > First of all, look through https://github.com/sipwise/rtpengine and > http://kamailio.org/docs/modules/4.3.x/modules/rtpengine.html to > understand what's the difference between rtpengine and rtpproxy > 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"); > } > > } > > > 2015-06-14 22:24 GMT+03:00 Juha Heinanen <j...@tutpro.com>: > >> Alexandru Covalschi writes: >> >> > > you don't need a database for that. you can use location table flags >> > Can you please describe how to do that? I chosen redis because I need to >> > figure out the proto of the leg_b (called) user pretty fast - mysql is >> much >> > slower. >> >> sorry, i thought you use registrar/usrloc modules. >> >> -- juha >> >> _______________________________________________ >> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >> sr-users@lists.sip-router.org >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >> > > > > -- > Alexandru Covalschi > ABRISS-Solutions > VoIP engineer and system administrator > phone: +37367398493 > web: http://abs-telecom.com/ > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > >
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users