Failed to handle incoming SDP. Session has been already disconnected

Hello,

After switching transport in pjsip endpoint from udp to tcp Asterisk can’t accept call.
Transport configuration udp and tcp the same:

ParameterName              : ParameterValue
 ===============================================
 allow_reload               : true
 async_operations           : 1
 bind                       : xx.xxx.xxx.xx:5060
 ca_list_file               : 
 ca_list_path               : 
 cert_file                  : 
 cipher                     : 
 cos                        : 0
 domain                     : 
 external_media_address     : 
 external_signaling_address : 
 external_signaling_port    : 0
 local_net                  : 
 method                     : unspecified
 password                   : 
 priv_key_file              : 
 protocol                   : udp/tcp
 require_client_cert        : No
 symmetric_transport        : false
 tos                        : 0
 verify_client              : No
 verify_server              : No
 websocket_write_timeout    : 100

On CLI only this message:

[Dec 4 09:42:17] **ERROR** [64]: **res_pjsip_session.c** : **709** **handle_incoming_sdp** : Failed to handle incoming SDP. Session has been already disconnected 

Asterisk 17.0.0

Has anyone encountered a similar situation?

What is the actual transport configuration and endpoint configuration? Why do you have allow_reload enabled? (It is STRONGLY recommended not to enable it)

pjsip.conf:

[transport-tcp]
allow_reload=yes
type=transport
protocol=tcp
bind=xx.xxx.xxx.xx:5060

[transport-udp]
allow_reload=yes
type=transport
protocol=udp
bind=xx.xxx.xxx.xx:5060

other pjsip configuration is realtime:

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

 Endpoint:  kamailio-dev                                         In use        1 of inf
        Aor:  kamailio-aor                                       0
      Contact:  kamailio-aor/sip:xx.xxx.xxx.xx:5060        da2aa7a151 NonQual         nan
  Transport:  transport-tcp             udp      0      0  xx.xxx.xxx.xx:5060
   Identify:  kamailio-identify/kamailio-dev
        Match: xx.xxx.xxx.xx/32
    Channel: PJSIP/kamailio-dev-00000006/Echo                    Up            01:22:00   
        Exten: 999                       CLCID: "" <>


 ParameterName                      : ParameterValue
 =========================================================
 100rel                             : no
 accept_multiple_sdp_answers        : false
 accountcode                        : 
 acl                                : 
 aggregate_mwi                      : true
 allow                              : (ulaw|alaw)
 allow_overlap                      : true
 allow_subscribe                    : true
 allow_transfer                     : true
 aors                               : endpoint-aor
 asymmetric_rtp_codec               : false
 auth                               : 
 bind_rtp_to_media_address          : false
 bundle                             : false
 call_group                         : 
 callerid                           : <unknown>
 callerid_privacy                   : allowed_not_screened
 callerid_tag                       : 
 connected_line_method              : invite
 contact_acl                        : 
 context                            : default
 cos_audio                          : 0
 cos_video                          : 0
 device_state_busy_at               : 0
 direct_media                       : false
 direct_media_glare_mitigation      : none
 direct_media_method                : invite
 disable_direct_media_on_nat        : false
 dtls_auto_generate_cert            : No
 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
 fax_detect_timeout                 : 0
 follow_early_media_fork            : true
 force_avp                          : false
 force_rport                        : false
 from_domain                        : 
 from_user                          : 
 g726_non_standard                  : false
 ice_support                        : false
 identify_by                        : ip
 ignore_183_without_sdp             : false
 inband_progress                    : false
 incoming_mwi_mailbox               : 
 language                           : 
 mailboxes                          : 
 max_audio_streams                  : 1
 max_video_streams                  : 1
 media_address                      : xx.xx.xx.xx
 media_encryption                   : no
 media_encryption_optimistic        : false
 media_use_received_transport       : false
 message_context                    : 
 moh_passthrough                    : false
 moh_suggest                        : default
 mwi_from_user                      : 
 mwi_subscribe_replaces_unsolicited : no
 named_call_group                   : 
 named_pickup_group                 : 
 notify_early_inuse_ringing         : false
 one_touch_recording                : false
 outbound_auth                      : 
 outbound_proxy                     : 
 pickup_group                       : 
 preferred_codec_only               : false
 record_off_feature                 : automixmon
 record_on_feature                  : automixmon
 refer_blind_progress               : true
 rewrite_contact                    : true
 rpid_immediate                     : false
 rtcp_mux                           : false
 rtp_engine                         : asterisk
 rtp_ipv6                           : false
 rtp_keepalive                      : 0
 rtp_symmetric                      : false
 rtp_timeout                        : 0
 rtp_timeout_hold                   : 0
 sdp_owner                          : -
 sdp_session                        : Asterisk
 send_connected_line                : yes
 send_diversion                     : false
 send_pai                           : false
 send_rpid                          : false
 set_var                            : 
 srtp_tag_32                        : false
 sub_min_expiry                     : 0
 subscribe_context                  : 
 suppress_q850_reason_headers       : false
 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                          : transport-tcp
 trust_connected_line               : yes
 trust_id_inbound                   : false
 trust_id_outbound                  : false
 use_avpf                           : false
 use_ptime                          : false
 user_eq_phone                      : false
 voicemail_extension                : 
 webrtc                             : no

Is TCP actually being used from Kamailio? Your Contact also doesn’t appear to be set to use “;transport=tcp” to have TCP being used. If this isn’t done it’ll try to use UDP, and since you’ve forced TCP as the transport on the endpoint it’ll fail.

Generally you don’t need to specify a transport on the endpoint, just in the Contact URI.

1 Like

Thanks for help @jcolp! Now tcp connection works.
Now I have test environment and use allow_reload only for quick testing. Thanks for the advice.

To be honest, tcp connection didn’t solve initial issue with pickup feature in my env.
Should I describe it here or create new topic?

You should create a new topic.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.