Rakesh privately asked me why this doesn't conform to the ABNF of a sip message. I'm replying to the list for the benefit of others.

Here is some of the relevant ABNF:

SIP-message    =  Request / Response
Request        =  Request-Line
                  *( message-header )
                  CRLF
                  [ message-body ]
Request-Line   =  Method SP Request-URI SP SIP-Version CRLF
Method            =  INVITEm / ACKm / OPTIONSm / BYEm
                     / CANCELm / REGISTERm
                     / extension-method
extension-method  =  token
Response          =  Status-Line
                     *( message-header )
                     CRLF
                     [ message-body ]
Status-Line     =  SIP-Version SP Status-Code SP Reason-Phrase CRLF
SIP-Version    =  "SIP" "/" 1*DIGIT "." 1*DIGIT
token       =  1*(alphanum / "-" / "." / "!" / "%" / "*"
                     / "_" / "+" / "`" / "'" / "~" )

Examining this you can see that a message must start with one of the following:

- a token - a method name
- "SIP/" - beginning a sip version

What you show is neither of those, so it isn't valid sip.

Over UDP every packet must start with a message. Over TCP, messages immediately follow one another. Every request or response ends with CRLF followed by an optional body. You must parse Content-Length in order to skip over the body (which may also contain CRLF).

If you encounter something that doesn't parse as a message with TCP input you have to close the connection without parsing any more, or else use a heuristic to skip over stuff until you find what seems to be the beginning of a new message.

        Thanks,
        Paul


      > 0000   *ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  *
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
> 0010  * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff*  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
     > 0020   0000   ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
     >   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
> 0010   ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ > 0020   ff ff ff ff ff ff ff ff ff ff ff 58 2d 42 72 6f  ÿÿÿÿÿÿÿÿÿÿÿX-xro
     > 0030   61 64 57 6f 72 6b 73 2d 44 4e 43 3a 20 6e 65 74   : net
> 0040   77 6f 72 6b 2d 61 64 64 72 65 73 73 3d 22 73 69  work-address="si
     > 0050   70 3a 2b 33 34 39 33 37 38 31 37 30 31 36 40 6d
    p:@xx.yyy.net <mailto:p...@xx.yyy.net>
> 0070   74 3b 75 73 65 72 3d 70 68 6f 6e 65 22 3b 75 73  t;user=phone";us > 0080   65 72 2d 69 64 3d 22 39 33 37 38 31 37 30 31 36  er-id="11111111"
     > 0090   40 6d 66 65 2e 74 65 6c 65 66 6f 6e 69 63 61 2e   @xx.yyy.
     > 00a0   6e 65 74 22 0d 0a                                 net"..
     > ÿÿÿÿÿÿÿÿÿÿÿX-xro
     > 0030   61 64 57 6f 72 6b 73 2d 44 4e 43 3a 20 6e 65 74   : net
> 0040   77 6f 72 6b 2d 61 64 64 72 65 73 73 3d 22 73 69  work-address="si
     > 0050   70 3a 2b 33 34 39 33 37 38 31 37 30 31 36 40 6d
    p:@xx.yyy.net <mailto:p...@xx.yyy.net>
> 0070   74 3b 75 73 65 72 3d 70 68 6f 6e 65 22 3b 75 73  t;user=phone";us > 0080   65 72 2d 69 64 3d 22 39 33 37 38 31 37 30 31 36  er-id="11111111"
     > 0090   40 6d 66 65 2e 74 65 6c 65 66 6f 6e 69 63 61 2e   @xx.yyy.
     > 00a0   6e 65 74 22 0d 0a                                 net"..
     >
     > [image: image.png]
     >
     > BR///
     >
     > Rakesh Kumar Mohanty
     >
     >
     > On Wed, Feb 6, 2019 at 3:21 PM Rakesh <rak...@gmail.com
    <mailto:rak...@gmail.com>> wrote:
     >
     >> Hi Expert,
     >>
     >> Can I just know on  INVITE request if I get the below characters
    then is
     >> it OK as per ABNF grammar?  Please note I am not asking about
    the header
     >> rather I need to know the correctness of the character that has
    appeared on
     >> INVITE request.
     >>
     >>
     >>
    
[truncated]\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\37
     >> Expert Info (Note/Undecoded): Unrecognised SIP header
     >> (�������������������������������������������)
     >>
     >> [image: image.png]
     >> [image: image.png]
     >>
     >> BR///
     >>
     >> Rakesh Kumar Mohanty
     >>
     >
     >
     > _______________________________________________
     > Sip-implementors mailing list
     > Sip-implementors@lists.cs.columbia.edu
    <mailto:Sip-implementors@lists.cs.columbia.edu>
     > https://lists.cs.columbia.edu/mailman/listinfo/sip-implementors
     >

    _______________________________________________
    Sip-implementors mailing list
    Sip-implementors@lists.cs.columbia.edu
    <mailto:Sip-implementors@lists.cs.columbia.edu>
    https://lists.cs.columbia.edu/mailman/listinfo/sip-implementors


_______________________________________________
Sip-implementors mailing list
Sip-implementors@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/sip-implementors

Reply via email to