A 17-year-old boy may have communicated with foreigners before allegedly carrying a gun onto a plane at one of Australia's major regional airports.