|
|
|
@ -325,44 +325,39 @@ route[HANDLE_NOTIFY] |
|
|
|
|
|
|
|
route[HANDLE_MESSAGE] |
|
|
|
{ |
|
|
|
#!ifdef MESSAGE-ROLE |
|
|
|
|
|
|
|
if (is_method("MESSAGE")) { |
|
|
|
xlog("L_INFO", "$ci|MESSAGE from $fu to $tu"); |
|
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED) || src_ip == myself) { |
|
|
|
xlog("L_INFO", "$ci| routing MESSAGE to external from $fu to $tu"); |
|
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
|
#!ifdef TRAFFIC-FILTER-ROLE |
|
|
|
} else if (!isflagset(FLAG_TRUSTED_SOURCE) |
|
|
|
&& $rd =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}") { |
|
|
|
xlog("L_WARN", "$ci|end|dropping MESSAGE request with IP domain"); |
|
|
|
#!endif |
|
|
|
} else { |
|
|
|
xlog("L_WARN", "$ci|end|MESSAGE $(hdr(Content-Type))"); |
|
|
|
if( $hdr(Content-Type) == "application/im-iscomposing+xml" ) { |
|
|
|
#!ifdef MESSAGE-ROLE |
|
|
|
if (is_method("MESSAGE")) { |
|
|
|
xlog("L_INFO", "$ci|MESSAGE from $fu to $tu"); |
|
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED) || src_ip == myself) { |
|
|
|
xlog("L_INFO", "$ci| routing MESSAGE to external from $fu to $tu"); |
|
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
|
#!ifdef TRAFFIC-FILTER-ROLE |
|
|
|
} else if (!isflagset(FLAG_TRUSTED_SOURCE) |
|
|
|
&& $rd =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}") { |
|
|
|
xlog("L_WARN", "$ci|end|dropping MESSAGE request with IP domain"); |
|
|
|
#!endif |
|
|
|
} else { |
|
|
|
xlog("L_WARN", "$ci|end|MESSAGE $(hdr(Content-Type))"); |
|
|
|
if( $hdr(Content-Type) == "application/im-iscomposing+xml" ) { |
|
|
|
xlog("L_WARN", "$ci|end|dropping MESSAGE application/im-iscomposing+xml"); |
|
|
|
sl_send_reply("200", "OK"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
route(DISPATCHER_FIND_ROUTES); |
|
|
|
route(EXTERNAL_TO_INTERNAL_RELAY); |
|
|
|
} |
|
|
|
} |
|
|
|
exit(); |
|
|
|
} |
|
|
|
|
|
|
|
#!else |
|
|
|
|
|
|
|
if (is_method("MESSAGE")) { |
|
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
|
} else { |
|
|
|
sl_send_reply("202", "delivered to /dev/null"); |
|
|
|
exit; |
|
|
|
} |
|
|
|
exit(); |
|
|
|
} |
|
|
|
#!else |
|
|
|
if (is_method("MESSAGE")) { |
|
|
|
if (isflagset(FLAG_INTERNALLY_SOURCED)) { |
|
|
|
route(INTERNAL_TO_EXTERNAL_RELAY); |
|
|
|
} else { |
|
|
|
sl_send_reply("202", "delivered to /dev/null"); |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
} |
|
|
|
#!endif |
|
|
|
} |
|
|
|
|
|
|
|
route[HANDLE_IN_DIALOG_REQUESTS] |
|
|
|
@ -542,9 +537,9 @@ onreply_route[INTERNAL_REPLY] |
|
|
|
#!endif |
|
|
|
|
|
|
|
if (is_method("INVITE") && |
|
|
|
!isflagset(FLAG_SESSION_PROGRESS) && |
|
|
|
t_check_status("(180)|(183)|(200)") |
|
|
|
) { |
|
|
|
!isflagset(FLAG_SESSION_PROGRESS) && |
|
|
|
t_check_status("(180)|(183)|(200)") |
|
|
|
) { |
|
|
|
if ($avp(AVP_REDIRECT_KEY) != $null && |
|
|
|
$sht(redirects=>$avp(AVP_REDIRECT_KEY)) != $null |
|
|
|
) { |
|
|
|
@ -576,8 +571,8 @@ failure_route[INTERNAL_FAULT] |
|
|
|
|
|
|
|
# Handle redirects |
|
|
|
if (t_check_status("302")) { |
|
|
|
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->" |
|
|
|
+ $T_rpl($(ct{tobody.user})) + "@" + $T_rpl($(ct{tobody.host})); |
|
|
|
$var(redirect) = @from.uri.user + "@" + @from.uri.host + "->" |
|
|
|
+ $T_rpl($(ct{tobody.user})) + "@" + $T_rpl($(ct{tobody.host})); |
|
|
|
if($T_rpl($hdr(X-Redirect-Server)) != $null) { |
|
|
|
$sht(redirects=>$var(redirect)) = $T_rpl($hdr(X-Redirect-Server)); |
|
|
|
xlog("L_INFO", "$ci|log|stored redirect mapping $var(redirect) to $T_rpl($hdr(X-Redirect-Server))"); |
|
|
|
@ -596,7 +591,7 @@ failure_route[INTERNAL_FAULT] |
|
|
|
if (t_check_status("6[0-9][0-9]") && !t_check_status("600|603|604|606")) { |
|
|
|
$var(new_code) = "4" + $(T_reply_code{s.substr,1,0}); |
|
|
|
xlog("L_INFO", "$ci|log|sending 6XX reply as $var(new_code) $var(reply_reason)"); |
|
|
|
t_reply("$(var(new_code){s.int})", "$var(reply_reason)"); |
|
|
|
t_reply("$(var(new_code){s.int})", "$var(reply_reason)"); |
|
|
|
|
|
|
|
# if the failure case was something that we should recover |
|
|
|
# from then try to find a new media server |
|
|
|
@ -637,13 +632,13 @@ event_route[kazoo:mod-init] |
|
|
|
{ |
|
|
|
#!ifdef PRESENCE-ROLE |
|
|
|
|
|
|
|
### use this simple form of binding a listener |
|
|
|
### use this simple form of binding a listener |
|
|
|
### kazoo_subscribe("dialoginfo", "direct", "BLF-QUEUE-MY_HOSTNAME", "BLF-MY_HOSTNAME"); |
|
|
|
### |
|
|
|
### or unleash the power of rabbit to kazoo-blf |
|
|
|
### |
|
|
|
### 'no_ack' : 1 => needs ack, |
|
|
|
### 'wait_for_consumer_ack' |
|
|
|
### 'no_ack' : 1 => needs ack, |
|
|
|
### 'wait_for_consumer_ack' |
|
|
|
### : 1 => when it receives, it processses on the AMQP Worker ad after that it confirms |
|
|
|
### : 0 => when it receives, it acks then processes in the AMQP Worker |
|
|
|
### only works if no_ack : 0 |
|
|
|
@ -652,13 +647,13 @@ event_route[kazoo:mod-init] |
|
|
|
### pattern : ^BLF |
|
|
|
### definition : ha-mode: all |
|
|
|
### |
|
|
|
### |
|
|
|
### |
|
|
|
$var(payload) = "{ 'exchange' : 'dialoginfo' , 'type' : 'direct', 'queue' : 'BLF-QUEUE-MY_HOSTNAME', 'routing' : 'BLF-MY_HOSTNAME', 'auto_delete' : 0, 'durable' : 1, 'no_ack' : 0, 'wait_for_consumer_ack' : 1 }"; |
|
|
|
xlog("L_INFO","SUBSCRIBE $var(payload)"); |
|
|
|
kazoo_subscribe("$var(payload)"); |
|
|
|
|
|
|
|
#!endif |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
event_route[kazoo:consumer-event] |
|
|
|
|