Hey Karsten, 

I'm using that same modparam and it's working as expected. My example:

modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=403;code=488;code=405;class=3")

I believe the problem is that you are using a comma "," as separator, and the correct separator is a semi-colon ";"???

BTW (offtopic), to make Asterisk answer with a 200 OK, you can do the following:

Add to extensions.conf...

[default]
exten => s,1,Wait(1)
same => n,Hangup

This will make asterisk respond with a 200OK instead of a 404 Not Found. This "default" is dependent on the context= parameter in sip.conf, if you have changed it, you will have to name the extension accordingly. And lastly, AFAIR you don't need the wait(1) and probably can do the hangup() directly, I needed it for different reasons, give it a try.

This works for OPTIONS sent to a sip:IP:Port address, if you are using a monitoring system or cli tool or similar that sends OPTIONS to sip:something@ip:port, then the following dialplan works (I'll use "nagios" as an example: sip:nagios@X.X.X.X:5060) :

[default]
exten => nagios,1,Wait(1)
same => n,Hangup

You can combine both if you have both kinds:

[default]
exten => s,1,Wait(1)
same => n,Hangup
exten => nagios,1,Wait(1)
same => n,Hangup

etc....


Hope this helps!

Joel.





On Fri, Dec 13, 2019 at 8:35 AM Karsten Horsmann <khorsmann@gmail.com> wrote:
Hello all!

i am using kamailio 5.3.1-4 on CentOS and i am using dispatcher to ping his targets.
Now i have someone with asterisk that answers with 401 or 404 (depends on asterisk version).

So i tried  code=401;code=404 as aditional attrs. Seems not to work.
Also i tired to change the modparam from class=2 to this:
  modparam("dispatcher", "ds_ping_reply_codes", "class=2,code=401,code=404")  

Is that a "bug" or a hidden feature, or i missed something?

Btw - Have a nice weekend!

SELECT * FROM dispatcher WHERE id=1 \G
*************************** 1. row ***************************
         id: 1
      setid: 1100
destination: sip:SOMEWHERE;transport=tls
      flags: 0
   priority: 0
      attrs: socket=tls:MY.IP.AD.RR:5061;ping_from=sip:MY.SIP.DOMAIN;code=401;code=404
description: UNTRUSTED



        "SET":  {
          "ID": 1100,
          "TARGETS":  [{
              "DEST": {
                "URI":  "sip:SOMEWHERE;transport=tls",
                "FLAGS":  "IP",
                "PRIORITY": 0,
                "ATTRS":  {
                  "BODY": "socket=tls:MY.IP.AD.RR:5061;ping_from=sip:MY.SIP.DOMAIN;code=401;code=404",
                  "DUID": "",
                  "MAXLOAD":  0,
                  "WEIGHT": 0,
                  "RWEIGHT":  0,
                  "SOCKET": "tls:MY.SIP.DOMAIN:5061"
                },
                "LATENCY":  {
                  "AVG":  48768.816406,
                  "STD":  139490.953125,
                  "EST":  43359.566406,
                  "MAX":  568876,
                  "TIMEOUT":  8
                }
              }
            }]
        }
      }]

#!ifdef WITH_MYSQL
modparam("dispatcher", "db_url", "DBURL")
modparam("dispatcher", "table_name", "dispatcher")
#!endif
#!ifndef WITH_MYSQL
modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
#!endif
modparam("dispatcher", "ds_ping_method", "OPTIONS")
modparam("dispatcher", "ds_ping_from", "<sip:ping@FANCY-COMPANY-WEBNAME>")
modparam("dispatcher", "ds_ping_interval", 30)
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_probing_threshold", 2)
modparam("dispatcher", "setid_pvname", "$var(setid)")
modparam("dispatcher", "attrs_pvname", "$var(attrs)")
modparam("dispatcher", "ds_ping_reply_codes", "class=2,code=401,code=404")
modparam("dispatcher", "ds_ping_latency_stats", 1)


https://community.asterisk.org/t/asterisk-responds-with-404-to-options-even-when-an-endpoint-is-matched/76238




Dec 13 17:25:46 siptrunk3 /usr/sbin/kamailio[25115]: INFO: <script>: Sending message
'OPTIONS sip:SOMEWHERE;transport=tls SIP/2.0
Via: SIP/2.0/TLS MY.IP.AD.RR:5061;branch=z9hG4bK2527.825671c0000000000000000000000000.0
To: <sip:SOMEWHERE;transport=tls>
From: <sip:MY.SIP.DOMAIN>;tag=f9bf2579cb456ea8d260d4aabc8248ef-9ca844ad
CSeq: 10 OPTIONS
Call-ID: 01cb6e272da7b0dd-25115@MY.IP.AD.RR
Max-Forwards: 70
Content-Length: 0
User-Agent: SBC-OS

'
Dec 13 17:25:46 siptrunk3 /usr/sbin/kamailio[25127]: INFO: <script>: Received message
'SIP/2.0 404 Not Found
Via: SIP/2.0/TLS MY.IP.AD.RR:5061;branch=z9hG4bK2527.825671c0000000000000000000000000.0;received=MY.IP.AD.RR
From: <sip:MY.SIP.DOMAIN>;tag=f9bf2579cb456ea8d260d4aabc8248ef-9ca844ad
To: <sip:SOMEWHERE;transport=tls>;tag=as54adca41
Call-ID: 01cb6e272da7b0dd-25115@MY.IP.AD.RR
CSeq: 10 OPTIONS
Server: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

'
--
Cheers
*Karsten Horsmann*
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users