Digium D40 cannot connect to pjsip extension

Running FreePBX 6.12.65-29. Just switched to Asterisk 13 and trying to test out pjsip. Most of our phones are Digium D40s and are configured via DPMA. I tried converting my extension to chan_pjsip but now the phone cannot connect. Initially I would get:

[2015-08-24 14:52:11] NOTICE[1329] chan_sip.c: Registration from '"\"device\" <222>" <sip:[email protected]>' failed for '10.11.8.108:5060' - Wrong password

Then I think I figured out that I needed to setup a new network in the digium phone config to point it to port 5061 for the registration server. Now the phone times out trying to contact the proxy - sip:[email protected]:5061. On the server I see:

[2015-08-24 15:30:55] ERROR[3712] res_pjsip_messaging.c: PJSIP MESSAGE - Could not find endpoint 'sip:10.11.8.108:5060' and no default outbound endpoint configured
[2015-08-24 15:38:05] NOTICE[1321]: phone_message.c:1299 prune_inactive: Pruning unauthenticated session for device at 'sip:10.11.8.108:5060;ob' due to inactivity.

asterisk*CLI> pjsip show endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================

 Endpoint:  222/222                                              Unavailable   0 of inf
     InAuth:  222-auth/222
        Aor:  222                                                1


asterisk*CLI> pjsip show endpoint 222

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>
    I/OAuth:  <AuthId/UserName...........................................................>
        Aor:  <Aor............................................>  <MaxContact>
      Contact:  <Aor/ContactUri...............................>  <Status....>  <RTT(ms)..>
  Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress..................>
   Identify:  <Identify/Endpoint.........................................................>
        Match:  <ip/cidr.........................>
    Channel:  <ChannelId......................................>  <State.....>  <Time(sec)>
        Exten: <DialedExten...........>  CLCID: <ConnectedLineCID.......>
 =========================================================================================

 Endpoint:  222/222                                              Unavailable   0 of inf
     InAuth:  222-auth/222
        Aor:  222                                                1


 ParameterName                 : ParameterValue
 ====================================================
 100rel                        : yes
 accountcode                   : 
 aggregate_mwi                 : true
 allow                         : (ulaw|alaw|gsm)
 allow_subscribe               : true
 allow_transfer                : true
 aors                          : 222
 auth                          : 222-auth
 call_group                    : 
 callerid                      : "device" <222>
 callerid_privacy              : allowed_not_screened
 callerid_tag                  : 
 connected_line_method         : invite
 context                       : from-internal
 cos_audio                     : 0
 cos_video                     : 0
 device_state_busy_at          : 0
 direct_media                  : true
 direct_media_glare_mitigation : none
 direct_media_method           : invite
 disable_direct_media_on_nat   : false
 dtls_ca_file                  : 
 dtls_ca_path                  : 
 dtls_cert_file                : 
 dtls_cipher                   : 
 dtls_fingerprint              : SHA-256
 dtls_private_key              :
 dtls_rekey                    : 0
 dtls_setup                    : active
 dtls_verify                   : No
 dtmf_mode                     : rfc4733
 fax_detect                    : false
 force_avp                     : false
 force_rport                   : true
 from_domain                   :
 from_user                     :
 g726_non_standard             : false
 ice_support                   : false
 identify_by                   : username
 inband_progress               : false
 language                      :
 mailboxes                     :
 media_address                 :
 media_encryption              : no
 media_encryption_optimistic   : false
 media_use_received_transport  : false
 message_context               :
 moh_suggest                   : default
 mwi_from_user                 :
 named_call_group              :
 named_pickup_group            :
 one_touch_recording           : false
 outbound_auth                 :
 outbound_proxy                :
 pickup_group                  :
 record_off_feature            : automixmon
 record_on_feature             : automixmon
 rewrite_contact               : true
 rpid_immediate                : false
 rtp_engine                    : asterisk
 rtp_ipv6                      : false
 rtp_keepalive                 : 0
 rtp_symmetric                 : true
 rtp_timeout                   : 0
 rtp_timeout_hold              : 0
 sdp_owner                     : -
 sdp_session                   : Asterisk
 send_diversion                : true
 send_pai                      : false
 send_rpid                     : false
 set_var                       :
 srtp_tag_32                   : false
 sub_min_expiry                : 0
 t38_udptl                     : false
 t38_udptl_ec                  : none
 t38_udptl_ipv6                : false
 t38_udptl_maxdatagram         : 0
 t38_udptl_nat                 : false
 timers                        : yes
 timers_min_se                 : 90
 timers_sess_expires           : 1800
 tone_zone                     :
 tos_audio                     : 0
 tos_video                     : 0
 transport                     :
 trust_id_inbound              : true
 trust_id_outbound             : false
 use_avpf                      : false
 use_ptime                     : false
 user_eq_phone                 : false

