SIP has been broken and I just noticed

Issue #685 resolved
Former user created an issue

Here are my settings:

if failed
                host port 4065 type udp protocol sip
                with target "" and maxforward 0
                with timeout 5 seconds
                                retry 2
        then alert

However when do capture I get this in the sip messages

09:32:17.507133 IP > UDP, length 371
E...0t@.@...&f.=&f.(.....{B.OPTIONS sip:test@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bKh229517444;rport
Max-Forwards: 70
To: <sip:test@>
From: monit <sip:monit@>;tag=1788031191
Call-ID: 1928261051
CSeq: 63104 OPTIONS
Contact: <sip:>
Accept: application/sdp
Content-Length: 0
User-Agent: Monit/5.23.0

Notice that Max-Forwards: 70 despite settings. This breaks the monitoring.

Comments (4)

  1. Alexander Litvak

    Sorry copied the wrong setting, but port is 7060 on the right one otherwise everything I said stands.

  2. Alexander Litvak

    Hackin it to 0 (not a solution for everyone), make it work for me. Could it be the that somehow

     const char *target = P-> ? P-> : "";
            int maxforward  = P->parameters.sip.maxforward ? P->parameters.sip.maxforward : 0;
        int port = Socket_getLocalPort(socket);
        char *proto = Socket_isSecure(socket) ? "sips" : "sip";
        char *transport = "";
        char *rport = "";
        switch (Socket_getType(socket)) {
                case Socket_Udp:
                        transport = "UDP";
                        rport = ";rport";
                case Socket_Tcp:
                        transport = "TCP";
                        THROW(IOException, "Unsupported socket type, only TCP and UDP are supported");
        char buf[STRLEN];
        const char *myip = Socket_getLocalHost(socket, buf, sizeof(buf));
        if (Socket_print(socket,
                         "OPTIONS %s:%s SIP/2.0\r\n"
                         "Via: SIP/2.0/%s %s:%d;branch=z9hG4bKh%ld%s\r\n"
                         "Max-Forwards: %d\r\n"
                         "To: <%s:%s>\r\n"
                         "From: monit <%s:monit@%s>;tag=%ld\r\n"
                         "Call-ID: %ld\r\n"
                         "CSeq: 63104 OPTIONS\r\n"
                         "Contact: <%s:%s:%d>\r\n"
                         "Accept: application/sdp\r\n"
                         "Content-Length: 0\r\n"
                         "User-Agent: Monit/%s\r\n\r\n",
                         proto,                        // protocol
                         target,                       // to
                         transport,                    // via transport udp|tcp
                         myip,                         // who its from
                         port,                         // our port
                         random(),                     // branch
                         rport,                        // rport option
                         maxforward,               // maximum number of forwards        
                         proto,                        // protocol


  3. Alexander Litvak

    Pressed comment button too soon. I wonder if maxforward is either not getting the value from the right place.

  4. Log in to comment