関数に追加する/g
と、lineRoute
parseRoute
1 回だけ返されるのはなぜですか?
pkt = "Record-Route: <sip:10.1.20.40;lr;r2=on>\r\nRecord-Route: <sip:10.1.20.40:80;transport=ws;r2=on;lr=on>\r\n"
parseRoute = (pkt) ->
lineRoute = /Route\:/
route = ""
for line in pkt.split '\r\n'
if lineRoute.test line
tmp = line.split ': '
route += tmp[1] + ", \r\n"
return route