-
Notifications
You must be signed in to change notification settings - Fork 637
Description
It will be awesome if we can remain within the boundaries of OpenSIPS & SIP protocol and send/retrieve data among the Clustered proxies.
The clusterer module and Bin proto are the first step towards that.
Ideally speaking, I want to send a SIP packet method("MYNAME") to the whole cluster or to a specific ID on the cluster. Similarly the receiving Proxy will be configured to recognize the method (MYNAME) and possibly reply with w/e data in headers/body it needs.
I see the developer functions in the Clusterer module doc but I want those functions in opensips.cfg
My Dream code(sample):
Sender Proxy:
$avp(body) = "Offender IP: " + $si;
$avp(my_method) = "BLOCK_IP";
send_all("$avp(my_method)","text/plain","$avp(body)");
$avp(body) = "Check IP: " + $si;
$avp(my_method) = "QUERY_IP";
send_to("$avp(my_method)","$avp(central_proxy_id)","text/plain","$avp(body)","$avp(reply)","resume_route");
....
route[resume_route] {
if($avp(reply) = "BAD" ) {
# Block this Caller: $si ; this is blocked Cluster-wide.
}else if ($avp(reply) = "OK" ) {
route(allowed_callers);
}
}
Receiver Proxies:
if(check_address("1","$si"))
xlog("A Cluster Proxy Sent Something\n");
if(is_method("BLOCK_IP")) {
$avp(offender) = $mb;
# blocked IP $avp(offender) cluster-wide.
}
if(is_method("REGSYNC")) {
$avp(subscriber) = $hdr(FROM);
$avp(hosted_at) = $si;
xlog("Subscriber $avp(subscriber) is now located at $avp(hosted_at)\n");
}
if(is_method("QUERY_IP")) {
$avp(query_this) = $(mb{s.select,1,:});
# Check IP $avp(query_this) From Local DB/Redis/Whatever
if(found_blocked) {
t_reply("200","BAD");
}else {
t_reply("200","OK");
}
}
}
Practically, all of the above is found in Kamailio as DMQ module for cluster communications, or additionally UAC module to compose a SIP packet...I'd love if I can do this within OpenSIPS w/o using rest_client, rabbitMQ and other external dependencies.