RestComm / jain-sip

Disclaimer: This repository is a git-svn mirror of the project found at http://java.net/projects/jsip whose original repository is developed collaboratively by the Advanced Networking Technologies Division at the National Institute of Standards and Technology (NIST) - an agency of the United States Department of Commerce and by a community of individual and enterprise contributors. TeleStax, Inc. will perform some productization work, new features experimentation branches, etc for its TelScale jSIP product that doesn't concern the community from the main repository hence this git repository.
http://www.restcomm.com/
141 stars 151 forks source link

JAIN SIP validation of SIP messages #157

Open atsakiridis opened 7 years ago

atsakiridis commented 7 years ago

I have this crash in Android SDK where an incoming INVITE doesn't include a Contact header which is mandatory AFAIK. The problem is that JAIN SIP doesn't spot that and the application continues processing normally by trying to generate a 180 Ringing which bombs with:

java.lang.RuntimeException: Failed to send Ringing to incoming Invite
    at org.restcomm.android.sdk.SignalingClient.JainSipClient.JainSipCall.processRequest(JainSipCall.java:359)
    at org.restcomm.android.sdk.SignalingClient.JainSipClient.JainSipClient$2.run(JainSipClient.java:677)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: android.javax.sip.TransactionUnavailableException: Missing a required header : Contact (at offset 0)
    at android.gov.nist.javax.sip.SipProviderImpl.getNewServerTransaction(SipProviderImpl.java:476)
    at org.restcomm.android.sdk.SignalingClient.JainSipClient.JainSipCall.processRequest(JainSipCall.java:339)
    ... 5 more
Caused by: java.text.ParseException: Missing a required header : Contact (at offset 0)
    at android.gov.nist.javax.sip.message.SIPRequest.checkHeaders(SIPRequest.java:318)
    at android.go

@jaimecasero @deruelle shouldn't JAIN SIP discard the incoming INVITE on account of being invalid and return something like 400 Bad Request to the requester? Thoughts?