Avaya Aura SIP trunk to Asterisk with PJSIP (tcp) - Qualify woes
(This was 2015-2016 era, Outdated and Obsolete by now)

Asterisk 13.18-cert3, with PJSIP - everything works fine peering with an Avaya CM, except the CM does not accept Qualify responses as valid. I had no access to the Avaya system so I never got to see or debug why on their end, I tried a lot of things assuming that one of the header fields was causing the Avaya system to ignore it.

I verified with packet dumps on both ends that the packets did reach Avaya, and it sent a TCP ACK on those packets, so I am left to believe that Avaya simply ignored my qualify (OPTIONS) responses. A call made from Asterisk to Avaya it woke up the trunk, and it worked from Avaya to Asterisk - after about 90 seconds when the Qualifies timed out, it disconnected the TCP session dn stopped routing, it kept sending OPTIONS every 3 minutes after.

The workaround was to just disable qualify on the Avaya system, it is in the Trunk Group settings: "Enable Layer 3 test" - change it to No and it will do icmp echo instead of OPTIONS requests.

All these tests where with TCP SIP signaling, i do not know if it is true with UDP, I do not have my own Avaya system to test on (yet). The interesting part is that chan_sip has no issues at all, the 404 it replies with is ironically accepted with open hands.

__Chan SIP__

 From Avaya System:
    OPTIONS sip:rootdomainname.com SIP/2.0
    From: ;tag=801439578091e81c175ab9cbee00
    To: 
    Call-ID: 801439578091e81c175ab9cbee00
    CSeq: 65084 OPTIONS
    Max-Forwards: 70
    Via: SIP/2.0/TCP 192.168.50.17;branch=z9hG4bK801439578091e81d175ab9cbee00
    User-Agent: Avaya CM/R016x.03.0.124.0
    Contact: 
    Route: 
    Expires: 0
    Content-Length:     0

 Response from Asterisk:
    SIP/2.0 404 Not Found
    Via: SIP/2.0/TCP 192.168.50.17;branch=z9hG4bK801439578091e81d175ab9cbee00;received=192.168.50.17
    From: ;tag=801439578091e81c175ab9cbee00
    To: ;tag=as78b434e2
    Call-ID: 801439578091e81c175ab9cbee00
    CSeq: 65084 OPTIONS
    Server: Asterisk
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
    Supported: replaces, timer
    Accept: application/sdp
    Content-Length: 0


__PJSIP__

 From Avaya System:
    OPTIONS sip:rootdomainname.com SIP/2.0
    From: ;tag=08044b05f91e81beb35ab9cbee00
    To: 
    Call-ID: 08044b05f91e81beb35ab9cbee00
    CSeq: 27703 OPTIONS
    Max-Forwards: 70
    Via: SIP/2.0/TCP 192.168.50.17;branch=z9hG4bK08044b05f91e81bfb35ab9cbee00
    User-Agent: Avaya CM/R016x.03.0.124.0
    Contact: 
    Route: 
    Expires: 0
    Content-Length:     0

 Response from Asterisk:
    SIP/2.0 200 OK
    Via: SIP/2.0/TCP 192.168.50.17;rport=27730;received=192.168.50.17;branch=z9hG4bK08044b05f91e81bfb35ab9cbee00
    Call-ID: 08044b05f91e81beb35ab9cbee00
    From: ;tag=08044b05f91e81beb35ab9cbee00
    To: ;tag=z9hG4bK08044b05f91e81bfb35ab9cbee00
    CSeq: 27703 OPTIONS
    Accept: application/sdp, application/xpidf+xml, application/cpim-pidf+xml, application/dialog-info+xml, application/pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, message/sipfrag;version=2.0
    Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
    Supported: 100rel, timer, replaces, norefersub
    Accept-Encoding: text/plain
    Accept-Language: en
    Server: Asterisk PBX certified/13.18-cert3
    Content-Length:  0