def parser
      until $input_buffer.empty?
        line = $input_buffer.shift
        do_debug :in, ">#{line}"
        @args = line.split ' '
        @label = @args.shift
        @cmd   = @args.shift
        case @cmd
        # CMD Generales
        when 'OK'
        when 'NOOK'
        when 'RSALDO'
        when 'PING'
          cmd_pong @args[0], @label
        when 'PONG'
          cmd_ping @args[0], @label
        when 'RINFONUM'
        when 'RTARIFA'
        when 'BYE'
          close!
        # CMD Envios MT
        when 'SUBMITOK'
        when 'BSUBMITOK'
        when 'USUBMITOK'
        when 'FSUBMITOK'
        when 'FBSUBMITOK'
        when 'FUSUBMITOK'
        when 'WAPLINKOK'
        when 'REJDST'
        when 'ACUSE'
        when 'ACUSEACKR'
        when 'RTRANS'
        # CMD Recepcion SMS (no premium)
        when 'INCOMINGMO'

        # CMD Recepcion SMS (premium)

        else
          do_event :unknow
        end
        do_event @cmd.downcase
        do_event :all
      end
    end
def parser
      until $input_buffer.empty?
        line = $input_buffer.shift
        do_debug :in, ">#{line}"
        @args = line.split ' '
        @label = @args.shift
        @cmd   = @args.shift
        case @cmd
        # CMD Generales
        when 'OK'
        when 'NOOK'
        when 'RSALDO'
        when 'PING'
          cmd_pong @args[0], @label
        when 'PONG'
          cmd_ping @args[0], @label
        when 'RINFONUM'
        when 'RTARIFA'
        when 'BYE'
          close!
        # CMD Envios MT
        when 'SUBMITOK'
        when 'BSUBMITOK'
        when 'USUBMITOK'
        when 'FSUBMITOK'
        when 'FBSUBMITOK'
        when 'FUSUBMITOK'
        when 'WAPLINKOK'
        when 'REJDST'
        when 'ACUSE'
        when 'ACUSEACKR'
        when 'RTRANS'
        # CMD Recepcion SMS (no premium)
        when 'INCOMINGMO'

        # CMD Recepcion SMS (premium)

        else
          do_event :unknow
        end
        do_event @cmd.downcase
        do_event :all
      end
    end
CMD Recepcion SMS (no premium) end
 CMD Recepcion SMS (premium)
 CMD Recepcion SMS (premium) end