You have to use topos:receiving instead of topos:incoming.



Le 11 juil. 2024 08:48, Denys Pozniak via sr-users <sr-users@lists.kamailio.org> a écrit :
Hello!
I need to disable topos for one specific SIP trunk (in-out), it looks like it’s enough to use event_route with IP address filtering.
But for some reason, the incoming INVITE from the peer still gets processed by topos and I also don’t see a mention of [msg-incoming] in the logs, only this:

WARNING: <script>: [msg-outgoing] OPTIONS/you/1.1.1.1

Code snippet:

loadmodule "topos.so"
modparam("topos", "db_url", DBURL)
modparam("topos", "contact_mode", 1)
modparam("topos", "header_mode", 1)
modparam("topos", "methods_noinitial", "OPTIONS,SUBSCRIBE,PUBLISH")
modparam("topos", "dialog_expire", 7210)
modparam("topos", "rr_update", 1)
modparam("topos", "event_mode", 5)
/*
1 - execute event_route[topos:msg-outgoing]
2 - execute event_route[topos:msg-sending]
4 - execute event_route[topos:msg-incoming]
8 - execute event_route[topos:msg-receiving]
*/

request_route {
....
  event_route[topos:msg-outgoing] {
    if ( $sndto(ip) == "1.1.1.1" ) {
         xlog("L_WARN","[msg-outgoing] $rm/$rU/$sndto(ip) \n");
        drop;
    }
  }
}

event_route[topos:msg-incoming] {
    if ( $si == "1.1.1.1" ) {
         xlog("L_WARN","[msg-incoming] $rm/$rU/$si \n");
        drop;
    }
}

# kamailio -v
version: kamailio 5.7.1 (x86_64/linux) 1cf389-dirty



--

BR,
Denys Pozniak