Empty lines with crlf protocol

What happens to incoming data with empty lines in crlf protocol. I have a situation where a packet is made up of multiple lines with crlf and the packet end is signified with an empty line.

example: -

Response: Success\r\n Message: Authentication accepted\r\n \r\n Next packet .....

Can I see the empty line or does the protocol disgard it

regards

John

Did you try it?

Yes.

I have the following in the incoming section: -

log("handleResponse: ".. data)

if #data == 0 then
  for k, v in pairs(PACKET) do
    log(k .. " " .. v)
  end
end

but it never meets that condition.

In theory it should return you an empty line. If your message isn’t printing out, it’s also possible that the way this is given to you if different from what you’re expecting (or… It really isn’t giving it to you)

What happens if you add a nil check to your log call, and does your handleResponse output appear for the blank line?

Nothing even with verbose logging: -

01 12/10/12 19:57:30.533 luup_log:61: AsteriskAMI: Asterisk Call Manager/1.2 <0x5c16> 52 12/10/12 19:57:30.535 0x52 0x65 0x73 0x70 0x6f 0x6e 0x73 0x65 0x3a 0x20 0x53 0x75 0x63 0x63 0x65 0x73 0x73 (Response: Success) <0x5c16> 01 12/10/12 19:57:30.536 luup_log:61: AsteriskAMI: Response: Success <0x5c16> 52 12/10/12 19:57:30.539 0x4d 0x65 0x73 0x73 0x61 0x67 0x65 0x3a 0x20 0x41 0x75 0x74 0x68 0x65 0x6e 0x74 0x69 0x63 0x61 0x74 0x69 0x6f 0x6e 0x20 0x61 0x63 0x63 0x65 0x70 0x74 0x65 0x64 (Message: Authentication accepted) <0x5c16> 01 12/10/12 19:57:30.540 luup_log:61: AsteriskAMI: Message: Authentication accepted <0x5c16> 52 12/10/12 19:57:30.543 0x45 0x76 0x65 0x6e 0x74 0x3a 0x20 0x46 0x75 0x6c 0x6c 0x79 0x42 0x6f 0x6f 0x74 0x65 0x64 (Event: FullyBooted) <0x5c16> 01 12/10/12 19:57:30.544 luup_log:61: AsteriskAMI: Event: FullyBooted <0x5c16> 52 12/10/12 19:57:30.546 0x50 0x72 0x69 0x76 0x69 0x6c 0x65 0x67 0x65 0x3a 0x20 0x73 0x79 0x73 0x74 0x65 0x6d 0x2c 0x61 0x6c 0x6c (Privilege: system,all) <0x5c16> 01 12/10/12 19:57:30.547 luup_log:61: AsteriskAMI: Privilege: system,all <0x5c16> 52 12/10/12 19:57:30.549 0x53 0x74 0x61 0x74 0x75 0x73 0x3a 0x20 0x46 0x75 0x6c 0x6c 0x79 0x20 0x42 0x6f 0x6f 0x74 0x65 0x64 (Status: Fully Booted) <0x5c16> 01 12/10/12 19:57:30.551 luup_log:61: AsteriskAMI: Status: Fully Booted <0x5c16>

May have to go a different route.

Yeah, that’s unfortunate. It would be worthwhile filing a bug against it.

In the meantime you can use RAW and process it the way you want. It’ll be more heavyweight, but at least it’ll function.