Arduino hangs on second GSM message (was GSM based led matrix display)
Does nothing clear 'i' at the end of a message?  If not, then long/unexpected/multiple messages can overflow your str[160] buffer.  

It also looks like writing to the msg[160] buffer isn't well protected from overflow.