[asterisk-bugs] [JIRA] (ASTERISK-20745) In MESSAGE received over WebSocket, the body last char is cut

Pedro Kiefer (JIRA) noreply at issues.asterisk.org
Tue Nov 27 12:51:45 CST 2012


    [ https://issues.asterisk.org/jira/browse/ASTERISK-20745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=200137#comment-200137 ] 

Pedro Kiefer edited comment on ASTERISK-20745 at 11/27/12 12:51 PM:
--------------------------------------------------------------------

JsSIP Console:
{noformat}
JsSIP | TRANSPORT | Sending WebSocket message: 

MESSAGE sip:1111 at 172.20.31.134 SIP/2.0
Route: <sip:172.20.31.134:8088;transport=ws;lr>
Via: SIP/2.0/TCP 42.107.20.23;branch=z9hG4bK4369947
Max-Forwards: 69
To: sip:1111 at 172.20.31.134
From: sip:1236 at 172.20.31.134;tag=cbpmz73k95
Call-ID: az55yytkaq71ta7fd2t9
CSeq: 9439 MESSAGE
Authorization: Digest username="1236",realm="tecnosenior.com",nonce="2ca4080c",uri="sip:1111 at 172.20.31.134",response="c57c696f92891beb9e61eccae8320620",algorithm=MD5
Content-Type: text/plain
Supported: path, outbound, gruu
User-Agent: JsSIP 0.2.1
Content-Length: 4

qwer
{noformat}

Wireshark on the same machine as JsSIP:
{noformat}
No.     Time           Source                Destination           Protocol Length Info
    501 20.984410000   172.20.31.142         172.20.31.134         WebSocket 467    WebSocket Text [FIN] [MASKED]

Frame 501: 467 bytes on wire (3736 bits), 467 bytes captured (3736 bits) on interface 0
Ethernet II, Src: Apple_b0:c1:02 (00:1e:c2:b0:c1:02), Dst: CadmusCo_5a:01:55 (08:00:27:5a:01:55)
Internet Protocol Version 4, Src: 172.20.31.142 (172.20.31.142), Dst: 172.20.31.134 (172.20.31.134)
Transmission Control Protocol, Src Port: 53506 (53506), Dst Port: radan-http (8088), Seq: 8106, Ack: 5916, Len: 401
Hypertext Transfer Protocol
WebSocket
    1... .... = Fin: True
    .000 .... = Reserved: 0x00
    .... 0001 = Opcode: Text (1)
    1... .... = Mask: True
    .111 1110 = Payload length: 126 Extended Payload Length (16 bits)
    Extended Payload length (16 bits): 393
    Masking-Key: e3140db9
    Payload
        Text: ae515eeaa2534899907d7d83d2253c88a3253a8bcd263d97...
    Unmask Payload
0000   4d 45 53 53 41 47 45 20 73 69 70 3a 31 31 31 31  MESSAGE sip:1111
0010   40 31 37 32 2e 32 30 2e 33 31 2e 31 33 34 20 53  @172.20.31.134 S
0020   49 50 2f 32 2e 30 0d 0a 52 6f 75 74 65 3a 20 3c  IP/2.0..Route: <
0030   73 69 70 3a 31 37 32 2e 32 30 2e 33 31 2e 31 33  sip:172.20.31.13
0040   34 3a 38 30 38 38 3b 74 72 61 6e 73 70 6f 72 74  4:8088;transport
0050   3d 77 73 3b 6c 72 3e 0d 0a 56 69 61 3a 20 53 49  =ws;lr>..Via: SI
0060   50 2f 32 2e 30 2f 54 43 50 20 34 32 2e 31 30 37  P/2.0/TCP 42.107
0070   2e 32 30 2e 32 33 3b 62 72 61 6e 63 68 3d 7a 39  .20.23;branch=z9
0080   68 47 34 62 4b 35 38 37 33 35 37 31 0d 0a 4d 61  hG4bK5873571..Ma
0090   78 2d 46 6f 72 77 61 72 64 73 3a 20 36 39 0d 0a  x-Forwards: 69..
00a0   54 6f 3a 20 73 69 70 3a 31 31 31 31 40 31 37 32  To: sip:1111 at 172
00b0   2e 32 30 2e 33 31 2e 31 33 34 0d 0a 46 72 6f 6d  .20.31.134..From
00c0   3a 20 73 69 70 3a 31 32 33 36 40 31 37 32 2e 32  : sip:1236 at 172.2
00d0   30 2e 33 31 2e 31 33 34 3b 74 61 67 3d 63 62 70  0.31.134;tag=cbp
00e0   6d 7a 37 33 6b 39 35 0d 0a 43 61 6c 6c 2d 49 44  mz73k95..Call-ID
00f0   3a 20 61 7a 35 35 79 79 74 6b 61 71 37 31 74 61  : az55yytkaq71ta
0100   37 66 64 32 74 39 0d 0a 43 53 65 71 3a 20 39 34  7fd2t9..CSeq: 94
0110   33 38 20 4d 45 53 53 41 47 45 0d 0a 43 6f 6e 74  38 MESSAGE..Cont
0120   65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 70  ent-Type: text/p
0130   6c 61 69 6e 0d 0a 53 75 70 70 6f 72 74 65 64 3a  lain..Supported:
0140   20 70 61 74 68 2c 20 6f 75 74 62 6f 75 6e 64 2c   path, outbound,
0150   20 67 72 75 75 0d 0a 55 73 65 72 2d 41 67 65 6e   gruu..User-Agen
0160   74 3a 20 4a 73 53 49 50 20 30 2e 32 2e 31 0d 0a  t: JsSIP 0.2.1..
0170   43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20  Content-Length: 
0180   34 0d 0a 0d 0a 71 77 65 72                       4....qwer
{noformat}
Asterisk SIP debug output:
{noformat}
<--- SIP read from WS:172.20.31.142:53506 --->
MESSAGE sip:1111 at 172.20.31.134 SIP/2.0
Route: <sip:172.20.31.134:8088;transport=ws;lr>
Via: SIP/2.0/TCP 42.107.20.23;branch=z9hG4bK5873571
Max-Forwards: 69
To: sip:1111 at 172.20.31.134
From: sip:1236 at 172.20.31.134;tag=cbpmz73k95
Call-ID: az55yytkaq71ta7fd2t9
CSeq: 9438 MESSAGE
Content-Type: text/plain
Supported: path, outbound, gruu
User-Agent: JsSIP 0.2.1
Content-Length: 4

qwe
<------------->
{noformat}
                
      was (Author: pedrokiefer):
    JsSIP Console:
{noformat}
JsSIP | TRANSPORT | Sending WebSocket message: 

MESSAGE sip:1111 at 172.20.31.134 SIP/2.0
Route: <sip:172.20.31.134:8088;transport=ws;lr>
Via: SIP/2.0/TCP 42.107.20.23;branch=z9hG4bK4369947
Max-Forwards: 69
To: sip:1111 at 172.20.31.134
From: sip:1236 at 172.20.31.134;tag=cbpmz73k95
Call-ID: az55yytkaq71ta7fd2t9
CSeq: 9439 MESSAGE
Authorization: Digest username="1236",realm="tecnosenior.com",nonce="2ca4080c",uri="sip:1111 at 172.20.31.134",response="c57c696f92891beb9e61eccae8320620",algorithm=MD5
Content-Type: text/plain
Supported: path, outbound, gruu
User-Agent: JsSIP 0.2.1
Content-Length: 4

qwer
{noformat}

Wireshark on the same machine as JsSIP:
{noformat}
0000   4d 45 53 53 41 47 45 20 73 69 70 3a 31 31 31 31  MESSAGE sip:1111
0010   40 31 37 32 2e 32 30 2e 33 31 2e 31 33 34 20 53  @172.20.31.134 S
0020   49 50 2f 32 2e 30 0d 0a 52 6f 75 74 65 3a 20 3c  IP/2.0..Route: <
0030   73 69 70 3a 31 37 32 2e 32 30 2e 33 31 2e 31 33  sip:172.20.31.13
0040   34 3a 38 30 38 38 3b 74 72 61 6e 73 70 6f 72 74  4:8088;transport
0050   3d 77 73 3b 6c 72 3e 0d 0a 56 69 61 3a 20 53 49  =ws;lr>..Via: SI
0060   50 2f 32 2e 30 2f 54 43 50 20 34 32 2e 31 30 37  P/2.0/TCP 42.107
0070   2e 32 30 2e 32 33 3b 62 72 61 6e 63 68 3d 7a 39  .20.23;branch=z9
0080   68 47 34 62 4b 35 38 37 33 35 37 31 0d 0a 4d 61  hG4bK5873571..Ma
0090   78 2d 46 6f 72 77 61 72 64 73 3a 20 36 39 0d 0a  x-Forwards: 69..
00a0   54 6f 3a 20 73 69 70 3a 31 31 31 31 40 31 37 32  To: sip:1111 at 172
00b0   2e 32 30 2e 33 31 2e 31 33 34 0d 0a 46 72 6f 6d  .20.31.134..From
00c0   3a 20 73 69 70 3a 31 32 33 36 40 31 37 32 2e 32  : sip:1236 at 172.2
00d0   30 2e 33 31 2e 31 33 34 3b 74 61 67 3d 63 62 70  0.31.134;tag=cbp
00e0   6d 7a 37 33 6b 39 35 0d 0a 43 61 6c 6c 2d 49 44  mz73k95..Call-ID
00f0   3a 20 61 7a 35 35 79 79 74 6b 61 71 37 31 74 61  : az55yytkaq71ta
0100   37 66 64 32 74 39 0d 0a 43 53 65 71 3a 20 39 34  7fd2t9..CSeq: 94
0110   33 38 20 4d 45 53 53 41 47 45 0d 0a 43 6f 6e 74  38 MESSAGE..Cont
0120   65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 70  ent-Type: text/p
0130   6c 61 69 6e 0d 0a 53 75 70 70 6f 72 74 65 64 3a  lain..Supported:
0140   20 70 61 74 68 2c 20 6f 75 74 62 6f 75 6e 64 2c   path, outbound,
0150   20 67 72 75 75 0d 0a 55 73 65 72 2d 41 67 65 6e   gruu..User-Agen
0160   74 3a 20 4a 73 53 49 50 20 30 2e 32 2e 31 0d 0a  t: JsSIP 0.2.1..
0170   43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20  Content-Length: 
0180   34 0d 0a 0d 0a 71 77 65 72                       4....qwer
{noformat}
Asterisk SIP debug output:
{noformat}
<--- SIP read from WS:172.20.31.142:53506 --->
MESSAGE sip:1111 at 172.20.31.134 SIP/2.0
Route: <sip:172.20.31.134:8088;transport=ws;lr>
Via: SIP/2.0/TCP 42.107.20.23;branch=z9hG4bK5873571
Max-Forwards: 69
To: sip:1111 at 172.20.31.134
From: sip:1236 at 172.20.31.134;tag=cbpmz73k95
Call-ID: az55yytkaq71ta7fd2t9
CSeq: 9438 MESSAGE
Content-Type: text/plain
Supported: path, outbound, gruu
User-Agent: JsSIP 0.2.1
Content-Length: 4

qwe
<------------->
{noformat}
                  
> In MESSAGE received over WebSocket, the body last char is cut
> -------------------------------------------------------------
>
>                 Key: ASTERISK-20745
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20745
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_sip/WebSocket
>    Affects Versions: SVN, 11.0.1
>            Reporter: Iñaki Baz Castillo
>
> When Asterisk receives a SIP MESSAGE over WebSocket it cuts the last char of the body. So if for example the MESSAGE contains "Content-Length: 4" and a body with content "1234" (without quotes), the Asterisk debug console prints the body as "123", and then it forwards the MESSAGE with "123" as body.
> This bug seems not to occur when the SIP MESSAGE arrives via SIP over TCP or UDP, so it must be a bug in the SIP WebSocket layer/parser.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list