Browse Source

use auth for message

master
lazedo 6 years ago
parent
commit
fa702d0a8e
1 changed files with 6 additions and 8 deletions
  1. +6
    -8
      kamailio/message-role.cfg

+ 6
- 8
kamailio/message-role.cfg View File

@ -6,18 +6,16 @@ route[HANDLE_MESSAGE]
if (isflagset(FLAG_INTERNALLY_SOURCED) || src_ip == myself) return;
xlog("L_INFO", "$ci|log|MESSAGE from $fu to $tu\n");
route(AUTH);
$xavp(regcfg=>match_received) = $su;
if($avp(is_registered) != "true") {
sl_send_reply("403", "Forbidden");
if (!isflagset(FLAG_AUTHORIZED)) {
send_reply("403", "Forbidden");
exit;
} else {
if($hdr(Content-Type) == "text/plain" ||
$hdr(Content-Type) == "text/html") {
if($hdr(Content-Type) =~ "text/plain" ||
$hdr(Content-Type) =~ "text/html") {
route(MESSAGE_INBOUND);
} else {
xlog("L_WARN", "$ci|end|dropping MESSAGE $hdr(Content-Type)\n");
sl_send_reply("200", "OK");
send_reply("200", "OK");
exit;
}
}
@ -33,7 +31,7 @@ route[MESSAGE_INBOUND]
$var(RoutingKey) = $_s(sms.inbound.onnet.$(ci{kz.encode}));
xlog("L_INFO", "$ci|msg|sending inbound message $var(RoutingKey) => $var(Payload)\n");
kazoo_publish($var(exchange), $var(RoutingKey), $var(Payload));
sl_send_reply("200", "OK");
t_reply("200", "OK");
exit;
}


Loading…
Cancel
Save