I get a single packet set to the server and a single response but that’s it:

Frame 143: 157 bytes on wire (1256 bits), 157 bytes captured (1256 bits) on interface 0
    Interface id: 0
    WTAP_ENCAP: 1
    Arrival Time: Aug 24, 2015 15:47:50.190171000 MDT
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1440452870.190171000 seconds
    [Time delta from previous captured frame: 0.000013000 seconds]
    [Time delta from previous displayed frame: 0.000013000 seconds]
    [Time since reference or first frame: 229.085458000 seconds]
    Frame Number: 143
    Frame Length: 157 bytes (1256 bits)
    Capture Length: 157 bytes (1256 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:udp:sip:data-text-lines]
Ethernet II, Src: Digium_07:86:b3 (00:0f:d3:07:86:b3), Dst: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee)
    Destination: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee)
        Address: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: Digium_07:86:b3 (00:0f:d3:07:86:b3)
        Address: Digium_07:86:b3 (00:0f:d3:07:86:b3)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 10.11.8.108 (10.11.8.108), Dst: 10.11.8.1 (10.11.8.1)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
    Total Length: 143
    Identification: 0x717f (29055)
    Flags: 0x00
        0... .... = Reserved bit: Not set
        .0.. .... = Don't fragment: Not set
        ..0. .... = More fragments: Not set
    Fragment offset: 1480
    Time to live: 64
    Protocol: UDP (17)
    Header checksum: 0xe3a3 [correct]
        [Good: True]
        [Bad: False]
    Source: 10.11.8.108 (10.11.8.108)
    Destination: 10.11.8.1 (10.11.8.1)
    [2 IPv4 Fragments (1603 bytes): #142(1480), #143(123)]
        [Frame: 142, payload: 0-1479 (1480 bytes)]
        [Frame: 143, payload: 1480-1602 (123 bytes)]
        [Fragment count: 2]
        [Reassembled IPv4 length: 1603]
User Datagram Protocol, Src Port: sip (5060), Dst Port: na-localise (5062)
    Source port: sip (5060)
    Destination port: na-localise (5062)
    Length: 1603
    Checksum: 0x8d69 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
Session Initiation Protocol (MESSAGE)
    Request-Line: MESSAGE sip:[email protected]:5062 SIP/2.0
        Method: MESSAGE
        Request-URI: sip:[email protected]:5062
            Request-URI User Part: proxy
            Request-URI Host Part: asterisk.cora.nwra.com
            Request-URI Host Port: 5062
        [Resent Packet: False]
    Message Header
        Via: SIP/2.0/UDP 10.11.8.108:5060;rport;branch=z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
            Transport: UDP
            Sent-by Address: 10.11.8.108
            Sent-by port: 5060
            RPort: rport
            Branch: z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
        Max-Forwards: 70
        From: <sip:10.11.8.108>;tag=KiOqopQaMoltsK3AnoRiVBfzw.wGmoB2
            SIP from address: sip:10.11.8.108
                SIP from address Host Part: 10.11.8.108
            SIP from tag: KiOqopQaMoltsK3AnoRiVBfzw.wGmoB2
        To: <sip:[email protected]>
            SIP to address: sip:[email protected]
                SIP to address User Part: proxy
                SIP to address Host Part: asterisk.cora.nwra.com
        Call-ID: HxLl6err.xmX.UMfdAak3tvnsBJsnFzX
        CSeq: 48172 MESSAGE
            Sequence Number: 48172
            Method: MESSAGE
        Accept: text/plain, application/im-iscomposing+xml
        Contact: <sip:10.11.8.108:5060;ob>
            Contact URI: sip:10.11.8.108:5060;ob
                Contact URI Host Part: 10.11.8.108
                Contact URI Host Port: 5060
                Contact URI parameter: ob
        User-Agent: Digium D40 1_4_2_0_63880
        X-Digium-User-Agent: Digium D40 1_4_2_0_63880
            [Expert Info (Note/Undecoded): Unrecognised SIP header (X-Digium-User-Agent)]
                [Message: Unrecognised SIP header (X-Digium-User-Agent)]
                [Severity level: Note]
                [Group: Undecoded]
        X-Digium-AppServer-RequestType: Handshake
            [Expert Info (Note/Undecoded): Unrecognised SIP header (X-Digium-AppServer-RequestType)]
                [Message: Unrecognised SIP header (X-Digium-AppServer-RequestType)]
                [Severity level: Note]
                [Group: Undecoded]
        X-Digium-AppServer-MACAddress: 000FD30786B3
            [Expert Info (Note/Undecoded): Unrecognised SIP header (X-Digium-AppServer-MACAddress)]
                [Message: Unrecognised SIP header (X-Digium-AppServer-MACAddress)]
                [Severity level: Note]
                [Group: Undecoded]
        X-Digium-Software-Version: 1_4_2_0_63880
            [Expert Info (Note/Undecoded): Unrecognised SIP header (X-Digium-Software-Version)]
                [Message: Unrecognised SIP header (X-Digium-Software-Version)]
                [Severity level: Note]
                [Group: Undecoded]
        X-Digium-AppServer-ID: bootc_600869
            [Expert Info (Note/Undecoded): Unrecognised SIP header (X-Digium-AppServer-ID)]
                [Message: Unrecognised SIP header (X-Digium-AppServer-ID)]
                [Severity level: Note]
                [Group: Undecoded]
        Content-Type: text/plain
        Content-Length:   875
    Message Body
        Line-based text data: text/plain
            -----BEGIN CERTIFICATE-----\n
            MIICWTCCAcKgAwIBAgIBVTANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJVUzEL\n
            MAkGA1UECBMCQ0ExEjAQBgNVBAcTCVNhbiBEaWVnbzEVMBMGA1UEChMMRGlnaXVt\n
            LCBJbmMuMRkwFwYDVQQDExBEaWdpdW0gQXBwc2VydmVyMB4XDTcwMDEwMTAwMDAw\n
            MFoXDTM4MDEwMTAwMDAwMFowTDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRUw\n
            EwYDVQQKEwxEaWdpdW0sIEluYy4xGTAXBgNVBAMTEERpZ2l1bSBBcHBzZXJ2ZXIw\n
            XDANBgkqhkiG9w0BAQEFAANLADBIAkEAySsdzKCAZXN7XcLpoMDFGGdLLJZRdnKI\n
            I5cQFMsCi9JaV1CG1wayQ6RRSHrixe7Wy0SZD/zNOUBlVXcY0GvRdwIDAQABo3sw\n
            eTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBD\n
            ZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUNQkgTvS7C74013YFzeqnewPtcokwHwYDVR0j\n
            BBgwFoAUQ4XMqehyfmlcYNQhgohxNy8y3/UwDQYJKoZIhvcNAQEFBQADgYEAB/Zk\n
            UnfE9xoslXijUVp54vGl9mlHDLNg3Lt9yMWeksoODx7LLXS8WiSWg0QXpDUwbQ6G\n
            sm6akXWIe5+J/wcglerRA/QaYKGUM7ilDCEIpxbFju66uhtqVbz2KOh3b+SN2n/J\n
            VECaSBdey8OI0HOJySMc06e8i9rza6e6dYzQAIc=\n
            -----END CERTIFICATE-----\n

Frame 144: 456 bytes on wire (3648 bits), 456 bytes captured (3648 bits) on interface 0
    Interface id: 0
    WTAP_ENCAP: 1
    Arrival Time: Aug 24, 2015 15:47:50.191888000 MDT
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1440452870.191888000 seconds
    [Time delta from previous captured frame: 0.001717000 seconds]
    [Time delta from previous displayed frame: 0.001717000 seconds]
    [Time since reference or first frame: 229.087175000 seconds]
    Frame Number: 144
    Frame Length: 456 bytes (3648 bits)
    Capture Length: 456 bytes (3648 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: eth:ip:udp:sip]
Ethernet II, Src: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee), Dst: Digium_07:86:b3 (00:0f:d3:07:86:b3)
    Destination: Digium_07:86:b3 (00:0f:d3:07:86:b3)
        Address: Digium_07:86:b3 (00:0f:d3:07:86:b3)
        .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Source: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee)
        Address: RealtekU_8b:0b:ee (52:54:00:8b:0b:ee)
        .... ..1. .... .... .... .... = LG bit: Locally administered address (this is NOT the factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IP (0x0800)
Internet Protocol Version 4, Src: 10.11.8.1 (10.11.8.1), Dst: 10.11.8.108 (10.11.8.108)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00: Not-ECT (Not ECN-Capable Transport))
        0000 00.. = Differentiated Services Codepoint: Default (0x00)
        .... ..00 = Explicit Congestion Notification: Not-ECT (Not ECN-Capable Transport) (0x00)
    Total Length: 442
    Identification: 0x0000 (0)
    Flags: 0x02 (Don't Fragment)
        0... .... = Reserved bit: Not set
        .1.. .... = Don't fragment: Set
        ..0. .... = More fragments: Not set
    Fragment offset: 0
    Time to live: 64
    Protocol: UDP (17)
    Header checksum: 0x14b1 [correct]
        [Good: True]
        [Bad: False]
    Source: 10.11.8.1 (10.11.8.1)
    Destination: 10.11.8.108 (10.11.8.108)
User Datagram Protocol, Src Port: na-localise (5062), Dst Port: sip (5060)
    Source port: na-localise (5062)
    Destination port: sip (5060)
    Length: 422
    Checksum: 0x263a [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
Session Initiation Protocol (202)
    Status-Line: SIP/2.0 202 Accepted
        Status-Code: 202
        [Resent Packet: False]
        [Request Frame: 143]
        [Response Time (ms): 1]
    Message Header
        Via: SIP/2.0/UDP 10.11.8.108:5060;rport=5060;received=10.11.8.108;branch=z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
            Transport: UDP
            Sent-by Address: 10.11.8.108
            Sent-by port: 5060
            RPort: 5060
            Received: 10.11.8.108
            Branch: z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
        Call-ID: HxLl6err.xmX.UMfdAak3tvnsBJsnFzX
        From: <sip:10.11.8.108>;tag=KiOqopQaMoltsK3AnoRiVBfzw.wGmoB2
            SIP from address: sip:10.11.8.108
                SIP from address Host Part: 10.11.8.108
            SIP from tag: KiOqopQaMoltsK3AnoRiVBfzw.wGmoB2
        To: <sip:[email protected]>;tag=z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
            SIP to address: sip:[email protected]
                SIP to address User Part: proxy
                SIP to address Host Part: asterisk.cora.nwra.com
            SIP to tag: z9hG4bKPjpdP4lMzvKIVltdvUZn3u0lEkMImwuAvr
        CSeq: 48172 MESSAGE
            Sequence Number: 48172
            Method: MESSAGE
        Server: FPBX-AsteriskNOW-12.0.74(13.5.0)
        Content-Length:  0

Maybe it can’t respond to the digium requests on the alternate port?

That’s amazingly hard to read, and I’m not really sure what the problem is. Could you possible do a ‘pjsip set logger host a.b.c.d’, ‘core set debug 4’ and ‘core set verbose 9’ and paste those? That’ll also display what asterisk is thinking about the call, too.

I am also facing this issue. @opoplawski, were you ever able to get this resolved?